How to add number of comments on main page?

February 2013 WordPress Theme
GK User
Wed Apr 10, 2013 10:31 am
Number of comments are visible in posts. How to add this information to main page with articles next to the date and category link? Please see below screenshot.

comments.jpg
User avatar
Senior Boarder

GK User
Wed Apr 10, 2013 1:00 pm
Hi,

If you mean Page with default template, go to Template Options -> Pages and please enable two options:
- Display details on pages
- Display comments on pages
User avatar
Moderator

GK User
Wed Apr 10, 2013 2:17 pm
Hi, thank you for you reply. I mean the blog view of the template on main page - please see my page: http://nokiawindowsphone.pl
User avatar
Senior Boarder

GK User
Wed Apr 10, 2013 6:52 pm
Ok, In this case find Magazine/gavern/helpers/helpers.layout.fragments.php file and replace this fragment in gk_post_meta function: (around line 220)
Code: Select all
<?php if(!(is_tag() || is_archive() || is_home() || is_search())) : ?>
             <li class="author">
                <?php _e('Written by:', GKTPLNAME); ?>
                <a class="url fn n" href="<?php echo esc_url(get_author_posts_url(get_the_author_meta('ID'))); ?>" title="<?php echo esc_attr(sprintf(__('View all posts by %s', GKTPLNAME), get_the_author())); ?>" rel="author"><?php echo get_the_author(); ?></a>
             </li>

with:
Code: Select all
<?php if(!(is_tag() || is_archive() || is_search())) : ?>
             <?php if(!is_home()) : ?>
            <li class="author">
                <?php _e('Written by:', GKTPLNAME); ?>
                <a class="url fn n" href="<?php echo esc_url(get_author_posts_url(get_the_author_meta('ID'))); ?>" title="<?php echo esc_attr(sprintf(__('View all posts by %s', GKTPLNAME), get_the_author())); ?>" rel="author"><?php echo get_the_author(); ?></a>
             </li>
             <?php endif; ?>


or if you want to display also post author, replace this condition:
Code: Select all
<?php if(!(is_tag() || is_archive() || is_home() || is_search())) : ?>
with this one:
Code: Select all
<?php if(!(is_tag() || is_archive() || is_search())) : ?>
User avatar
Moderator

GK User
Thu Apr 11, 2013 9:58 am
Thank you. It is working on main page but what about categoryview, tag view and author view?

for example:
http://nokiawindowsphone.pl/kategoria/a ... ikacje/gry
http://nokiawindowsphone.pl/tag/windows-phone-8
User avatar
Senior Boarder

GK User
Thu Apr 11, 2013 10:54 am
No problem, just remove whole condition:
Code: Select all
<?php if(!(is_tag() || is_archive() || is_home() || is_search())) : ?>
,don't forget to remove also endif tag around line 236.
Code: Select all
<?php endif; ?>


If you don't want to display post author, you can start over and do only one thing: move endif tag (around l. 236)
Code: Select all
<?php endif; ?>
before this condition: (around line 225)
Code: Select all
<?php if ( comments_open() && ! post_password_required() ) : ?>
User avatar
Moderator

GK User
Fri Apr 12, 2013 9:52 am
Thank you Piotr!

Please have a look on my another issue Disqus not fully integrated with template which is connected to this one.
User avatar
Senior Boarder


cron