Horizontal bar displays when it shouldn't – SOLUTION
-
First of all, great plugin! The dynamic switch to the horizontal bar and ability to disable the Sharebar on particular posts/pages are great features that other similar plugins lack. There is one problem I ran into, however:
Basic settings: Sharebar enabled on all posts and pages (I then disabled the Sharebar on most pages). When the “Display horizontal Sharebar if the page is resized to less than x px?” box is checked, the horizontal bar appears on posts/pages even when it is supposed to be disabled for that page.
I took a look at the sharebar.php file and discovered the problem. The “
function sharebar_horizontal
” function (lines 120-129) doesn’t check the value of “$sharebar_hide
“. Here is the reworked function:function sharebar_horizontal($print = true){ global $wpdb, $post; $sharebar_hide = get_post_meta($post->ID, 'sharebar_hide', true); if(empty($sharebar_hide)) { if(get_option('sharebar_horizontal')){ global $wpdb; $str = '<ul id="sharebarx">'; $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".$wpdb->prefix."sharebar WHERE enabled=1 ORDER BY position, id ASC")); $str .= "\n"; foreach($results as $result) { $str .= '<li>'.sharebar_filter($result->small).'</li>'; } $str .= '</ul>'; if($print) echo $str; else return $str; } } }
Hope this helps anyone else who runs into the same problem. Hopefully Dolon will include this in the next update.
- The topic ‘Horizontal bar displays when it shouldn't – SOLUTION’ is closed to new replies.