Support » Fixing WordPress » PHP help: How To Show Featured Image on Category Page

  • I’ve searched thoroughly and seen this issue covered in several ways that didn’t seem to apply to my configuration. So thanks in advance for any time and help.

    Here’s my site:

    The Home page (which is showing latest posts) shows each post’s Featured Image(post thumbnail) plus the post excerpt. I’d like to know how and where to change the PHP to make the other main menu items (Video Premiere, Music Premiere, etc — which are all Categories) show just like the Home page. As of now, only the Home page shows the Featured Images alongside the post excerpt, while all other pages only display the post title and excerpt.

    My theme is Pagelines WhiteHouse Pro v3.0.1 using WP v3.4.2. Other solutions refer to a loop.php file, which doesn’t seem to exist in my theme. Seems easy enough but I’m just not familiar with PHP.

    Thanks guys,

Viewing 9 replies - 1 through 9 (of 9 total)
  • What you should be looking for is your category.php file. This is the file that WordPress uses for any category pages. You can just edit this file to mirror the index.php file.

    And since you are on a theme that will most likely be updated (thereby erasing the edits you made) you should do this by first creating a child theme for it.

    I’m not finding a category.php file anywhere.

    Here’s the entirety of my index.php file:


    And so, would this template_posts.php file be the culprit?

    Here’s the entirety of that template_posts.php file:

    	global $pagelines_ID; 
    	if(is_page_template('page-fullwidth.php') || is_page_template('page-fullhighlight.php') || is_page_template('page-carousel-full')) $full_width_page = true;
    	else $full_width_page = false;
    	if(is_page_template('page-carousel.php') || is_page_template('page-carousel-full.php')) $carousel_page = true;
    	else $carousel_page = false;
    	if(VPRO && (is_page_template('page-feature.php') || is_page_template('page-feature-page.php') || (is_home() && pagelines('featureblog')))) $featureslide_template = true;
    	else $featureslide_template = false;
    	if(VPRO && (is_page_template('page-feature.php') || m_pagelines('featureboxes', $pagelines_ID))) $fboxes_template = true;
    	else $fboxes_template = false;
    <?php if($featureslide_template) get_template_part('pro/template_feature'); ?>
    <?php if($carousel_page) get_template_part('pro/template_carousel');?>
    <div id="contentcontainer" class="content fix">
    	<div id="contentborder">
    		<?php if(!is_page_template('page-highlight.php') && !is_404()) get_template_part('library/_sub_head');?>
    		<?php if(is_page_template('page-fullhighlight.php')) get_template_part ('pro/template_highlight'); ?>
    		<?php if($fboxes_template) get_template_part('pro/template_fboxes');?>
    			<div id="maincontent" <?php if($full_width_page):?>class="fullwidth"<?php endif;?> >
    				<?php if(is_page_template('page-highlight.php')):?>
    					<?php get_template_part('pro/template_highlight');?>
    					<?php get_template_part('library/_sub_head');?>
    					<?php the_post_thumbnail();?>
    				<?php endif;?>
    				<?php get_template_part ('library/_posts'); ?>
    			<?php if(!$full_width_page) get_sidebar();?>
    		<?php get_template_part ('library/_contentfooter'); ?>
    		<div class="clear"></div>


    Could be, but the category should default to the index.php file (your home page) if you don’t have a category page. I would contact the theme developer directly to find out how to edit category pages, there is most likely a way of doing it without breaking the code all that much.

    Thanks again. I believe Pagelines has discontinued their theme development and support in lieu of a switch to developing custom framework.

    So possibly another user here might be familiar with this code in particular and offer a quick pointer.


    Is there an archive.php?

    Hey Andrew, no, there isn’t an archive.php to be found.

    And to anyone that might review the above template_posts.php code, one small but significant correction:

    That one instance it’s showing of <?php the_post_thumbnail();?> is from my fooling around and shouldn’t be there. So consider that non-existent.


    What all is in the library directory?

    Andrew, the contents of the library folder:
    _authorinfo, _commentsform, _contentfooter, _contentsidebar, _customcss, _defaultsidebar, _flickr, _font_replacement, _footer_nav, _grandchildnav_pro, _ie_fixes, _morefoot, _pagination, _picker, _post_footer, _postnav, _posts, _searchform, _sub_head, _sub_nav, _twittermessages, dynamic_css, template_posts, widget_welcome


    Ok, This worked for me, it may work for you. This is for a single page with a single category listing, the cat=47 the 47 is the tag_ID, you can get it by opening the edit on the category you want to use. Change the template name on line 1 to whatever you want. You can see the page

    hope that helps

    <?php /* Template Name: CatTemp47 */ ?>
     * The template for displaying all pages.
     * This is the template that displays all pages by default.
     * Please note that this is the WordPress construct of pages
     * and that other 'pages' on your WordPress site will use a
     * different template.
     * @package Visual
     * @since Visual 0.1
    get_header(); ?>
    		<div id="primary" class="content-area">
    			<div id="content" class="site-content" role="main">
    while (have_posts()) : the_post();
    						/* 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 endwhile; ?>
    			</div><!-- #content .site-content -->
    		</div><!-- #primary .content-area -->
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘PHP help: How To Show Featured Image on Category Page’ is closed to new replies.