• Resolved robbyh40

    (@robbyh40)


    Hi,

    This plug-in looks to be exactly what I need, but I am somewhat of a beginner and cannot get any of the content in my enhanced category content to show.

    I would like to show a page of sub-categories with their featured thumbnails on their parent category page, rather than the posts within the category.

    This is the site page (currently showing posts, not the desired sub-categories):

    https://www.robsportfolio.co.uk/category/my-work/

    I am using a category-my-work.php file to custom control this page.

    The code, that is not working is as follows:

    <?php get_header(); ?>
    
    <div class="content section-inner">
    
    	<div class="page-title">
    
    		<?php if ( is_day() ) : ?>
    			<p><?php _e('Date','hitchcock') ?></p>
    			<h4><?php echo get_the_date( get_option('date_format') ); ?></h4>
    		<?php elseif ( is_month() ) : ?>
    			<p><?php _e('Month','hitchcock') ?></p>
    			<h4><?php echo get_the_date('F Y'); ?></h4>
    		<?php elseif ( is_year() ) : ?>
    			<p><?php _e('Year','hitchcock') ?></p>
    			<h4><?php echo get_the_date('Y'); ?></h4>
    		<?php elseif ( is_category() ) : ?>
    			<p><?php _e('Category','hitchcock') ?></p>
    			<h4><?php echo single_cat_title( '', false ); ?></h4>
    		<?php elseif ( is_tag() ) : ?>
    			<p><?php _e('Tag','hitchcock') ?></p>
    			<h4><?php echo single_tag_title( '', false ); ?></h4>
    		<?php elseif ( is_author() ) : ?>
    			<p><?php _e('Author','hitchcock') ?></p>
    			<?php $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author)); ?>
    			<h4><?php echo $curauth->display_name; ?></h4>
    		<?php else : ?>
    			<h4><?php _e( 'Archive', 'hitchcock' ); ?></h4>
    		<?php endif; ?></h4>
    
    	</div> <!-- /page-title -->
    
    	<?php if ( have_posts() ) : ?>
    
    		<?php rewind_posts(); ?>
    
    		<div class="posts" id="posts">
    
            <?php $enhanced_category->setup_ec_data()?>
    
            <?php get_query_var("taxonomy"); ?>
    
    		<?php get_query_var("term"); ?>
    
            <?php get_cat_id(single_cat_title("", false));?>
    
    			<?php while ( have_posts() ) : the_post(); ?>
    
    				<?php get_template_part( 'content', get_post_format() ); ?>
    
    			<?php endwhile; ?>
    
                <div class="clear"></div>
    
    		</div> <!-- /posts -->
    
    		<div class="clear"></div>
    
    		<?php hitchcock_archive_navigation(); ?>
    
    	<?php endif; ?>
    
    </div> <!-- /content -->
    
    <?php get_footer(); ?>

    Are you able to help?

    Where am I going wrong?

    Thanks…….. Rob.

    https://www.ads-software.com/plugins/enhanced-category-pages/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor danaila_iulian

    (@danaila_iulian)

    Hi!

    This can be done by adding this piece of code to the content-ecp.php file in your theme.

    <ul>
    <?php
    $cat = get_query_var('cat');
    $categories=get_categories('child_of='.$cat);
    if ($categories) {
     foreach($categories as $term) {
     	global $enhanced_category;
    	if (empty($term->term_id)) {
    		$term->term_id = null;
    	}
    	$enhanced_category->setup_ec_data($term->term_id);
    	?>
    	<li>
    		<a href="<?php echo get_category_link( $term->term_id ) ?>"><?php the_post_thumbnail(); ?><?php echo $term->name; ?></a>
       	</li>
    	<?php
     }
    }
    ?>
    </ul>

    Feel free to ask any questions. Thank you!

    Thread Starter robbyh40

    (@robbyh40)

    Hi there,

    Many thanks, however it still doesn’t seem to work.

    I added a file called: content-ecp.php

    I pasted the exact code as above in your post but what happens is when I add a category within another category (sub-category) the ‘featured’ images shown are the posts within the sub categories, not the featured images of the sub categories themselves, which is what I need.

    Does this make sense?

    Thanks

    Thread Starter robbyh40

    (@robbyh40)

    Sorry,

    I meant to say this ‘viewing of sub-categories within categories page’ needs to be on the site (using usual featured image post style of theme).

    Not in the back-end of WordPress editing.

    I need a page, live on my site that shows featured images of sub-categories within a parent category.

    I cannot do this by calling my sub-categories as posts as they will not then link like a category page further.

    Thanks.

    ey robbyh40.
    did you find a solution for this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘All Enhanced category Content Not Showing’ is closed to new replies.