2
votes
1answer
82 views

How can I reduce the number of database query calls for this custom homepage?

I am working on the design of a blog with the below(just a sample) category hierarchy. PARENT | ...
0
votes
3answers
50 views

How to select posts from one category but exclude posts in another category?

I am trying to select posts that have category id 4 but exclude posts that also have category id 2 Here's what i'm trying $query = new WP_Query(array( "cat__in" => array(4), ...
2
votes
1answer
46 views

CPT posts listed by category with custom rewrite URL, please help!

Here is what I'm trying to do: I have 10 total dessert recipes (in shared dessert category) that are divided by 2 custom post types. I want to create 3 different views of these posts with the custom ...
0
votes
1answer
40 views

Display posts of specific category term

I'm using this code to first display each category term as headlines and then display a post which is assigned each category term under the headline. If I create a custom taxonomy it works as ...
0
votes
2answers
39 views

How to retrieve posts from parent category, splitting them per children when displayed?

I have a Wordpress database with three categories: ID 3 : Europe ID 4 : France (child of 3) ID 5 : Paris (child of 4) I now need to display all posts under their respective category, like this: ...
0
votes
0answers
11 views

WP_Query using OR arguments e.g. posts in Category OR has Tag [duplicate]

I'm wondering if it's possible to use WP_Query() to filter posts by multiple OR arguments. I'd like to retrieve all posts that are in a category OR have a tag. If this is not possible using ...
0
votes
1answer
96 views

I need to exclude from a query a category and a few custom taxonomies

I need to exclude from a query a category and a few custom taxonomies. Is this code right? This query don't exclude any post, the one with the category, or the custom taxonomy. What am I doing wrong? ...
0
votes
0answers
34 views

trying to get paginate_links to work but the query before is not working with multiple categories

I am trying to make this paginate_links work. The thing is I cant use category__and in my query. If I write 'cat' => array(3, 4, 24), It works but I get a message saying it needs a string, not an ...
-1
votes
1answer
62 views

List posts related to category on a div [closed]

i want to display posts related to selected category at the same page(on a different div). What i want is as the image attached, when i click the category name on the left side, all related posts must ...
0
votes
0answers
87 views

Only show top level posts of specific category

I've been trying to create a loop that will only show the top level posts no children/sub category posts. Basically what my categories look like are -- -All --one --- A --- B -- ...
0
votes
1answer
42 views

Query seems to be duplicated

I'm just hit a development brick wall and can't seem to find a solution to this problem. I've running two WP_Query's the aim is one displays premium stockists and the other one displays the none ...
0
votes
0answers
36 views

Querying Multiple Categories With Different Offsets

On my website I have a "Breaking News" section which shows the most recent 4 stories in the "Breaking News" Category. Under this I have a featured news section which displays 5 more stories from the ...
1
vote
0answers
179 views

How to get latest posts from each category in regular order

let's say I have a main query and it displays posts from Movies and Music categories. I want the query to show always 5 latest posts from Movies and 5 latest posts from Music category. When I create a ...
0
votes
1answer
112 views

Show multiple categories in query using redux framework variable

Stuck on trying call an option variable using the Redux Framework - that is utilizing multi-category select - inside the query. Here's what I have as my query: $the_query = new WP_Query(array( ...
1
vote
2answers
241 views

Display Posts of a Category in Alphabetical Order (Custom Post Type)

I have a custom post type called "link" I have a custom taxonomy for this post type called "link-category" I have a template file for this taxonomy, "taxonomy-link-category.php" I need the template ...
0
votes
1answer
91 views

Show custom post type filtered by category

I would like to have a custom post type which contain several sliders for showing in each category page (exact category.php), one for each as planned. All sliders were assigned to related category. ...
-1
votes
1answer
514 views

How to query posts from specific authors and categories using WP_query?

I currently have a WP_query where I am getting posts from a specific set of authors. To this, I want to add specific categories as well. $args = array( 'author__in' => $authors, 'posts_per_page' ...
0
votes
1answer
127 views

Wordpress Numeric Pagination with Query String [duplicate]

So I have a dynamic loop which is affected by a query sting in the URL.. For example I have 3 categories and when they click the category it just adds a query to the URL: <a ...
0
votes
1answer
67 views

Are term_taxonomy_id and term_id the same?

I have a custom query where I need a JOIN because I want to COUNT all the posts of a specific category. So I checked the tables and I found out that table wp_term_relationships contains a reference ...
0
votes
3answers
785 views

How to get posts from two categories with WP_Query?

I'm using WP_Query to create 'latest posts' & 'popular posts' sections on my home page. I'm trying to just pull 5 posts from 2 categories (9 & 11) but it will only show posts from cat 9. ...
0
votes
2answers
85 views

WP_Query of Category Not Showing First Post

I have the following loop, and only this loop, in my home.php file (apologies if I didn't paste the code properly). I have populated lorem ipsum posts, and noticed that of the five posts only four ...
0
votes
1answer
107 views

Custom WP_Query for current category (in category.php)?

I'm using a small code to display a tag list for the current categories like below: <?php $custom_query = new WP_Query('posts_per_page=-1&category_name=overnachten'); if ...
0
votes
1answer
71 views

Return category posts with WP_Query

I have a some categories and want to get the posts with those categories: $temp = $wp_query; // assign ordinal query to temp variable for later use $wp_query = null; $wp_query = new ...
0
votes
2answers
63 views

How to properly use Categories with Custom Post Types

I'm really struggling with this... I created a few Custom Post Types, let's say... Books CD's Maps Now I also have a whole bunch of existing categories and some of these would apply to more than ...
0
votes
0answers
87 views

Get sub categories and posts with the same parent category

I want to fetch all posts in category 1, then fetch all sub-categories in category 1, then merge the results into one array. Is that possible?
0
votes
1answer
107 views

Order posts by separate menu order for different sub-categories

My scenario is as follows: Categories: 1. Category A - Sub-Category A1 - Sub-Category A2 - Sub-Category A3 2. Category B - Sub-Category B1 3. Category C 4. Category D The ...
0
votes
0answers
160 views

Display newest posts from multiple categories ordered by date

I have the categories listed below in my post post type. Category Name: Test 1 ID: 1 Category Name: Test 2 ID: 2 Category Name: Test 3 ID: 3 Category Name: Test 4 ID: 4 I'd like to retrieve for ...
0
votes
1answer
85 views

Retrieve latest post by multiple categories with ID

I have the categories listed below in my product post type. Category Name: Test 1 ID: 82 Category Name: Test 2 ID: 83 Category Name: Test 3 ID: 84 Category Name: Test 4 ID: 85 Now I want to ...
0
votes
0answers
206 views

category_name not working in WP_Query

I have a custom post type and I wanted to show posts just from a certain category but its not working. Here is the code: <?php // Reset post data. wp_reset_postdata(); $photo_group = 0; // For ...
0
votes
1answer
317 views

Using in 'category_name' in '$query->set();'?

Here's the function I have in my theme's functions.php: function better_editions( $query ) { // Categories act as 'Editions' on my site $get_edition = get_query_var( 'category_name' ); ...
0
votes
0answers
27 views

WordPress | WP_query with multiple category starting to show with a specific category

How I can show a WP_query result posts starting to show a query by a specific taxonomy and than all the others? I have thought to a UNION in the query, but I would something with the WP_query loop. ...
0
votes
2answers
121 views

Set colors depending on category

I have this function which outputs the last 6 posts of categories 1 and 2. <ul> <?php query_posts('cat=1,2&showposts=6'); ?> <?php if ( have_posts() ) while ( have_posts() ) : ...
0
votes
0answers
40 views

Custom list of categories that is sortable by count

So I am attempting to use bootstrap with wordpress. Inside my left column my design called for a large box and then 4 smaller ones below. Those boxes would hold information about a category. There ...
0
votes
1answer
154 views

Exclude most recent posts from specific category in wp_query()

I have a featured posts slider, which uses the 'featured' tag. I have a query for this which grabs the 3 most recent posts with this tag and shows them in the slider. Below this, I have a list of 10 ...
0
votes
1answer
163 views

multiple values in an array for category__and does not work with WP_Query

So I'm looping with WP_Query and here is my code: $country_posts = new WP_Query(get_direct_children($continent_cats)); if ($country_posts->have_posts()) : while ($country_posts->have_posts()) ...
0
votes
1answer
92 views

Printing direct descendants of a category with WP_Query

So I'm having trouble printing just the direct children of a category on a page. Here's my code: $category_id = get_cat_ID('destinations'); $args = array('child_of' => $category_id); ...
0
votes
2answers
86 views

Make assigning post to a specific category equivalent to assigning it to all categories

Allow me to explain with an example, for the sake of clarity. Please take the time to read it all to get a good idea of what I am exactly after. On my WordPress site categories are used as Editions ...
1
vote
2answers
50 views

Querying Term Posts in Loop

I'm trying to show my CPT Category along with any posts associated with it below the title. I have the first loop fine: <?php $cats = get_categories(array('taxonomy' => 'custtax', 'orderby' ...
0
votes
1answer
95 views

Custom Page Template Category loop not functioning correctly

So after several attempts to correct this - It seems the pages not load but don't pull in the correct posts from each category. It just seems to pull in the same default posts whenever I click each ...
0
votes
1answer
129 views

Custom Category Page Not Working [duplicate]

Under "Settings" => "Reading", I have set "Blog pages show at most" to 6. I have created a category called 1970s where one can see all the best Rock albums of the decade -> Meanwhile, I have created ...
0
votes
0answers
71 views

Build Categories List for Posts with specific meta_value

I've a set of Posts under custom post type that has a specific custom field (meta_value). This posts are categorized with a simple Common Parent->Child#N relationship. The question is how to list ...
2
votes
0answers
42 views

How to show in search results posts with a particular tag in a particular category?

As the home page of my blog I've a static page. There I want to show the navigation of the site. Category1 Sub-Category1 tag1, tag2, tag3 Category1 Sub-Category2 tag1, tag2, tag3 ...
0
votes
1answer
38 views

How to Include a common category in a custom Category Search

I was wondering how to solve this issue. This is my Query: $query = new WP_Query( array( 'posts_per_page' => 6, 'orderby' => 'date', 'order' => 'DESC', 'category__not_in' ...
0
votes
1answer
47 views

Retrieve post tags from from main wp_query

I'm running a custom WP_Query and find the following SQL running as part of it. SELECT t.*, tt.*, tr.object_id FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER ...
-1
votes
1answer
167 views

Narrow Down a Shop Page Results Based on a Product Tag in WooCommerce

I have a shop page that displays a product (chairs) for a retailer in multiple cities. Each city is a tag for each product. What I want to be able to do is narrow down a category page like (chairs) or ...
0
votes
1answer
1k views

Custom query with category exclusion and post-meta “whitelist”

I have two widgets, one shows News while the other shows everything except News (We'll call the second one Blog). The blog portion is currently working correctly. The News posts are either ...
1
vote
1answer
676 views

Combine two taxonomies in a hierarchical tree

For example, I have WooCommerce products that have taxonomies: brand (e.g. Converse, adidas, D&G) (taxonomy id: product_brand) category (e.g. Boots, Sneakers, Sandals, Heels) (taxonomy id: ...
1
vote
2answers
131 views

Trying to find a way to query post like normal search would do. within search.php page

I have a costume search in a site i am making. When a user search a certain term, i want to display category list with a count of how many posts are found with in that category. I thought of a way ...
0
votes
1answer
81 views

Display posts from a category

I am trying to display a bunch of posts from a single category on the category page, using multiple loops. <div id="featured-content" class="clearfix"> <? // assign the variable as current ...
0
votes
1answer
169 views

WP_query exclude a category unless it has more then one catagory

I have this category exclude_cat with id 39 I want to exclude it from the home. So I use for WP_Query args like this: $args = array ( 'category__not_in' => array( 39 ), //exclude ID ); Works. ...