0

I want to display those categories which have post year-wise. Example:

2016

     category 1 
     category 2
     category 3

(on click of category 1, post from category 1 + year 2016 will display, means filter with category name + year is applied)

     2015
     category 2

Any Help is highly appreciable. Thanxs.

0
function extend_date_archives_add_rewrite_rules($wp_rewrite) {
    $rules = array();
    $structures = array(
        $wp_rewrite->get_category_permastruct() . $wp_rewrite->get_date_permastruct(),
        $wp_rewrite->get_category_permastruct() . $wp_rewrite->get_month_permastruct(),
        $wp_rewrite->get_category_permastruct() . $wp_rewrite->get_year_permastruct(),
    );
    foreach( $structures as $s ){
        $rules += $wp_rewrite->generate_rewrite_rules($s);
    }
    $wp_rewrite->rules = $rules + $wp_rewrite->rules;
}
add_action('generate_rewrite_rules', 'extend_date_archives_add_rewrite_rules');

add this code to your functions.php check this url http://sltaylor.co.uk/blog/wordpress-category-archives-by-date/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.