Exporting just posts of a specific category
The default exporter will do this. Instead of selecting “All Content”, choose “Post” and then a category.
The default exporter will do this. Instead of selecting “All Content”, choose “Post” and then a category.
It sounds like you’re looking for the get_terms() function that’s a wrapper for WP_Term_Query. There you can e.g. use the name__like, description__like or search parameters. Example: Here’s what kind of WHERE query they generate: ‘name__like’ => ‘hout’ >>> (t.name LIKE ‘%hout%’) ‘description__like’ => ‘hout’ >>> tt.description LIKE ‘%hout%’ ‘search’ => ‘hout’ >>> (t.name LIKE ‘%hout%’) … Read more
I found how to make this: <?php $taxonomy = ‘product_cat’; $orderby = ‘name’; $show_count = 0; // 1 for yes, 0 for no $pad_counts = 0; // 1 for yes, 0 for no $hierarchical = 1; // 1 for yes, 0 for no $title=””; $empty = 0; $args = array( ‘taxonomy’ => $taxonomy, ‘orderby’ => … Read more
If you go to Settings->Permalinks you should be able to set the tag/category base URL rules which should solve this problem. Or, use some sort of plugin to do what you want. This one came up first on Google: http://wordpress.org/plugins/custom-permalinks/
The original author isn’t quite right in saying “which is merely the more elegant way to write”. set_query_var() will always override the main query, whereas if you actually use: $wp_query->set( ‘category__not_in’, $excluded ); … it will work for any instance of query_posts(), such as the recent posts widget.
Check out my answer on how to get terms that are associated with others through the posts that they’re attached to. In your case, you could put it into practice like so; $category_IDs = get_terms_soft_associated( ‘category’, array( ‘taxonomy’ => ‘post_tag’, ‘field’ => ‘slug’, ‘terms’ => ‘audio’ ) ); wp_list_categories( array( ‘include’ => $category_IDs ) ); … Read more
By default, sticky posts only stick to the top of the first page of the main blog posts index. The easiest way to show sticky posts in other contexts is probably via a custom loop, e.g.: $sticky_posts = new WP_Query( array( ‘post__in’ => get_option( ‘sticky_posts’ ) ) ); if ( $sticky_posts->have_posts() ) : while ( … Read more
Ok, try this. It should capture the current category object and then go up the chain until it finds the current categories top-most ancestor. // get the category object for the current category $thisCat = get_category( get_query_var( ‘cat’ ) ); // if not top-level, track it up the chain to find its ancestor while ( … Read more
If you want to list only child categories of the current category, set the child_of argument to the current category ID. wp_list_categories( array( ‘child_of’ => get_queried_object_id(), // this will be ID of current category in a category archive ‘style’ => ‘none’, ‘title_li’ => ” ) ); EDIT- To list only child categories per-post of the … Read more
Add the ‘post_type’ parameter in your query args (‘post_type’ => ‘game’): <?php if (is_page() ) { $category = get_post_meta($posts[0]->ID, ‘category’, true); } if ($category) { $cat = get_cat_ID($category); $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $post_per_page = 4; // -1 shows all posts $do_not_show_stickies = 1; // 0 to show stickies $args=array( ‘post_type’ => ‘game’, … Read more