Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to get comments_popup_link(); to work in my theme, but it isn't. I honestly see no reason why it shouldn't. The relevant part of my code:

<div class="row">
    <div class="span7 offset1 article-container-fix">
        <div class="articles">

        <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
        <article class="clearfix">
            <figure class="article-preview-image"><a href="#"><img src="http://lorempixel.com/210/210" alt="preview-image" /></a></figure>

            <header>
                <h2><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>

                <p class="article-meta">
                    <span>&raquo; <?php echo get_the_date(); ?></span> &#9829;
                    <span><?php the_category(", "); ?></span>
                    <?php if ( comments_open() && !post_password_required() ) :
                              echo "&#9829; <span>";
                              comments_popup_link("0 Comments", "1 Comment", "% Comments"); 
                              echo "</span>";
                          endif;
                    ?>
                </p>
            </header>

            <p>Godard DIY ea chillwave synth fingerstache, mixtape high life gastropub fugiat  ex chambray brooklyn flexitarian.  Mcsweeney's blue bottle tofu, hella bespoke cardigan trust fund.  Farm-to-table intelligentsia non  accusamus pickled ugh meggings kale chips echo park. <span class="readmore"><a href="">&raquo; read more</a></span></p>

        </article>

        <hr class="fancy-hr" />

        <?php endwhile; else : ?>
        <h2>No posts yet!</h2>
        <?php endif; ?>

I've checked my database as well as the Wordpress backend. Comments exist and are linked to posts. (I'm using the Theme Unit Test). The comments link doesn't show up at all though, not even the span shows up in my page source. I've got nothing in my CSS that could cause the entire span to not be printed at all. Any clue what could be wrong here? All of the other functions I use work just fine, returning what they should.

share|improve this question
    
I just made a new post, added some comments in the backend, and that one is working. Seems something went wrong importing the Theme Unit Test data. Doesn't explain why "0 Comments" doesn't show on the Theme Unit Test posts though. –  Nick Rutten Apr 30 '13 at 2:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.