Alright, I solved it:
I queried the year and month of the page we’re on with:
$year = get_query_var('year');
$monthnum = get_query_var('monthnum');
And then I added date parameters to each WP_Query:
$col1 = new WP_Query(
array(
'year' => $year,
'monthnum' => $monthnum,
'posts_per_page' => 1,
'cat' => 31
)
);
This allows me to split the departments of the ‘Magazine’ archive page into different areas, rather than have them mixed in one loop.
Related Posts:
- Category archive by year with permalink support /category/YYYY
- Filtering categories in the permalink structure
- Force WordPress to Show Pages Instead of Category
- Multiple post categories – single permalink
- Categories’ hierarchy in URL
- Changing the category permalink structure
- Exclude subcategories from the url
- How to display only the parent category in the permalink
- Root level category, tag, author and archive pages to work
- Plural Category Base Slug On Category Archive Page
- How to set up Author archives with sub category URL
- WordPress subcategories return 404 in custom template
- force category base – archive pages work WITH & WITHOUT category base slug in url?
- Add “page-a” slug to category link if user visit category link from “page-a”
- One Specific Category To Permalink
- Category being displayed without base parmalink
- How to change category and year archive permalinks/rewrite rules?
- Read GET parameters in APACHE Mod Rewrite rules for WordPress categories in Posts
- Permalinks: display just one kind of wp category in the posts url
- Multiple URL’s based on category for one post
- Remove subcategory and category with some rules from permalink
- WordPress URL Rewrite for dynamic and customized URL
- Category URL Management
- Redirect Problems with Archive Page and GET variables
- Using custom structure prefix showing 404 for sub-categories
- A different permalink structure for different categories
- How to set the same base url for two different taxonomies?
- Remove “category” from permalink with add_rewrite_rule
- WordPress Category url redirects to subdomain
- hierarchical taxonomy in permalinks? using same slug
- Category archive page has two URLs even when default theme is active with no active plugins
- Remove “?category=” in the URL wordpress ajax filter work for category
- How to get category and archive title?
- Get rid of WordPress category, tag and author archives?
- Remove parent category from permalink? Basically only have the child category?
- Custom permalink structure leads to be 404 on pagination
- Posts URL structure like site.com/category/the-post-title
- How to get permalinks with category base working with sub-categories
- get_categories for custom post type with a specific custom taxonomy attached
- Add a URL prefix to permalinks of one category of posts only
- Catch 404 after changing permalink structure from /%postname%/ to /%category%/%postname%/
- How To Modify The Loop in archives.php To Have 11 Posts Per Page and CSS Styling
- Custom post types – Use post_id in permalink structure when using has_archive => true
- Meta_Query as a way how to setup CPT permalinks – is it a good thing?
- 404 Error On Category and Tags Pages
- Allow duplicate permalink slugs for posts in different categories
- Decreasing the Memory Consumption of a WordPress Site?
- How do I use the same post slug for different Categories?
- What’s the URL for a category archive?
- How to remove category from wordpress url?
- How to create a custom url for a category [closed]
- Preventing index.php?category_name=something from redirecting
- Add forward slash on categories url (serve one version of a url)
- how to use a different domain/subdomain for authors/catagories on single site?
- How to change the category in URL for posts in multiple categories?
- How to exclude uncategorized from permalink structure /%category%/%postname%/
- Sort posts by tags in category pages
- Create permalink structure for one taxonomy archive per custom post type
- Custom post types with their own permalink structure
- How to get the url to tag & category base set by the user?
- How to get the category of the post and link it to the archive (of the category)
- How to hide a specific category posts in my monthly archive?
- Optimal way to redirect home page to category archive?
- 404 error on subcategory pages
- Rewrite category wordpress
- Display posts links from a category group by year
- Category and tag with same name
- Display list of Sub-Categories and the posts they contain, within one main Category
- Rewrite category slug
- How to? Redirect /category/sci-fi/ to /category/scifi/?
- Sort category page with custom field
- How to Include the Parent and Child Category in the Permalink if the Post is Added to Both
- How to create tabled index of posts in a certain category
- Category links suddenly started giving 404 errors
- Best and Cleanest way to remove /category/ from category permalinks? [duplicate]
- Regex problem in an add_rewrite_rule
- How would you create a “weekly” archive?
- Sticky Posts Not Sticking to Top of Category Archive
- Rewrite url / permalink for default archive – yearly / monthly
- Combine Multiple Categories Into One URL Slug
- Categories and Tags returning 404 on the sidebar when using ugly permalinks
- Category Specific Archive
- Archive pagination causing 404 with permalinks structure
- How to have Multiple Archives Widgets, one archive widget per category (in a different page)?
- Permalinks – Different structures for different categories?
- custom permalinks for category archive ( custom base and no parent slug )
- Are Custom Taxonomy Templates Possible?
- “Sticky” posts for each category (archive.php)
- I want exclude the particular category in sidebar
- WooCommerce change category url and product base
- How to filter archives both by category and tag?
- Remove Archive Headline and Archive Intro Text fields on category and tag archive pages in WordPress Admin with Genesis framework
- Removing category base form links messes up the parent-child behavior
- Display only posts from referred category on date archive page
- Using widget logic I want to show only a widget on the archive page if there are no posts
- What type of page should i use? static page or category page? and what’s the difference? [closed]
- New categories are now going to 404s
- Creating archive pages for children categories
- Duplicate Category and Page URL loads Category instead of the Page
- Custom Category/Subcategory structure