Wordpress Filter Categories -
how sub categories id ? catrgories , subcatrgories like
2013 april 10 april 9 april 8 march 10 march 9 2012 june 10 may 6 may 5 cast group party
how subcategory id's of month? need pagination show page links site.com/catrgory/catrgory-slug/issue/{year}/{month}/{day}. need show pagination links subcategory pages. list post of particular subcategory.
i using rewrite url
add_action('generate_rewrite_rules', 'past_issue_rewrite_rules'); function past_issue_rewrite_rules( $wp_rewrite ) { // handles paged/pagination requests $new_rules = array('category/catrgory-slug/issue/(.+)/(.+)/(.+)/' => '?year='.$wp_rewrite->preg_index(1).'&month='.$wp_rewrite->preg_index(2).'&day='.$wp_rewrite->preg_index(3)); // add new rewrite rule top of global rules array $wp_rewrite->rules = $new_rules + $wp_rewrite->rules; }
i tired , working
$root_categories = get_categories( array('parent' => 0,'hide_empty ' => 1, 'order' => 'desc')); $categories = array(); if(empty($root_categories)){ return $categories;} foreach($root_categories $category){ if(preg_match('/\d{4}$/',$category->name, $matches)) { $subcategories = get_categories('child_of='.$category->cat_id.'&hide_empty=1&order=desc'); if(!empty($subcategories)) { foreach($subcategories $subcatgory) { } } } }
Comments
Post a Comment