WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] PHP post_comments_feed_link Won't stay inside enclosing HTML

[Resolved] PHP post_comments_feed_link Won't stay inside enclosing HTML

  • // 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?

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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
    }

    🙂

    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!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] PHP post_comments_feed_link Won't stay inside enclosing HTML’ is closed to new replies.
Skip to toolbar