If you do not want to use the buildin archives, your best way of achieving this is to create a Page Template containing nearly the same code as the archive.php
.
Also, add some post_meta
to your static pages, containing the Year and Month of the posts you want to show.
In your page template, set up a custom query containing the restriction for the date, with the $args
:
$args = array (
'year' => get_post_meta( get_the_ID(), 'your_year_meta', true ),
'monthnum' => get_post_meta( get_the_ID(), 'your_month_meta', true )
'offset' => $offset,
//...
);
Make the query as usual, and use the code from your archive.php
to loop through the posts.
Also make sure that, if you want your posts paginated, you calculate the custom offset right, and this should be it 🙂
Related Posts:
- How do I remove unwanted pages like archive, search, etc.?
- WordPress Posts By Date/Day?
- Preventing 404 error on empty date archive
- Archive filtering posts by year and month
- How to get the date dynamically from archive.php to date.php?
- Making next_posts_link(); return posts by month
- How can I change the way dates shown in the archive widget?
- how do I get the date in a date archive page
- What’s wrong with my date_query?
- Displaying Archives List
- How to filter by date & a specific custom post type post-WP 4.4?
- Show all 12 months regardless they have posts
- How to disable date archives?
- date.php shows only three posts’ title. how to fix it?
- How to hide the year in archive link
- Sort results by name & asc order on Archive.php
- Custom Post Type Archives by Year & Month?
- Default archive URL wordpress
- Increase number of posts in archive page
- How do I place content on archive pages but not on main page?
- Decreasing the Memory Consumption of a WordPress Site?
- How can I get posts in a subcategory to display on it’s parent categories archive page?
- Archive Listings Filtered by Date Values in a Custom Field/Post Meta?
- is_archive() returns false on the archives page
- Archive by Year
- Archive listing of posts by publish year (multiple years)
- Create a month by month archive of pages (not posts)
- pre_get_posts filter using numeric meta_query comparison (from dates)
- Count posts for each year
- How can I get the ID for an archive page? [closed]
- if in_category on archive.php
- Change behavior depending on content length
- Customize first page of category
- Cache previous versions of website?
- condition for only if is archive for default post type
- Custom Taxonomy Archive not displaying entries
- Show only post titles in archives?
- How to hide a post from archives
- Creating an Archive using a Custom Taxonomy
- Displaying year, month and day archives differently
- How we display Archives for specific categories
- Date archive permalinks for custom taxonomy
- How to display data in archive page?
- Custom post type archive page thinks I’m not logged in
- Is there a better way to do headings for (all) archives?
- Date Archive pages 404 error
- Constructing An if Statement with is_category(); in archive.php
- WP Group posts by year(desc) > month(desc) > date(asc)
- next and previous year month and day for archive page
- Get current title of archive.php
- How to show months in wordpress archive page?
- How to count the number of archives there are
- Get posts from a top category and group by child categories
- Why is my archive.php redirecting to front-page.php?
- Get users based on month ACF datepicker field
- How to get post archives urls list without any markup?
- How can I loop only months foreach year?
- Only display archive subtitle on the first archive page
- Filtering posts by archive showing all years
- Bootstrap Accordion with Dynamic content WordPress Archives Unique ID
- What do I need to style for the page after wp_get_archives?
- How to hide specific post type from archive?
- On my archives page, I can’t see my custom post types catergories
- Make tag archive display post are ordered by post format
- Add hour to archive link?
- WordPress archives in header -necessary?
- pre_get_posts conflict with archive posts
- Any kind of custom post type in the front page and in the archive listing
- Why does my URL keep returning 404 error code?
- How to get the month argument from permalink in wordpress?
- Display an archives name
- Archive of year for some categories using the featured image
- Custom design calendar archive
- How to display dynamic additional contents on archive pages?
- How to show all the posts under the same Year in a page WordPress?
- How to share the author’s archive?
- How can I show a list of posts using the dynamic selection box?
- My page is shown as archive in my site
- How can I noindex my archive pages?
- Redirect to custom post if custom archive page has just one result?
- How to prevent archiving and search engine caching in a free WordPress blog?
- Change Title Based on Taxonomy Filter in archive-{cpt}.php
- What’s wrong with default posts archive?
- How do I add a count to each month in this archive code?
- Parent and child relation code and display only first child list
- Get all posts from db between 2 specified months
- Display Day names with wp_get_archives instead of date
- Archive – Show Video from First Post
- Missing content on author archive page
- Trying to hide subcategories which have categories without posts
- Show recent posts in single-post page
- Display metabox with date
- WordPress archives by custom field and date
- Generate daily archive whenever any post type is added
- How to create an archive section of a WordPress site
- wordpress showing all posts instead of date range
- Load new Posts on Scroll on Page
- Create page like custom post type list in WordPress
- WP Archive & Category Pages not filtering
- List archive year – post by post