Limit Loop to One Category

There is no category argument for query_posts, a category ID should be passed via cat. However, if this is an additional query, please use WP_Query rather than query_posts. If this is the main query, please see pre_get_posts to alter the main query parameters. For more info please see When to use WP_query(), query_posts() and pre_get_posts.

Wp Dropdown Category Not Show Current As Title

You can use get_query_var( ) to fetch the current category: $cat = get_query_var( ‘cat’ ); You can use this $cat in the exclude parameter of wp_dropdown_categories( ) to hide the current category: $args = array( ‘show_option_none’ => __( ‘Select A Category’ ), ‘show_count’ => 1, ‘exclude’ => $cat ); wp_dropdown_categories( $args );

How can I only display links from a child category

your code may look like <?php $category = get_the_category(); foreach( $category as $cat): if($cat[0]->parent == ‘ your_parent_category_id ( Premium )’){ echo ‘<a href=”‘.get_category_link($cat[0]->term_id ).'”>’.$cat[0]->cat_name.'</a>’; break; } endforeach; ?>

Get categories related to particular category

You can use get_categories() to get all the sub-category of parent category. $args = array(‘hide_empty’=> 0, ‘child_of’=>’id_of_blog_category/id_of_portfolio_category’); $categories = get_categories($args); foreach ($categories as $key => $value) { echo ‘<li class=”‘.$value->slug.'”><a href=”#” rel=”‘.$value->slug.'”>’.$value->name.'</a></li>’; }

Get posts in a subcategory of a chosen parent

You should use get_posts or (even better) custom WP_Query to query posts. You can use get_pages to do this, but get_pages can’t use category (or other taxonomies – just check it in WP sources) to filter results. So your function should look like this: function getPostsInCategory($category) { return get_posts(array( ‘post_status’ => ‘publish’, ‘category’ => $category, … Read more

Query from multiple category (and)

Have you looked up the WP Codex on WP_Query for categories? They provide an example here. Also your category variable should probably only have one $. The way you’ve written your custom query also looks wrong, are you using WP_Query? $query = new WP_Query( array( ‘category__and’ => array( 2, 6 ) ) );

Exclude categories from list (wp_list_categories)

This… <?php wp_list_categories(‘exclude=4,7&title_li=’); ?> … does not include your Walker. Why didn’t you just add that exclude the same way you added the others? $args = array(); $args[‘show_last_updated’] = true; $args[‘show_count’] = true; $args[‘title_li’] = ”; $args[‘exclude’] = ‘4,7’; $args[‘walker’] = new CategoryThumbnail_Walker; wp_list_categories($args);

Listing Post Categories on Home Page

I would say you have to run queries by category name or category ID, use WP_Query: $query = new WP_Query( ‘cat=cat_ID’, ‘posts_per_page’ => 4 ); Maybe get_posts() is more appropriate in this context (array of posts) EDIT: in your edit use get_the_post_thumbnail( $post->ID, ‘thumbnail’)instead, small is not a default size EDIT2: it is better to … Read more