Multiple Category Search

I found the solution… My functions page now looks like: <?php class dropdown extends Walker_CategoryDropdown { function start_el(&$output, $category, $depth, $args) { $pad = str_repeat(‘&nbsp;’, $depth * 3); $cat_name = apply_filters( ‘list_cats’, $category->name, $category ); $output .= “\t<option class=\”level-$depth\” value=\””.$category->slug.”\””; $output .= ‘>’; $output .= $pad.$cat_name; if ( $args[‘show_count’] ) $output .= ‘&nbsp;&nbsp;(‘. $category->count .’)’; … Read more

How to Filter categories in the permalink structure

strangely familiar to this, but it is different, so here’s a modified version add_filter( ‘post_link’, ‘remove_parent_cats_from_link’, 10, 3 ); function remove_parent_cats_from_link( $permalink, $post, $leavename ){ $cats = get_the_category( $post->ID ); if ( $cats ) { // Make sure we use the same start cat as the permalink generator // what happens now actually is the … Read more

WP_Query() returns null when results exist!

The is_single function (used in your excerpt.php file) returns true only when the main query contains one single post. Since you’re calling get_template_part from an archives page, your query contains more than one post, so is_single returns false and your excerpt.php file bails. Remove the check for is_single and you should be good to go. … Read more

How do I get the category slug from wp_dropdown_categories

There is an argument walker for wp_dropdown_categories(). It accepts an instance of a custom walker, a class extending Walker_CategoryDropdown or the generic Walker. Let’s create such a class. We have to change just one method. class WPSE_Cat_Slug_Walker extends Walker_Category { function start_el( &$output, $category, $depth, $args, $id = 0 ) { $pad = str_repeat(‘&nbsp;’, $depth … Read more

multiple categories and breadcrumbs problem

To answer your question, it doesn’t matter from where you’re going to player1. HTTP being a stateless protocol, doesn’t care if you’re going from announcements or teams or even if by typing directly to the address bar. So what you’re asking is not possible without some kind of coding Now when we have the same … Read more

Arrange posts by date in front page

Add orderby and order to your arguments: $cat_query = new WP_Query( array( ‘post__not_in’ => get_option( ‘sticky_posts’ ), ‘category__in’ => array($cat->term_id), ‘posts_per_page’ => 5, ‘paged’ => $paged, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’ ) ); Update it seems it still takes one category, lists 5 posts and then goes to another, with 5 posts etc. It … Read more

Problem with wp_create_category

This function is declared in wp-admin/includes/taxonomy.php. This file will be loaded in wp-admin/includes/admin.php. And that now is called in wp-admin/admin.php. So the solution is: Use the hook ‘admin_init’ or require all necessary files manually. But don’t do that on every request.