Currently the search results are all shown in the same way, no matter if it’s a post or a static page.
As I don’t want the comment count and the categories to show up for static pages, I was wondering how to do it.
The code: (Update October 22nd)
<?php
if(get_post_type() == 'page') : ?>
<div class="recent_postMetaSingle">
<img src="<?php bloginfo('template_directory'); ?>/images/eye.png" alt="Views" title="views" /> <?php print_page_views(get_the_ID('')); ?>
<p>This is a static page!</p></div>
<?php endif; ?>
<div class="recent_postMetaSingle">
<img src="<?php bloginfo('template_directory'); ?>/images/eye.png" alt="Views" title="views" /> <?php print_page_views(get_the_ID('')); ?> <img src="<?php bloginfo('template_directory'); ?>/images/comments2.png" alt="Comments" title="comments" /> <?php comments_popup_link('0', '10', '%'); ?>
</div>
<div class="recent_category"><?php the_category(' // ') ?></div>
Thanks for your help so far. I updated the code.
Now, it only shows up on static pages, but the HTML markup below the conditional tag also shows up and I want that to only show up for posts.
I guess I have to put an “else” tag somewhere? I just don’t know how to implement it correctly.
Thanks a lot in advance!
2 comments