Support » Fixing WordPress » Social buttons help

  • ResolvedModerator t-p


    Hi all,

    Please guide me as to where I can place (i.e., which file and location within that file) social buttons manually.

    Thank a lot.

Viewing 14 replies - 1 through 14 (of 14 total)
  • Moderator James Huff


    I haven’t working directly with the Twenty Ten templates, but I’d imagine that you’d insert the code into the Loop and Single templates, somewhere below <?php the_content(); ?>

    Most “social button” plugin insert their “buttons” automatically. You may want to consider using one of those instead.

    Moderator t-p


    Thanks MacManX for taking time to help me out.

    Following your pointer, this is what I found so far:

    1. I placed in single.php and it works great. And it does not generate any W3C validation error. BOT the buttons only show up on the comments page, nothing on the Index page.

    2. When I put them in the loop.php, they show up on the index page beutifully. HOWEVER, they also generate W3C validation error as follows: for attribute href on element a: WHITESPACE in QUERY.
    Syntax of IRI reference:
    Any URL. For example: /hello, #canvas, or Characters should be represented in NFC and spaces should be escaped as %20.

    How can I get rid of this validation error. I tried placing the buttons at different location in loop.php, no luck.

    Thanks MacManX for your time.

    Moderator James Huff


    How can I get rid of this validation error.

    It’s hard to say without actually seeing your site.

    Moderator t-p


    Thanks MacManX for your help.

    Playing with it I found out that:

    1. If the title of the post is limited to just one word then there is no error.
    2. But if the title of the post is more than one word, there is the error (white space).

    Since I am not a dev or programmer, it does not tell me much other than that there may be a bug in 3.0. Because on my personal blog site that is still using 2.9.2 has these social buttons installed manually and there is no such error generated.

    I also tried “sexybookmark” pluging on this test site (wp3.0, twentyten), I noticed that although their social buttons do not generate this error, BUT their email does generate the same error that I am getting with manual experiment.

    This also reinforces my notion that there may be a bug in 3.0 that generates these “white space” error.

    I want to thank you again for your time and patient.

    Moderator James Huff


    That’s very strange. I doubt it’s a bug with 3.0. It sounds more like it’s a problem with how your social buttons are generating the links.

    Just to test, try this plugin:

    Moderator t-p


    Thanks MacManx,

    I tried “add-to-any”, and it works fine and does not generate the same error I was getting with manual placement of buttons and “sexybookmarks” plugin.

    I was really trying to avoid these plugins – they include so many buttons; probably 99% are totally irrelevant.

    Although “sexybookmarks” let me chose the buttons I want, but it generates the same error I get using my manual placement of buttons (in loop.php). That renders the “sexybookmarks” plugin undesirable.

    is there anyway I can keep the manual placement in loop.php and not generate that “white space” error?

    here one example of the button link I am manually using (all buttons generate the same error):

    &title=<?php the_title(); ?>” target=”_blank”><img src=”http://www.Example.Com/images/gur_facebook.png” title=”Facebook!” height=”16″ width=”16″ alt=”Facebook” />

    Thanks again.

    Moderator James Huff


    I’m not sure on the specifics, but I recommend cross-referencing how the Add to Any plugin generates the links vs. how you’re currently generating the links with the manually placed buttons.

    Moderator t-p


    Hi MacManx,
    Thanks again forr the reply.

    I recommend cross-referencing how the Add to Any plugin generates the links vs. how you’re currently generating the links with the manually placed buttons

    I tried that, but, since I am new to all this, I could not ascertain as to how exactly they call the URL and the Title. So i was unable to compare with my call for the URL and Title (listed in my previous post, which works fine in 2.92).

    Any suggestion would be greatly appreciated. Thanks.

    I recognized the same problem using WordPress 3.0.1 and Twentyten 1.1

    The problem is “the_title” if you use it in links you get a invalid markup because of “WHITESPACE in QUERY”.

    I’m no coder or developer as well so I have no answer how the problem can be solved.

    We need “%20” for the whitespace, but I’ve no idea where you can add this. Maybe anyone of you have a idea for this?

    Moderator t-p


    after spending lots of time, i found out the following to work, and it does not generate W3C error as well.

    replace this:
    title=<?php the_title(); ?>”

    With this:
    title=<?php echo str_replace( ‘ ‘, ”, get_the_title()); ?>”

    hope this helps all others who want to set social buttons without plugins.

    You set me a big smile on my face. This works, but you’ve no spaces between longer articles, with this solution. If you add the following to your code, it should also work with spaces in the article.

    <?php echo str_replace( ' ', '%20', get_the_title()); ?>

    I hope I can give you a little bit back with it.



    Forum Moderator

    this might be useful as well, not just dealing with spaces in title:


    Moderator t-p


    Thanks wordmote and alchymyth.


    with both solutions:

    title=<?php echo str_replace( ‘ ‘, ”, get_the_title()); ?>”


    title=<?php echo str_replace( ‘ ‘, ‘%20’, get_the_title()); ?>”

    I get the same jubled up title.

    For example, “Hello world” appears as “Helloworld”.

    any suggestion? Thanks

    Moderator t-p


    ignore previous post.:)

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Social buttons help’ is closed to new replies.