Sign Up |

Horizontal bar working on home page, but not single pages

(7 posts) (2 voices)
  1. jgentes Posted 1 year ago #

    Hi, I'm trying to get the horizontal bar working on individual pages. The div doesn't seem to load the javascript properly, as far as I can tell from the source.

    It's working here: http://thesocialbusinessblog.com but not here: http://thesocialbusinessblog.com/2010/07/17/social-media-for-a-dental-practice/

    I've noticed I can recreate the same problem on the home page if I turn off the setting for "Display horizontal Sharebar if the page is resized to less than 1000px?", if that's of any help.

    Thanks! I've been banging my head on this one..

  2. Monjurul Dolon Posted 1 year ago #

    Did you manually add the Sharebar code to your template? It looks like the actual JavaScript function is being called numerous times - you only want to call it once for the plugin to work properly.

    From the looks of it, you've added the sharebar_horizontal code to the index template but not to the single.php, which is where it would need to go to show up on that page.

  3. jgentes Posted 1 year ago #

    Thanks for the speedy reply!

    I'm using Thesis, which has an 'openhook' plugin that allows me to specify code for each hook - in this case, I have this code in the 'after post' hook:

    <ul id="share-bar">
    <li class="share">SHARE
    <li class="backtype"><?php sharebar_horizontal(); ?>

    Also noticed I had some javascript garbage in there - it wasn't causing the problem, I was just trying different things. I've cleaned that up.

    So ideally I would not directly modify the single.php file to prevent upgrade issues in the future, since the 'after post' hook should do the same thing, no?

  4. Monjurul Dolon Posted 1 year ago #

    I'm somewhat familiar with Thesis (especially after the recent debates!) but I haven't used their hook features too much yet. The only problem with using the after_post hook is that it will apply it to the main homepage, single posts and possibly even pages. I don't think there is a hook specifically for a the post itself, but I'm not sure why it's not showing up in the posts either.

    In this circumstance, I would probably recommend using the default functionality of the plugin (automatically adding the code), as it is probably too much work to custom code it in.

    Sorry if that doesn't help much, let me know if there's anything else I can do.

  5. jgentes Posted 1 year ago #

    No problem, I appreciate your help. I was thinking along the same lines - what I ended up doing was just using the default functionality for the horizontal version on the home page and the vertical version on the post pages, and that's looking pretty good, so we're all set.

    Thanks!

  6. Monjurul Dolon Posted 1 year ago #

    Glad to hear that, best of luck with the blog!

  7. jgentes Posted 1 year ago #

    Ok, been chatting with the Thesis developers, here's the tread:

    *developer*

    This bit of test code (when placed in custom_functions.php) correctly picks up the permalink for each post, even on a multi-post listing:

    function post_link() { ?>
    ">Permalink
    <?php }

    add_action('thesis_hook_after_post', 'post_link');

    So, what's the exact code you're using for your sharebar?

    *me*

    Thanks - I think you've hit it on the head, I appear to be referencing the function, but the function itself isn't in the hook:

    <ul id="share-bar">
    <li class="share">SHARE
    <li class="backtype"><?php sharebar_horizontal(); ?>

    Should I try to take the entire PHP content from the sharebar.php file and drop it into the custom_functions file? I guess I was thinking that would be equivalent to loading the plugin normally.

    *developer*

    This problem may be more to do with the plugin itself. I added this code to custom_functions.php:

    function show_sharebar() {
    if (function_exists('sharebar_horizontal')) {
    sharebar_horizontal();
    }
    }

    add_action('thesis_hook_after_post', 'show_sharebar');

    And while the sharebar showed up in the correct location on the home page, it had none of the necessary styling, and only the email link correctly picked up the post's permalink - if it can detect it correctly for one button, it should be able to detect it correctly for all.

    When using the plugin's "Auto On", the code worked perfectly on the single post.

    So maybe there's more to it than just calling the sharebar_horizontal function, despite what the plugin's documentation suggests.

    *me*

    Would love to hear your thoughts!


Reply

You must log in to post.

© Copyright 2010 DevGrow - Design. Develop. Grow. 20 queries. 0.37 seconds.