I'm looking to update my category template to display subcategory posts differently than category posts. I'm fairly new to Wordpress template editing but know HTML/CSS well, and PHP enough to understand it.
Currently, my theme is displaying all category & subcategory posts with titles, thumbnails, and excerpts with a button. But, I do not want subcategory posts to display like this from the main category page. I'd like to instead display categories as: subcategory title, subcategory description, button --> all of which links to the subcategory page. Then, when viewing the subcategories at their own level, my theme has a separate template that will kick in.
I'm working from a child of the AccessPress Lite theme. I've duplicated their existing archive.php and renamed it to category.php. I've also duplicated the loop that was being used to display the content, but am now struggling to figure out the logic behind determining if it's a category/subcategory.
My loop is currently:
<?php while ( have_posts() ) : the_post(); ?>
<?php
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<h1 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
<?php if ( 'post' == get_post_type() ) : ?>
<div class="entry-meta">
<?php accesspresslite_posted_on(); ?>
</div><!-- .entry-meta -->
<?php endif; ?>
</header><!-- .entry-header -->
<?php if ( is_search() ) : // Only display Excerpts for Search ?>
<div class="entry-summary">
<?php the_excerpt(); ?>
</div><!-- .entry-summary -->
<?php else : ?>
<div class="entry-content">
<?php if(has_post_thumbnail()){?>
<div class="entry-thumbnail">
<?php the_post_thumbnail('thumbnail'); ?>
</div>
<?php } ?>
<div class="short-content">
<?php echo accesspresslite_excerpt( get_the_content() , 500 ) ?>
</div>
<a href="<?php the_permalink(); ?>" class="bttn"><?php _e('More','accesspresslite')?></a>
<?php
wp_link_pages( array(
'before' => '<div class="page-links">' . __( 'Pages:', 'accesspresslite' ),
'after' => '</div>',
) );
?>
</div><!-- .entry-content -->
<?php endif; ?>
</article><!-- #post-## -->
<?php endif; ?>
?>