There is no logical explanation why if( is_post_type_archive('news) && is_date())
should fail and not work in your situation.
-
is_date()
return true on all date archives -
is_post_type_archive( 'news' )
will return true on post type archives
When you visit localhost/2016/02/?post_type=news
, both of those ring true, and they will only ring true on that specific URL
If it it fails, you have something breaking your main query, maybe a bad pre_get_posts
action or you are using query_posts
somewhere on the page which will break the main query object. You should do var_dump( $wp_query )
and inspect the main query object. Specially look at $query
property
Related Posts:
- Custom Post Type Archives by Year & Month?
- Custom archives function
- WordPress Posts By Date/Day?
- Preventing 404 error on empty date archive
- Output yearly archive within a page
- 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 to have Multiple Archives Widgets, one archive widget per category (in a different page)?
- 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?
- How we display Archives for specific categories
- get the custom post type title/name
- Displaying Archives List
- wp_get_archives() display months even if there is no posts
- Custom post type archive page thinks I’m not logged in
- Wrap the “show_post_count” between div
- Get current title of archive.php
- Get archives as array
- remove 2014 from wp_get_archives
- Get posts from a top category and group by child categories
- How to get post archives urls list without any markup?
- What do I need to style for the page after wp_get_archives?
- I created a normal page, but the page displays as an archive page
- How to get the Custom Post Type Archive inside a folder
- Combining custom taxonomy posts with default posts on one archive page
- Custom archive pages without “the loop”
- Show all 12 months regardless they have posts
- How to get type of archive whether it is post or date or category archive?
- Custom post archive page not opening 404 page
- How to disable date archives?
- Change Title Based on Taxonomy Filter in archive-{cpt}.php
- Want to display my custom date archive to date.php but dont know how
- date.php shows only three posts’ title. how to fix it?
- How to hide the year in archive link
- Is each issue of a magazine site a static page
- WordPress 3.6 – archive.php doesn’t get triggered [closed]
- Sort results by name & asc order on Archive.php
- Default archive URL wordpress
- Get custom post type slug for an archive page
- Increase number of posts in archive page
- How do I remove unwanted pages like archive, search, etc.?
- Get list of years when posts have been published
- How can I lock down an old wordpress install I don’t intend to update?
- Archive list with only years and months
- Meta_Query as a way how to setup CPT permalinks – is it a good thing?
- How do I place content on archive pages but not on main page?
- Proper way of making custom post type landing page or archive page
- Custom Post Type Archives by Date with Custom Permalink
- How can I get the Month Name from Archive?
- is_archive() returns false on the archives page
- What is archive.php used for?
- Archive by Year
- Change title in head on Archive page
- Custom Post Type Archives with 0 Posts Redirects as 404
- Page is defaulting to archive page and not designated template
- Archive widget – limit number of months to 12
- How do I visit archive-post.php?
- Date archives for custom post type
- How do I make wp_get_archives show me months where only pages were created?
- Better to use a post type archive, page template, or shortcode for generating a highly configurable CPT archive?
- Display all custom post types in archives.php
- Sort custom-posts in archive.php via meta-key?
- Including post_type = ‘wiki’ in author archives
- Archive listing of posts by publish year (multiple years)
- How would you create a “weekly” archive?
- paginate function in archive for custom-post-type
- Create a month by month archive of pages (not posts)
- How to show specific year archive into dropdown list
- Custom post type archive sorted and grouped by date in post meta field
- How to make a custom Archive Page
- Count posts for each year
- display archive as collapsing links
- How can I get the ID for an archive page? [closed]
- “Sticky” posts for each category (archive.php)
- How to create archive page for taxonomy terms within custom post type
- if in_category on archive.php
- How to make an archive page displaying posts in a date range
- How to limit wp_get_archives to show months for the X years only
- Archive in sidebar with dropdown list of Year – Month – Day
- Arrange and separate posts
- How can I organize/create an archive listing by Year and month
- Change behavior depending on content length
- Customize first page of category
- How to edit archive page’s content inside wordpress dashboard?
- Display only posts from referred category on date archive page
- Cache previous versions of website?
- Archive pages for posts based on their taxonomy?
- front end publishing not working on front-end page
- WordPress custom post type archive with description
- Custom-post-type-archive: posts sorted/filtered by year?
- How to show static placeholder when less post elements in archive page?
- How to list custom post types?
- Custom post type archive page pagination
- How can I get archives for specific category without category_base in the url?
- condition for only if is archive for default post type
- Editable content on a Custom Archive page
- Show only post titles in archives?
- Second Custom Post Type Archive