display category list year wise in wordpress

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/

WP 4.7 in_category change?

I’ve found the issue. I’ve been running a filter on list_terms_exclusions specifically to remove all children of “Uncategorized” from appearing on the public website. add_filter(‘list_terms_exclusions’, ‘my_list_terms_exclusions’,10,2); However, using in_category() still returned matches on those categories, which was exactly what I wanted. I needed to hide those categories from appearing in category listings, but I still … Read more

show WordPress categories with different Structure

Here’s a link to a gist of mine, you could simply replace the ul li with divs as you need. Calling the function getCatTree will result in an output of all categories with the according sub children inside an ul/li construct. Now you just need to tailor your css/js to match the look and feel … Read more

Simple way to style posts of a single category differently in the loop and in single

I’m not sure I understand the question, since the answer seems straightforward, assuming standard templates – it’s conceivable that your theme does not provide the kinds of classes you are asking for, but IMO would be odd. It is standard practice for theme writers to include the function body_class() which adds different classes to the … Read more

Notice: Undefined variable: category_id

Seems to me that you want to get the ID of your current category. You need to first get the category using : Method 1 $myCategory = get_the_category(); And then instead of $category_id` use this: $myCategory[0]->cat_ID; To retrieve the ID. OR: Method 2 $myCategory = get_queried_object(); to get the category and replace $category_id with: $myCategory->term_id;

Group search results by category

Add in the search parameter to your query: $search_filters = array( ‘post_type’ => ‘page’, // Doorzoekt alle post types ‘s’ => $keyword // show only posts that meet the current search query ); And above that you should just be able to grab the keyword right from your querystring like so: $keyword = $_GET[‘s’]; There’s … Read more

function query_posts disabling current_page_menu class

The issue is caused by the query_posts function, this function alters the global $wp_query which the menu walker uses to check and add classes like current_page_menu to menu items. A solution would be to write a new custom query and loop through that than using query_posts. $title_slug = strtolower(str_replace( ” “, “-” , the_title_attribute(‘echo=0’) ) … Read more