Support » Plugins and Hacks » [Resolved] Buttons on homepage posts

[Resolved] Buttons on homepage posts

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Simple Share



    Have you edited a file in order to display the buttons? The shortcode will by default extract the current page URL, but you can force it to share a specific URL if you wish, like so:

    [ssba url="http://www.simplesharebuttons.com" title="Simple Share Buttons"]

    Both a title and url must be specified. You could use a couple of WordPress functions to specify each of these, here’s an excerpt used in the plugin:

    $urlCurrentPage = get_permalink($post->ID);
    $strPageTitle = get_the_title($post->ID);

    You should however be able to simply achieve this by checking the ‘Homepage’ option within the admin panel, but the above may be useful if you are trying to achieve something different.

    Hope it helps!


    Hi thanks for you response. Still trying to fix it, I’m not a coding pro so please bear with me.

    I tried checking the ‘homepage’ option but it didn’t do anything.

    I’ll be a little more specific, my homepage contains links to all my posts, here is a snippet of the relevant code in the loop (I think the top php section is relevant).

    						global $wpdb;
    						$sql="select * from $wppost where ID='$post->ID'";
    						$query =mysql_query($sql);
    							 $post_title  = $res['post_title'];
    					<h1><a href="<?php the_permalink(); ?>"><?php echo strip_tags($post_title);  ?></a></h1>

    Well I tried this but it didn’t work:
    <div style="margin-top:-5px;"><?php echo do_shortcode('[ssba url=<?php the_permalink(); ?> title="Share"]'); ?></div>

    Thanks again

    Plugin Author Simple Share


    Some themes aren’t configured quite as WordPress requests I believe, so unfortunately it doesn’t always work straight away.

    You’ll need to wrap the URL attribute in double quotes for it to work, have a go with the below:

    <div style="margin-top:-5px;"><?php echo do_shortcode('[ssba url="' . the_permalink() . '" title="' . $post_title . '"]'); ?></div>

    Note that I’ve also used your post_title variable for the title. I’ve stripped out the second <?php tag for you to. A good attempt, well done for having a stab at it.

    Saying that, hopefully I’ve got it right myself, I’d like to have tested it first!

    Hope it works for you, let me know how you get on!

    Appreciate the advice, but it hasn’t seemed to have done the trick…

    Here’s what is appearing: text of the post’s url, followed by the buttons, which are incorrectly trying to share the homepage url instead of the post url, as before.

    Plugin Author Simple Share


    Hey, sorry to hear that hasn’t worked for you.

    Would you be happy to share the file that you are editing so I can take a look?

    Sharing via http://ge.tt/ is a good way.



    Sure, here is the file – http://www.mediafire.com/?1akyb7k0bnv3iny

    Let me know if there’s any other info I can provide

    I am desparately trying to get the ssba to work on my own location in the theme on the homepage but nothing works. Your suggestion above:
    <?php echo do_shortcode(‘[ssba url=”‘ . the_permalink() . ‘” title=”‘ . $post_title . ‘”]’); ?>
    just prints the url and leaves the ssba the same.. I tried many other things but nothing works. Shouldn’t this be very easy? What would the code be if you would say create a separate shortcode for the homepage that links to the permalink of the post instead of the url of the whole page? I really hope you can help me with this.

    Try this one:
    <?php echo do_shortcode(‘[ssba url=”‘ . get_permalink($post->ID) . ‘” title=”‘ . get_the_title($post->ID) . ‘”]’); ?>

    I’m not a programmer but for me it works

    Plugin Author Simple Share


    Thanks for helping out there Jeff 🙂

    Thank you for this great Plugin :)!

    I am working on my website again and although the code above suggested by Jeff1601 works in the sense that it shows the buttons, there is a weird problem with the share count of google+. Namely on the frontpage/archive pages etc which show multiple posts on one page the google+ share count is either “0” or “958”. It is always either of these two. On single pages the google share count works properly. Can you please help me solve this as I have no idea. Or perhaps you have a different code to show the buttons on posts on the frontpage and the code suggested by Jeff1601? Thanks a lo.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘[Resolved] Buttons on homepage posts’ is closed to new replies.