WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] PHP post_comments_feed_link Won't stay inside enclosing HTML (3 posts)

  1. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    // ADD COMMENT RSS SUBSCRIBE BUTTON
    add_action('comment_form', 'comment_rss_subscribe_thing');
    
    function comment_rss_subscribe_thing() {
    	echo '<div class="comment-rss">' . post_comments_feed_link(__("Subscribe to Comments", "voodoo_lion")) . '</div>';
    }

    I have the above code in my functions.php to append the comments rss link at the bottom of my comments form. However....

    <a href='http://www.rvoodoo.com/2010/09/local-selection-dj-odawa-3/feed/'>Subscribe to Comments</a>
    <div class="comment-rss"></div>

    Is my output. I'm trying to have the link inseide the HTML, not in front of it. What could be wrong with my code?

  2. Mark / t31os
    Moderator
    Posted 3 years ago #

    post_comments_feed_link echoes data, so you could either replace that with get_post_comments_feed_link, or use the following..

    function comment_rss_subscribe_thing() {
        ?>
        <div class="comment-rss">
            <?php post_comments_feed_link(__("Subscribe to Comments", "voodoo_lion")); ?>
        </div>
        <?php
    }

    :)

  3. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    Ah hah! That's what I was trying to figure out. Breaking up the php and html, seems obvious I'm sure, but I wasn't quite getting it right!

    Now I'm, sorted, and thank you!

Topic Closed

This topic has been closed to new replies.

About this Topic