Changeset 1397774
- Timestamp:
- 04/17/2016 01:52:16 PM (10 years ago)
- Location:
- cs-likes-counter/trunk
- Files:
-
- 2 edited
-
cs-likes-counter.php (modified) (2 diffs)
-
readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cs-likes-counter/trunk/cs-likes-counter.php
r1397762 r1397774 4 4 Plugin URI: http://codesweet.ru/cs-likes-counter/ 5 5 Description: Likes Dislikes post counter 6 Version: 1.0. 26 Version: 1.0.3 7 7 Author: EdCreater 8 8 Author URI: http://codesweet.ru … … 287 287 * @return string $form html form 288 288 */ 289 public static function show_buttons_like( ){289 public static function show_buttons_like($post_id = NULL){ 290 290 global $post, $current_user; 291 291 292 292 get_currentuserinfo(); 293 293 294 $post_likes = get_post_meta($post->ID, 'cs_post_likes', true); 294 if (!$post_id){ 295 $post_id = $post->ID; 296 } 297 $post_likes = get_post_meta($post_id, 'cs_post_likes', true); 295 298 if (empty($post_likes)){ 296 299 $post_likes = 0; 297 300 } 298 $post_dislikes = get_post_meta($post ->ID, 'cs_post_dislikes', true);301 $post_dislikes = get_post_meta($post_id, 'cs_post_dislikes', true); 299 302 if (empty($post_dislikes)){ 300 303 $post_dislikes= 0; 301 304 } 302 305 303 $form = '<div id="cs-likes-dislikes-'.$post ->ID.'" class="cs-likes-dislikes">';306 $form = '<div id="cs-likes-dislikes-'.$post_id.'" class="cs-likes-dislikes">'; 304 307 $form .='<form action="" method="post" class="cs-likes-dislikes-form">'; 305 308 306 $form .= '<a href="#" class="cs-like-post" data-post="' . $post ->ID. '"><span class="like-ico"></span>';309 $form .= '<a href="#" class="cs-like-post" data-post="' . $post_id . '"><span class="like-ico"></span>'; 307 310 $form .= '<span class="like-count">'.$post_likes.'</span></a>'; 308 $form .= '<a href="#" class="cs-dislike-post" data-post="' . $post ->ID. '"><span class="dislike-ico"></span>';311 $form .= '<a href="#" class="cs-dislike-post" data-post="' . $post_id . '"><span class="dislike-ico"></span>'; 309 312 $form .= '<span class="dislike-count">'.$post_dislikes.'</span></a>'; 310 313 -
cs-likes-counter/trunk/readme.txt
r1397765 r1397774 5 5 Requires at least: 3.9 6 6 Tested up to: 4.4.2 7 Stable tag: 1.0. 27 Stable tag: 1.0.3 8 8 License: GPLv2 9 9 … … 22 22 Simply place the template single.php function call inside the loop 23 23 24 <?php echo CS_Likes::show_buttons_like(); ?> 24 <?php while(have_post()) : the_post(); ?> 25 <?php echo CS_Likes::show_buttons_like(); ?> 26 <?php endwhile; ?> 27 28 Or use ID of post, if function call outside the loop 29 30 <?php echo CS_Likes::show_buttons_like($post_id); ?> 25 31 26 32 … … 51 57 = I\'m having issues getting the plugin to work what should I do? = 52 58 53 See the [FAQs](http://codesweet.dev/nashi-razrabotki/cs-likes-counter ) page for a detailed rundown of common issues59 See the [FAQs](http://codesweet.dev/nashi-razrabotki/cs-likes-counter/) page for a detailed rundown of common issues 54 60 55 61 … … 64 70 * Add Russian Language support 65 71 * Add likes metabox to page 72 73 = 1.0.2 = 74 75 * Add support function outside the loop
Note: See TracChangeset
for help on using the changeset viewer.