Part of the website I'm working on is meant to function like a monthly magazine, with a few different departments. So I have 'Magazine' set as the parent category, and say 'Art' and 'Music' as child categories (which may have further subcategories).
I'm trying to set up a permalink structure so that, for example,
will show a page that contains all the posts from 'Magazine' and its subcategories for December, 2014.
THE CURRENT STATE
Currently, my permalink structure is set to:
Going to the URL above effectively results in visiting
http://mysite.com/magazine/—the posts are from multiple months.
http://mysite.com/art/2014/12 works, in that I see all 'Art' posts for the specified month.
Do I need a complex rewrite, or am going about this the wrong way? I came across this, which is basically the opposite of what I want to do: Remove parent category from permalink? Basically only have the child category?.
Any insights would be greatly appreciated.
I decided to temporarily remove my custom category template
category-magazine.php and the magazine archive works correctly. So something with my template is breaking it. It's split into three loops (one for each department). Is that causing the problem perhaps???
So here is what I have in my multi-loop category-magazine archive:
<?php // 1st Query $col1 = new WP_Query( array( 'posts_per_page' => 1, 'cat' => 31 ) ); ?> <?php if ( $col1->have_posts() ) : ?> <div class="post-list group col-1"> <?php while ( $col1->have_posts() ): $col1->the_post(); ?> <?php get_template_part('content'); ?> <?php endwhile; wp_reset_postdata(); ?> </div><!--/.post-list--> <?php endif; ?> <?php /* The 2nd Query */ $col2 = new WP_Query( array( 'posts_per_page' => 1, 'cat' => 28 ) ); ?> <?php if ( $col2->have_posts() ) : ?> <div class="post-list group col-2"> <?php while ( $col2->have_posts() ): $col2->the_post(); $col2->next_post(); ?> <?php echo get_template_part('content'); ?> <?php endwhile; wp_reset_postdata(); ?> </div><!--/.post-list--> <?php endif; ?> `
This works fine when visiting the magazine category page, but it doesn't work for archive pages.