WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Help with Digg (3 posts)

  1. jaledwith
    Member
    Posted 7 years ago #

    Hey friends,

    First of all, I am NOT using a plugin. I'm currently messing around with the javascript provided by Digg on their website. You can find it here: http://www.digg.com/tools/integrate

    My problem is that I cannot make use of digg_bodytext the way I want to. Whenever I specify anything other than plain text for that field (i.e. a call to the_content or the_excerpt) the whole thing breaks (the button is no longer compact, the link no longer goes to the page I specify, the title is blank).

    Anyone have any advice for how to get digg_bodytext to play nice with digg_url, digg_title and digg_skin?

    Andrew

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Do you have an example we can see? A link to a page where you're attempting to use this code?

    Edit: After playing with it myself, I found that this works pretty well:

    <?php $bodytext = str_replace(chr(13),'',get_the_excerpt());
    $bodytext = str_replace(chr(10),'',$bodytext);?>
    digg_bodytext='<?php echo $bodytext; ?>';

    Javascript doesn't like line breaks in string literals. This code removes any line breaks from the_excerpt and uses that.

  3. jaledwith
    Member
    Posted 7 years ago #

    Stellar! That worked perfectly. Thanks Otto, you've been a big help.

    Andrew
    http://jaledwith.com

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags