Conditional tags FTW.
- is_month() : Currently viewing a monthly archive
- is_day() : Currently viewing a single day archive
- is_year() : Currently viewing a yearly archive
- is_time() : Currently viewing a time-based archive (hourly, minute, or even seconds)
So to test for each of these conditions, add something like this to your archive.php (or whatever template is being used for your archive pages):
// Check what posts were returned in order to find what date the archive is for
global $posts;
$archivedate = strtotime( $posts[0]->post_date);
if (is_day()) {
echo "Daily archive: ".date('m/d/Y', $archivedate);
} else if (is_month()) {
echo "Monthly archive: ".date('F Y', $archivedate);
} else if (is_year()) {
echo "Yearly archive: ".date('Y', $archivedate);
}
Related Posts:
- Show monthly or daily archives
- Sort results by name & asc order on Archive.php
- Default archive URL wordpress
- Increase number of posts in archive page
- How do I remove unwanted pages like archive, search, etc.?
- Custom Post Type Archives by Date and Taxonomy
- How do I place content on archive pages but not on main page?
- Custom Post Type Archives by Date with Custom Permalink
- is_archive() returns false on the archives page
- What is archive.php used for?
- Archive by Year
- Archive widget – limit number of months to 12
- How do I visit archive-post.php?
- How do I make wp_get_archives show me months where only pages were created?
- Sort custom-posts in archive.php via meta-key?
- Create a month by month archive of pages (not posts)
- How to show specific year archive into dropdown list
- Making next_posts_link(); return posts by month
- Count posts for each year
- display archive as collapsing links
- How can I get the ID for an archive page? [closed]
- if in_category on archive.php
- Arrange and separate posts
- Change behavior depending on content length
- How to get the latest posting time of archived pages in WordPress?
- Customize first page of category
- Cache previous versions of website?
- front end publishing not working on front-end page
- How to show static placeholder when less post elements in archive page?
- Display post links under month in paginated archive
- condition for only if is archive for default post type
- Show only post titles in archives?
- How to hide a post from archives
- What’s wrong with my date_query?
- How we display Archives for specific categories
- How to Create Custom Archive page
- Does only custom post type have post type archive pages?
- Modify text after post count
- Displaying Archives List
- Custom archives function
- Page is displaying blog archives
- terms_description and admin problem
- If one taxonomy contains the same term as another then display post
- Author archive doesn’t work [closed]
- How to conditionally check for author archive when is_author() fails to work because the author has no posts
- Is there a better way to do headings for (all) archives?
- Date Archive pages 404 error
- Checking if a specific date archive is being displayed
- Constructing An if Statement with is_category(); in archive.php
- next and previous year month and day for archive page
- Wrap the “show_post_count” between div
- Paginated Archives or Loop by Month
- remove 2014 from wp_get_archives
- Get posts from a top category and group by child categories
- How can I make a page for post formats (specifically quotes) in wordpress 3.5
- How to get post archives urls list without any markup?
- Only display archive subtitle on the first archive page
- Bootstrap Accordion with Dynamic content WordPress Archives Unique ID
- What do I need to style for the page after wp_get_archives?
- Secondary WP_Query being overriden in archive page
- Is there a way to multiply archive loop results sequentially?
- Add hour to archive link?
- pre_get_posts conflict with archive posts
- Custom loop in addition to default on archive page
- Show Daily Archives after specific dates
- Remove posts from two categories in Archive Page
- Show all 12 months regardless they have posts
- How to get the month argument from permalink in wordpress?
- Archive of year for some categories using the featured image
- Difference between $numpages & $max_page on archive pages
- Custom design calendar archive
- How to display dynamic additional contents on archive pages?
- Custom post archive page not opening 404 page
- How to disable date archives?
- How to show all the posts under the same Year in a page WordPress?
- Archive page no content to display
- Simplest way to archive a WordPress (and take down)?
- How to prevent archiving and search engine caching in a free WordPress blog?
- How to Completely Remove Archive Title a.k.a the_archive_title?
- Display archives based in post_format
- Show archives as a drop-down in the main navigation menu
- 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
- Display future posts in archive
- Trying to hide subcategories which have categories without posts
- Archive by Year
- Exclude a specific category link from archive / front page
- Create archives by author role
- How to create an archive section of a WordPress site
- A problem with date archives
- Create page like custom post type list in WordPress
- WP Archive & Category Pages not filtering
- List archive year – post by post
- WordPress 3.6 – archive.php doesn’t get triggered [closed]
- How to have infinite scroll consider passed parameters?
- How to display the archive for native posts
- printing taxonomy and meta fields values