質問するログイン新規登録

質問編集履歴

2

追記

2017/03/10 11:16

投稿

shiro-kuma
shiro-kuma

スコア15

title CHANGED
File without changes
body CHANGED
@@ -278,4 +278,14 @@
278
278
 
279
279
 
280
280
  ###補足情報(言語/FW/ツール等のバージョンなど)
281
- Wordpress 4.7.2
281
+ Wordpress 4.7.2
282
+
283
+
284
+ ###追記
285
+ single.phpにwp_head();を入れることで、cssは反映されるようになりました。
286
+ しかし、カウントはされないままです。
287
+ ただ、いいねボタンを押すと、下記のエラーが出ます。
288
+
289
+ ```
290
+ Uncaught ReferenceError: toastr is not defined
291
+ ```

1

ソース追加

2017/03/10 11:16

投稿

shiro-kuma
shiro-kuma

スコア15

title CHANGED
File without changes
body CHANGED
@@ -89,11 +89,193 @@
89
89
  ・[WP Ulike](https://wordpress.org/plugins/wp-ulike/)
90
90
  参考:[https://clrmemory.com/wordpress/wpulike-goodbutton-plugin/](https://clrmemory.com/wordpress/wpulike-goodbutton-plugin/)
91
91
 
92
+ ```PHP
93
+ <?php
94
+ /*
95
+ Plugin Name:WP ULike
96
+ Plugin URI: http://preview.alimir.ir/developer/wp-ulike/
97
+ Description: WP ULike plugin allows to integrate a beautiful Ajax Like Button into your wordPress website to allow your visitors to like and unlike pages, posts, comments AND buddypress activities. Its very simple to use and supports many options.
98
+ Version: 2.4.2
99
+ Author: Ali Mirzaei
100
+ Author URI: http://about.alimir.ir
101
+ Text Domain: wp-ulike
102
+ Domain Path: /lang/
103
+ License: GPL2
104
+ */
105
+
106
+ //Do not change this value
107
+ define( 'WP_ULIKE_VERSION' , '2.4.2' );
108
+ define( 'WP_ULIKE_SLUG' , 'wp-ulike' );
109
+ define( 'WP_ULIKE_DB_VERSION' , '1.3' );
110
+
111
+ //Load Translations
112
+ load_plugin_textdomain( WP_ULIKE_SLUG, false, dirname( plugin_basename( __FILE__ ) ) .'/lang/' );
113
+
114
+ /**
115
+ * When the plugin is activated, This function will install wp_ulike tables in database (If not exist table)
116
+ *
117
+ * @author Alimir
118
+ * @since 1.1
119
+ * @updated 1.7
120
+ * @return Void
121
+ */
122
+ register_activation_hook( __FILE__, 'wp_ulike_install' );
123
+ function wp_ulike_install() {
124
+ global $wpdb;
125
+
126
+ $table_name = $wpdb->prefix . "ulike";
127
+ if ( $wpdb->get_var( "show tables like '$table_name'" ) != $table_name ) {
128
+ $sql = "CREATE TABLE " . $table_name . " (
129
+ `id` bigint(11) NOT NULL AUTO_INCREMENT,
130
+ `post_id` int(11) NOT NULL,
131
+ `date_time` datetime NOT NULL,
132
+ `ip` varchar(30) NOT NULL,
133
+ `user_id` int(11) NOT NULL,
134
+ `status` varchar(15) NOT NULL,
135
+ PRIMARY KEY (`id`)
136
+ );";
137
+
138
+ require_once ABSPATH . 'wp-admin/includes/upgrade.php';
139
+ dbDelta( $sql );
140
+
141
+ add_option( 'wp_ulike_dbVersion', WP_ULIKE_DB_VERSION );
142
+ }
143
+
144
+ $table_name_2 = $wpdb->prefix . "ulike_comments";
145
+ if ( $wpdb->get_var( "show tables like '$table_name_2'" ) != $table_name_2 ) {
146
+ $sql = "CREATE TABLE " . $table_name_2 . " (
147
+ `id` bigint(11) NOT NULL AUTO_INCREMENT,
148
+ `comment_id` int(11) NOT NULL,
149
+ `date_time` datetime NOT NULL,
150
+ `ip` varchar(30) NOT NULL,
151
+ `user_id` int(11) NOT NULL,
152
+ `status` varchar(15) NOT NULL,
153
+ PRIMARY KEY (`id`)
154
+ );";
155
+
156
+ require_once ABSPATH . 'wp-admin/includes/upgrade.php';
157
+ dbDelta( $sql );
158
+
159
+ update_option( 'wp_ulike_dbVersion', WP_ULIKE_DB_VERSION );
160
+ }
161
+
162
+ $table_name_3 = $wpdb->prefix . "ulike_activities";
163
+ if ( $wpdb->get_var( "show tables like '$table_name_3'" ) != $table_name_3 ) {
164
+ $sql = "CREATE TABLE " . $table_name_3 . " (
165
+ `id` bigint(11) NOT NULL AUTO_INCREMENT,
166
+ `activity_id` int(11) NOT NULL,
167
+ `date_time` datetime NOT NULL,
168
+ `ip` varchar(30) NOT NULL,
169
+ `user_id` int(11) NOT NULL,
170
+ `status` varchar(15) NOT NULL,
171
+ PRIMARY KEY (`id`)
172
+ );";
173
+
174
+ require_once ABSPATH . 'wp-admin/includes/upgrade.php';
175
+ dbDelta( $sql );
176
+
177
+ update_option( 'wp_ulike_dbVersion', WP_ULIKE_DB_VERSION );
178
+ }
179
+
180
+ $table_name_4 = $wpdb->prefix . "ulike_forums";
181
+ if ( $wpdb->get_var( "show tables like '$table_name_4'" ) != $table_name_4 ) {
182
+ $sql = "CREATE TABLE " . $table_name_4 . " (
183
+ `id` bigint(11) NOT NULL AUTO_INCREMENT,
184
+ `topic_id` int(11) NOT NULL,
185
+ `date_time` datetime NOT NULL,
186
+ `ip` varchar(30) NOT NULL,
187
+ `user_id` int(11) NOT NULL,
188
+ `status` varchar(15) NOT NULL,
189
+ PRIMARY KEY (`id`)
190
+ );";
191
+
192
+ require_once ABSPATH . 'wp-admin/includes/upgrade.php';
193
+ dbDelta( $sql );
194
+
195
+ update_option( 'wp_ulike_dbVersion', WP_ULIKE_DB_VERSION );
196
+ }
197
+
198
+ }
199
+
200
+
201
+ /**
202
+ * Applied to the list of links to display on the plugins page
203
+ *
204
+ * @author Alimir
205
+ * @since 2.3
206
+ * @return String
207
+ */
208
+ $prefix = is_network_admin() ? 'network_admin_' : '';
209
+ add_filter( "{$prefix}plugin_action_links", 'wp_ulike_add_plugin_links', 10, 5 );
210
+ function wp_ulike_add_plugin_links( $actions, $plugin_file )
211
+ {
212
+ static $plugin;
213
+
214
+ if (!isset($plugin))
215
+ $plugin = plugin_basename(__FILE__);
216
+ if ($plugin == $plugin_file) {
217
+
218
+ $settings = array('settings' => '<a href="admin.php?page=wp-ulike-settings">' . __('Settings', WP_ULIKE_SLUG) . '</a>');
219
+ $stats = array('stats' => '<a href="admin.php?page=wp-ulike-statistics">' . __('Statistics', WP_ULIKE_SLUG) . '</a>');
220
+ $about = array('about' => '<a href="admin.php?page=wp-ulike-about">' . __('About', WP_ULIKE_SLUG) . '</a>');
221
+
222
+ $actions = array_merge($about, $actions);
223
+ $actions = array_merge($stats, $actions);
224
+ $actions = array_merge($settings, $actions);
225
+
226
+ }
227
+
228
+ return $actions;
229
+ }
230
+
231
+ /**
232
+ * Redirect to the "About WP ULike" page after plugin activation.
233
+ *
234
+ * @author Alimir
235
+ * @since 2.3
236
+ * @return Void
237
+ */
238
+ add_action( 'activated_plugin', 'wp_ulike_activation_redirect' );
239
+ function wp_ulike_activation_redirect( $plugin ) {
240
+ if( $plugin == plugin_basename( __FILE__ ) ) {
241
+ exit( wp_redirect( admin_url( 'admin.php?page=wp-ulike-about' ) ) );
242
+ }
243
+ }
244
+
245
+ /**
246
+ * This hook is called once any activated plugins have been loaded.
247
+ *
248
+ * @author Alimir
249
+ * @since 1.7
250
+ * @return Void
251
+ */
252
+ add_action( 'plugins_loaded', 'wp_ulike_update_db_check' );
253
+ function wp_ulike_update_db_check() {
254
+ if ( get_site_option( 'wp_ulike_dbVersion' ) != WP_ULIKE_DB_VERSION ) {
255
+ wp_ulike_install();
256
+ }
257
+ }
258
+
259
+ //Include plugin setting file
260
+ include plugin_dir_path( __FILE__ ) . 'admin/admin.php';
261
+
262
+ //Include general functions
263
+ include plugin_dir_path( __FILE__ ) . 'inc/wp-functions.php';
264
+
265
+ //Include plugin scripts
266
+ include plugin_dir_path( __FILE__ ) . 'inc/wp-script.php';
267
+
268
+ //Load WP ULike functions
269
+ include plugin_dir_path( __FILE__ ) . 'inc/wp-ulike.php';
270
+
271
+ ```
272
+
92
273
  ・[Reaction Buttons](https://ja.wordpress.org/plugins/reaction-buttons/)
93
274
  参考:[https://liginc.co.jp/programmer/archives/3497](https://liginc.co.jp/programmer/archives/3497)
94
275
 
95
276
  ・[Zilla likes](http://www.themezilla.com/plugins/zillalikes/)
96
277
  参考:[http://www.nxworld.net/wordpress/wp-plugin-zillalikes.html](http://www.nxworld.net/wordpress/wp-plugin-zillalikes.html)
97
278
 
279
+
98
280
  ###補足情報(言語/FW/ツール等のバージョンなど)
99
281
  Wordpress 4.7.2