Note that there are some explanatory texts on larger screens.

plurals
  1. POputting php function in template works but putting concatenated function in functions.php doesn't?
    text
    copied!<p>Here are two functions I'm working with (line 1 and line 33): <a href="http://pastebin.com/GWCJGS1i" rel="nofollow">http://pastebin.com/GWCJGS1i</a></p> <p>If you notice around line 123, I have included the concatenated function <code>. fb_comment_count() .</code>. For some reason, this produces an incorrect comment count. It just shows zero no matter how many comments there are.</p> <p>However, if I insert <code>&lt;?php echo fb_comment_count(); ?&gt;</code> into a page template, it works fine. Why does this happen? How can I get the correct comment count to show up with the concatenated function?</p> <p>Here is the page template:</p> <pre><code> &lt;?php get_header();?&gt; &lt;section id="content"&gt; &lt;?php if (have_posts()) : while (have_posts()) : the_post(); ?&gt; &lt;article class="post" id="post-&lt;?php the_ID(); ?&gt;"&gt; &lt;h2&gt;&lt;?php the_title(); ?&gt;&lt;/h2&gt; &lt;section class="entry"&gt; &lt;?php echo fb_comment_count(); ?&gt; &lt;p class="attachment"&gt;&lt;?php echo wp_get_attachment_image( $post-&gt;ID, 'medium' ); ?&gt;&lt;/p&gt; &lt;div class="caption"&gt; &lt;?php if ( !empty($post-&gt;post_excerpt) ) the_excerpt(); // this is the "caption" ?&gt; &lt;/div&gt; &lt;/section&gt; &lt;/article&gt; &lt;?php comments_template(); ?&gt; &lt;?php endwhile; else: ?&gt; &lt;p&gt;Sorry, no attachments matched your criteria.&lt;/p&gt; &lt;?php endif; ?&gt; &lt;/section&gt; &lt;?php get_sidebar(); ?&gt; &lt;?php get_footer(); ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload