I am creating a magazine style wordpress site. We have multiple issues which will be parent categories and these will have around 3-5 sub categories. Every quarter we will create a new issue with new subcategories.
E.g.
Issue 7 ->
news
journal
worldview
letters
etc…
I have a page which lists all of the parent categories and their associated magazine style cover images but I need these to link to a page which lists out that parent categories’ sub categories.
my code for the magazine parent categories is below if
<?php foreach (get_categories('exclude=9') as $cat) : ?>
<?php if ($cat->parent > 0) continue; ?>
<div id="magazine">
<a href="<?php echo get_category_link($cat->term_id); ?>" id="link"><?php echo $cat->cat_name; ?></a>
<img src="<?php echo z_taxonomy_image_url($cat->term_id); ?>" />
</div>
<?php endforeach; ?>
</div>
<?php endwhile; // end of the loop. ?>
does anyone know how to make the parent category link to a page where their sub categories are listed? any help would be massively appreciated!
I think the simplest way would be to just use the category archives that WordPress already generates. Change the category base in permalink settings to
issues
so you have nice URLs, then in the category template, check if you’re viewing a top level or child category, and display the appropriate markup: