[Resolved] How to Display Full User Comments in Twenty Eleven Theme
Dear WP Forum Support:
I am a new user of WP 3.4.2 (and really enjoying the power of the products). I have successfully followed the procedures to create a child theme (based off the default Twenty Eleven theme) to implement some some minor modifications,
At this point, on our site, we would like to have comments displayed in their entirety. We feel this will enhance the effectiveness of our product testimonial pages.
Here’s an example of a full working post+comment/reply on my current site… no surprises there. Note that this post is in full individual post+comment/reply display mode.
However, when I display the same post in a category-driven listing, or in the generic Twenty Eleven loop, the full display of the comment/reply section is diminished to a small, simple (and hard to see) link, per this example.
I experimented with using the dashboard settings to switch both the (1) category-driven listing and (2) the default loop listing between all three of the available templates in Twenty Eleven, and they all seem to want *not* to display full comments — only a link to the comments. I could not find any applicable control settings in the post or comment sections of the dashboard, either. This has been confirmed in a previous support thread (where I had unfortunately mis-stated the context as a twenty twelve issue rather than a twenty eleven issue).
Based on the recommendation from the previous support thread, I made a copy of
category.phpin my child theme directory and added a call to
<?php comments_template( '', true ); ?>
within its while loop as follows:
<?php /* Start the Loop */ ?> <?php while ( have_posts() ) : the_post(); ?> <?php /* Include the Post-Format-specific template for the content. * If you want to overload this in a child theme then include a file * called content-___.php (where ___ is the Post Format name) and that will be used instead. */ get_template_part( 'content', get_post_format() ); ?> <?php comments_template( '', true ); ?> <?php endwhile; ?>
After editing, uploading, and testing, the change did not work. Comments are still not showing, just the link.
I think I’ve got the basic idea, and have chased into the twenty eleven theme files a bit, but have to confess I can’t spot the code locations (and differences) between the single-post (with full comments) and category/loop posts (which display only a link to the comments).
I would have loved to see a commented out call to display comments in a loop somewhere, because I would have instantly seen that and tweaked it. But there are a *lot* of files interacting with each other in the Twenty Eleven theme directory, and I don’t have enough experience with the whole framework/hierarchy yet.
It seems to me that there are a lot of places to try to make this change, and I could really end up trying to change a lot of the php files. I’d much rather find the right spot to make the change, import that single file into my child theme directory, and make my changes (and add my comments) there. Then in the future, when I come back later on, I will see what I did, know why I did it, and know that the delta between my child theme and the base theme is as small as possible.
So — is there any way for me to get a full comment display in category listings and/or the generic loop in a child theme based on the Twenty Eleven theme?
Thanks for any help.
You should change the function twentyeleven_comment();. It is defined in functions.php from line 507 on.
Thanks for the suggestion — but it’s a little too vague to be useful to me. I’m sorry. Could you please be more specific?
I’ve looked at
twentyeleven_comment(), and it’s about 50 line of code. It looks like it’s what gets generated inside a fully functioning comment.
I can see where it’s cranking out the author and the date via calls to
sprintf(). And I *think* I see where it generates the actual comment content by the subsequent call to:
<div class="comment-content"><?php comment_text(); ?></div>
…just below that, correct?
But what I don’t understand is that this full generation of comment content already *does* occur in a single post context, and does *not* occur in a category or loop context. So
twentyeleven_comment()must be getting called in these other various contexts, correct? So I’m gonna guess it’s the calling context that makes for the difference? So the parameterization must matter? Or is it controlled by a global variable? Or a CSS directive?
So could you please be more specific? For example, if you are suggesting a direct edit to this function (after a transplant to a
functions.phpfile in my child theme directory, of course) are you then suggesting dropping in the aforementioned call to
comments_template(...)into this code? If so, where, because this code does not follow the typical loop that might contain that call.
My sincere apologies if I’m being a blockhead.
- The topic ‘[Resolved] How to Display Full User Comments in Twenty Eleven Theme’ is closed to new replies.