Articles of wp get archives

Multiple filters for wp_get_archive

I need to display custom posts archives on a page in the following format: Monthly – Grouped by Month for the Current Year. Annually – Grouped by Year & Month for all previous years So I have got two functions to do so, which supposed to be called in a row: function show_monthly_archive( $post_type ) […]

wp_get_archives() – Get CSS selector for current month

I’m looking for how to get a class in the wp_get_archives functions to get the current month (when we are in a month archive) just like when we call wp_list_categories, the current category has a “.current-cat” selector for CSS or when we call wp_list_pages we have a ‘.current_page_item’ selector.

Date archives for custom post type

I have seen many questions/posts regarding this, but have yet to find a decent solution. Basically I am trying to do what wp_get_archives does, but for a custom post type (personally I am unsure why wp_get_archives doesn’t support custom post types!). The code I am currently using is as follows functions.php function Cpt_getarchives_where_filter( $where , […]

Extend the wp_get_archives output with '?post_type=foo'?

I’ve gotten my custom post types to display as it should in date based archives; the structure (and above) works properly as long as it’s extended with ‘?post_type=post_type_name’. With Bainternets solution I’ve also gotten wp_get_archives to properly list archives based on whether or not they contain my CPT. The problem is that wp_get_archives still […]

Display only posts from referred category on date archive page

I am using wp_get_archive() in category.php. If I am on page of category=2 it should show my archives of only that category. However it is for all the categories. Following is the code for my category.php as well as archive.php <?php get_header(); ?> <?php $args =array( ‘posts_per_page’ =>1, ); $loop = new WP_Query( $args ); […]

How to replace a javascript select box onchange event to a form submit action?

I have a small problem that probably has a very simple fix. I have been using the wp_get_archives() function to produce a dropdown select form. See the full code below: <form id=”side-arch”> <select name=”archive-dropdown” onchange=”document.location.href=this.options[this.selectedIndex].value;”> <option value=””><?php echo esc_attr( __( ‘Select Month’ ) ); ?></option> <?php wp_get_archives( array( ‘type’ => ‘monthly’, ‘format’ => ‘option’, ‘show_post_count’ […]

How to limit wp_get_archives to show months for the X years only

Can anybody show me how to set a limit on wp_get_archives to show archives by month BUT only those for the year 2010 and above – so the 2009 monthly archives are not shown on the sidebar archive widget. Thank you!

Display all custom post types in archives.php

How would I do this? archive.php only has this: wp_get_archives(‘type=monthly’); And wp_get_archives() does not have a parameter to display all post types. Also I think archive-[post_type].php is not the one I am looking for since I want all post types to be displayed in one archive page. Thanks! W

Post count per (day/month/year) since blog began

I’m looking to echo the number of posts per month since the blog began, and for months where there was no posts echo ‘0’. This is the output I want: January 1, February 3, March 8, April 3, … Any help would be great. Dave

custom post types, wp_get_archives and add_rewrite_rule

I’ve searched to see if anyone came up with a solution to a peculiar problem I’m having but did not find anything that was close to what was happening in my case. I have two custom post types – let’s call them Diary and Journal. Both have been setup correctly with has_archive to true, rewrite […]