A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

Questions tagged [query-posts]

Set up The Loop with query parameters. This will override the current WordPress Loop and shouldn’t be used more than once. This must not be used within the WordPress Loop.

Filter by
Sorted by
Tagged with
1
vote
2answers
9 views

Bypass “supress_filters” in WP Query

Apparently, for some illogical reason, the developers decided that the only way to fetch posts in all languages, is to add supress_filters=true to the WP_Query (instead of having like say, a ...
0
votes
1answer
18 views

Use WP_query to match post types based on custom field values

i'm trying to query posts from the post type Product that match with the current post in the loop from the post type Item, based on the custom fields product-ean and item-ean. For example: i have a ...
0
votes
1answer
13 views

Top rated posts Average rating issue

I am trying to show top rated posts, cpt with AVG rating value.I created the custom widget for this. Defaults wp posts data and AVG value is showing correct but a CPT like Movie post not showing ...
0
votes
0answers
13 views

Custom Static Page to Display Blog Posts in Excerpt Non-Singular Form (is_singular not working?)

I have been trying to change my code from my index.php to a custom page template instead as this is better practice I have been told. The original code for the index.php does not work anymore so I ...
0
votes
0answers
11 views

Filter post by category with pagination

Hi i want to display all categories on frontend as a checkbox and filter the blog post based on checkbox selected with pagination , any help please
1
vote
0answers
20 views

Get link which associated with a specific category and tag

We have 500+ post, 60+ tags, 3 categories. We want to give link on header part which have specific one category and one tag. For example: We have multiple post like: Blanket, Blender, Mixer, Wardrobe ...
0
votes
0answers
13 views

post_per_page and multiple categories

I need some tips for the code, I need to get 5 posts per every category, but this is show 5 post at all.. <div id="projects-carousel" class="owl-carousel"> <?php $query = new WP_Query( array(...
0
votes
1answer
49 views

Should I reset $wp_query?

I am not totally new on WordPress but the query thing is a bit confusing to me. I searched the web and read a lot of articles, but I couldn't find what I needed. Maybe it could help a lot of people ...
0
votes
1answer
12 views

Performance considerations - postmeta table versus new table for custom posts with foreign keys?

I am modifying a plugin that uses various custom posts types. The types are courses lessons topics At course, lesson, or topic level there can also be quizzes and assignments. ALso the ...
0
votes
0answers
22 views

how to add 4 post in one carousel slide

I want to display 8 posts in twoeach carousel slides, that mean 4 post in each slide. i'm using a loop to display post but the problem is, it is showing one post in one slide and hence displaying 8 ...
0
votes
1answer
29 views

query posts custom field calculation value

I have a front-end form whereby users create a post and input 3 numerical custom field value` as part of their post. These 3 custom fields are then calculated and the result is displayed in the post....
0
votes
1answer
17 views

Ordering of posts, 2020 Year showing as next event when should be last

We have some event posted into wordpress which are ordered by date. All works well except when we enter an event for 2020 it comes at the top of the list rather than the bottom. The date is save in ...
0
votes
0answers
15 views

What would be the best approach for querying posts with multiple templates from a custom post type

I'm a bit stuck with querying all the posts from a custom content type where posts have multiple templates and display all the posts on a page. As shown from the image below, each block inside the ...
0
votes
2answers
34 views

Order Posts in Custom Order

I am trying to create a custom way to order my new custom post type. Here is what I am envisioning: There would be a custom way to order posts in an entirely unique order for display (Number, ...
0
votes
1answer
71 views

meta_query check for meta value in key which holds an array of values

In every post of my custom post type called "announcements" I save the users' ID inside an array which resides in a meta_key called "post_is_read" whenever a user reads an announcement. Just to ...
0
votes
0answers
22 views

How to show post views shortcode data for each post on Posts List Page?

Example: [shortcode id=""]. I just want to how to dynamically fetch each post ID on Posts Lists page over archive page or normal posts page inside the shortcode placed in excerpt. Currently I'm using ...
0
votes
0answers
79 views

Woocommerce - Do not show out of stock variation on filter

When I filter by size, it will display all products that have that size, even if the specific size from the product is out of stock. I would like it to not display products that the filtered size ...
0
votes
0answers
23 views

How to add results to wp-query with pagination?

I'm trying to add results with pagination to the main query results with custom arguments. But the problem is that I'm getting the second loop result in every pagination page. The goal is to add them ...
0
votes
1answer
34 views

Counting Search results, and displaying the offset per page

I'm trying to achieve the following search result counts while using pagination; Showing 1-9 of 368 Items - (Page One) Showing 9-18 of 368 Items - (Page Two) but I'm getting myself turned ...
0
votes
1answer
11 views

Order by meta date with a thousanth of a second defaults to post order

I have a custom post type query: $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; $args = array( 'paged' => $paged, 'post_type' => 'my_custom_post_type', '...
0
votes
0answers
22 views

Custom query for custom post type not getting correct post ID

I have written a custom query here: <?php $the_query = new WP_Query( array('post_type' => 'video', 'posts_per_page' => 10, 'post_status' => 'publish') ); ?> <?php if ( $the_query-&...
0
votes
0answers
20 views

Remove post name of custom WP_Query when using in pagination?

Is this possible? I am trying to get pagination working on my pages and single pages. It seems like it's working, as it recognizes how many pages there are and shows the URL. The problem: the URL is ...
0
votes
0answers
68 views

Slow page loads due to WordPress Core Query

I have a page with many posts and every single page load is noticably slow. Hence, I have checked with Query Monitor the culprit(s) for the slow loading time and found that one query in particular is ...
-1
votes
2answers
48 views

prevent display duplicate titles on main page

I am using a automatic rss post reader on my website and there is a problem with this plugin that sometimes publish duplicate posts.I can't do anything to this plugin but at least it is better if I ...
0
votes
0answers
17 views

Show categories not in gallery post format

I want to show all blog categories that aren't of type gallery. My code almost works but if I have 2 posts in the same category the category is shown twice ie: If I create a category called 'news' ...
0
votes
0answers
36 views

can i add admin menu for set query category id?

I am thinking of something.that i want to add a wordpress admin menu for set category id. i mean i designed news section that lists post from specific category. like this: Sports News Post from ...
0
votes
2answers
48 views

Filter Custom Taxonomy Posts

I have a custom taxonomy page, it also has a slider up top. The problem is the slider displays random posts from all taxonomies rather than the current taxonomy. Is there a way to filter the images in ...
0
votes
1answer
29 views

Query Post interferes with Pagination

Here is my situation, if you look at the following page: http://staging.cancerwellness.com/mind-body/cancerversary/, you will see that the pagination is not working. After researching the problem, I ...
1
vote
1answer
245 views

Get posts by category with pure SQL query

I have a meeting post type, whose titles automatically get set to a date of the form m/d/Y. I have the below query which gets all unique years from the post titles by selecting distinct values after ...
2
votes
1answer
21 views

How to make the list of post and load on same page with sub-pages [closed]

http://jeffkoons.com/artwork/early-works How can I make a page on WP like this drupal site.? Thanks
0
votes
1answer
692 views

Posts Query | Query to only show sub categories

EDIT: Up to date code, only thing left to fix is the subcategory query. I'm struggling to get my portfolio page's filter to work. I have quite a good knowledge of WordPress and cannot seem to... ...
0
votes
1answer
72 views

trying to change from query_post to WP_Query

I am running a theme which is using query_post now I am trying to change it to WP_Query. However I am always getting a blank empty page with just the header. This is my query: query_posts(array( '...
0
votes
0answers
24 views

Problem with my loops

I am French. Sorry if i make mistakes. I have two problems. The first, I have a page that shows all paying activities sort by date. The 'posts_per_page' does not work When I put 10, it shows 8 ...
0
votes
1answer
383 views

wp_query with ajax

I am trying to filter posts by year using WP_QUERY with AJAX And the current builder i am using is DIVI(for front end). Result Everything loads fine and i am facing one final roadblock that is when ...
0
votes
2answers
62 views

How to query most recent post for each author?

Can anyone provide a sample MySQL or WP_Query code snippet that returns the most recent post for each author on a single WordPress site? For example, if the site has 10 authors but 500 posts, then the ...
1
vote
1answer
18 views

Duplicated posts on category page

So, I have archive.php file with this part of code <div class="column is-full is-three-quarters p-small"> <?php while ( have_posts() ) : the_post(); get_template_part(...
0
votes
1answer
20 views

Sorting query_posts() with a complex orderby filter

I'm trying to order my posts with a complex orderby scenario which uses the CASE and WHEN syntax. To achieve that, I've created a filter : add_filter( 'posts_orderby', 'order_properties_by_reference',...
0
votes
2answers
47 views

one post per term taxonomy

I need some help, again. I use this query: $tax = get_the_terms($id, 'coupon_category'); $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ...
0
votes
3answers
76 views

query_posts problem - need help

I have a taxonomy called coupon_category. In a query_post I am trying to call all posts from related custom taxonomy with the same coupon_category. If I use: <?php // show ...
0
votes
1answer
109 views

Query post with meta_query where date is not in future

In my args I would like to exclude posts where the datum_event is not in the future. Currently it only displays posts with datum_event values that are in the past, but because older posts don't have ...
0
votes
1answer
549 views

How to display Related Posts based on number of taxonomy terms matched

I have a custom post-type 'News' which has multiple custom taxonomies 'news-category', 'news-tags'. Each post contains between 4-8 'news-tags' and 1 'news-category'. For my current post, I'd like to ...
1
vote
0answers
31 views

ACF Query meta_values don't work with 'offset'

I am currently building a featured posts section and I'm using ACF to set which posts will be featured. As they're appear in another section, I want them to start in this query on the third post. ...
0
votes
2answers
24 views

How to give classname to post if post has no content?

I want to give a post a classname on the homepage (index) if the post on the single page has no content. So when the post itself exists but there is no content, I want to give a classname to that ...
2
votes
0answers
40 views

List custom post type by custom tax term as page title

I have a page called "Developments" and I want to list all the Project posts by the custom tax Project Type using the page title as the term. This doesn't work: <?php $title_slug = ...
0
votes
1answer
259 views

How to display liked posts of current user in wordpress?

Im using an ajax like dislike post system on my wordpress theme. When the user likes the post there are some post metas to update or to add like the following: if( $post_like == "like" ){ ...
0
votes
1answer
51 views

I need query_posts() to order results first by a meta value and then by post ID

I've read all the WordPress docs that seem relevant, and I've read lots of posts here and on other sites to find an answer to this, but I still can't find a way to do this. I have a custom post type. ...
0
votes
2answers
118 views

Get all posts which was posted on X Days WordPress

I want to get all post which was posted on X Days, I don't want 7 days old post or 1 Month old posts, Because it will return all posts which will be older 7 days or one month. Like Today is 15 SEP, I ...
0
votes
0answers
84 views

How can I use query_posts to loop through posts and construct my own content?

I am using query_posts to combine two posts categories on a page (by inserting this simple php script on the page using a plugin). This script gives me all the posts I want, however one of the ...
0
votes
0answers
48 views

My archives page won't sort posts by month

I'm trying to make my own theme and I've created an archive template that works fairly well. The template shows all posts, but the problem is that all posts will show if I go to /2018/11/ (posts were ...
0
votes
1answer
25 views

How to display particular categorie's post which associated to specific user?

How to display particular categorie's post which associated to specific user? http://tugsemegtei.mn/category/fish/ Above link displays all the posts under fish category, but how can I display only ...