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
0
votes
0answers
1k views

Imported Content Doesnt Show Up On Frontend

I found similar problems posted couple times, for different custom post types, but none of the solutions worked for me and these, other questions, didnt have much info provided, I'll try to give as ...
0
votes
0answers
14 views

Wordpress primitive query returns = array

i am trying to primitive query form this wp_query: $query_v = array( 'post_type' => array('pro'), 'posts_per_page' => -1, 'orderby' => $count_visit, 'order' => 'ASC', ...
0
votes
1answer
9 views

Displaying all posts from other sites on the network on one site

I have a multi-site setup as follows Main Site has no posts Site A has 1 post A Site B has 1 post B Site C has 1 post C What I'm interested in is to be able to treat the main site as an aggregation ...
0
votes
1answer
755 views

How to get all post titles starting with numbers and symbols?

I want to get all posts which are starting with a number (0-9) or symbols, in a list. I managed to get it work for letters, but this one is harder for me. Can someone help me out please? I tried ...
0
votes
0answers
12 views

How can I list all posts on a given day of the year (Month, Day, but _any_ year)?

Is there any way to show all the posts on a particular date for any year? WP has built-in support for a /yyyy/mm/dd/ path which will show an archive [I believe that's what it's called?] page for all ...
0
votes
1answer
65 views

Get the most recently modified post date of most recently modified post

I have Googled this, but there are always answers to get the modified date of a single post, which I know how to do. What I'd like to do is get and display the most recent modified date of the most ...
1
vote
2answers
540 views

Getting movie and serial on actor page

I'm building a cinema site, I came with a problem, let me explain: Movies- are stored in Post's Actors- are stored in Post Type - persoane ( taxonomy= lista) Serials - are stored in Post Type - ...
0
votes
1answer
825 views

Merge two queries and remove duplicate

I want to merge two queries together and remove duplicate. I got it working individually. Now I got it working together but the results are not mixed and the duplicates are not removed. So I got the ...
0
votes
1answer
23 views

Create a post automatically if search result has zero results

I'm developing a site where people can search phone number(s), the most complex part is that i want to create a post automatically when someone search for a specific number if that phone number yield ...
0
votes
1answer
15 views

Trying to list years (for a filter) but not all years display

I did an ajax filter to filter posts per years, however the filter isn't showing all items. Years are displayed in DESC order, but not all years appear I don't understand.... <?php $terms_year = ...
-1
votes
0answers
14 views

How can I do metabox filtering?

I have a post type. I have a private domain within this post type. My special area is a date. I want to filter by post type and end date. How can I do that? Thank you in advance for your help.
0
votes
2answers
2k views

Get post by tag

I want to get several post by tag. So I try to use get_posts() function: <?php $args = array( 'numberposts' => '3', 'post_status' => 'publish', 'tag' => 'travel' ); $...
0
votes
4answers
1k views

get_page_by_title() not working if special characters are present

get_page_by_title works fine on plain text title. but when it comes to smart quotes and symbols like # it doesn't work. It fails to find post with the given title. For Example:- get_page_by_title('...
1
vote
1answer
79 views

Can't search posts using WP_QUERY inside AJAX Function

WP_Query is used to get posts via simple arguments provided by it. WordPress provides an argument called 's' for search. It basically searches content of all posts and lists the ones with that string ...
8
votes
1answer
7k views

WP Query where title begins with a specific letter

I want to search for posts with WP_Query() and select only posts that begin with a specific letter. I found a bunch of old posts with filters that were pre-4.4, but since 4.4 there is a title search ...
0
votes
0answers
13 views

Is there anyway I can call the year once?

Hi everyone I hope you have a great day, I was wondering if is there anyway I can call the year once?. I really don't know if its possible to call the date once cause mine keeps on repeating calling ...
0
votes
1answer
15 views

Getting post URL within custom content template

This should be such an easy thing but it's giving me so much headache. I created a content template called content-sticky.php. Added all the code there <article id="post-<?php the_ID(); ?&...
0
votes
0answers
24 views

custom post type get_posts() function not work

$orders = get_posts(array( 'post_type' => 'lp_order', )); foreach ($orders as $order) { // get all order data code } This the code I will try to learnpress plugin order post type front end ...
0
votes
0answers
15 views

How to fetch courses in all languages in WordPress?

I have a query which fetches English courses only. How can I fetch all the languages courses? I am using WooCommrce with LearnDash. public static function list_courses() { global $post; ...
38
votes
4answers
53k views

Get post ids from WP_Query?

Is there a way I can retrieve an array of post ids queried from the following: $latest = new WP_Query( array ( 'orderby' => 'rand', 'posts_per_page' => 3 )); if ( $...
1
vote
2answers
2k views

Cannot Update A Post, 404 Error

After months of leaving and deleting my WordPress site, I decided to try again. I downloaded the new version 4.7.3, installed and added a new post. So far so good. I then went back to edit the post ...
0
votes
0answers
15 views

How to display only 1 post of many child-categories in the Parent Category page of Woocommerce

I am trying to display only one product of a child category in the page of parent category. If I use $query->set( 'posts_per_page', '1' ); it shows only only 1 post , which is near to what i want ...
2
votes
1answer
22 views

How do you query wordpress posts using a math formula between multiple meta field values?

The following scenario is entirely fictitious, but it illustrates what I'm working on perfectly. Imagine that you have a school syllabus set up in WordPress. The students can turn in assignments early ...
23
votes
3answers
59k views

Nested meta_query with multiple relation keys

I am curious whether Wordpress is able to run nested meta_query, with each having different relation keys? As of Wordpress 3.0, tax_query is able to perform this function; I'm wondering whether this ...
0
votes
2answers
1k views

How to optimize 'select found_rows()' query? Several 'high load average' alerts daily

I have 5,000 regular posts, 6,000 posts in one post type and 2,000 posts in another post type. Needless to say, that has made the wp_posts table quite large. Not to mention, I have custom taxonomies ...
0
votes
2answers
2k views

wp_remote_post and form post

Actually it is more general question but now i am trying to use it on wordpress site so I preferred to post it here. I am trying to understand the difference between remote post and form post. When ...
1
vote
1answer
42 views

Slow WP_query due to nested wp_query. Need Suggestions

I'm facing an issue of slow queries. As I'm not that familiar with the WP_query, I managed to solve my problem with nested wp_query. https://it.zoetalentsolutions.com/technology-provider/aws/ in the ...
0
votes
0answers
16 views

Filter search results by post_tag if exist

I want to get posts from search results using post_tag. for example If a user input in the search form "party". First, we search if "party" exists in post_tag and show all posts ...
0
votes
1answer
14 views

How do I change the default sort order of a custom column on the posts page?

I have a fancy custom column on the posts page in the WordPress admin. I have this column set up to be sortable. The first time that you click on the column header, the URL in the address bar changes ...
3
votes
3answers
4k views

search query within custom taxonomy term, post title and meta field

I want to create a search that does: Search within my custom taxonomy - custom-tags search the post title search select meta field ?? dont know search with custom post type - easy part I looked ...
1
vote
1answer
596 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 ...
0
votes
1answer
41 views

custom post type and user post count shortcode

Hello i m a newbie in php and Wordpress development. I was struggling to get a user custom post count in my wordpress/buddypress site frontend. i m using this code: // add [author-post-count] ...
0
votes
1answer
691 views

custom query to get posts

I want to create custom links like mydomain.com/custom_page/cat=ABC&tag=XYZ So that when a user clicks on the link s/he can see all posts in the category 'ABC' having tag 'XYZ' For this I've ...
0
votes
1answer
32 views

pre_user_query vs pre_get_posts

I've used pre_user_query to edit the actual sql query and it works wonderfully. Now I'm trying to work with pre_get_posts and its not at all the same thing. I need to do an INNER JOIN.. In this ...
0
votes
3answers
3k views

Loop for custom post types filtered by a taxonomy

I am using the Custom Post Type feature in Wordpress 3 to create an Events section for my website. I am able to get this to display by using the relevante template files, but I also want the event ...
10
votes
1answer
30k views

How to get post content by calling ajax?

I am working on a plugin .I have a custom post type team.Custom post has four posts of different categories.I used this code to send post id of each using ajax. $(document).ready(function () { ...
2
votes
1answer
1k views

Order post by year DESC and month ASC

I have a worpresss 4.0.12 website; i created a custom template category-$id.php in which I have to show post ordering them by Year DESC and by month ASC (or a custom field ASC), the result should be ...
0
votes
0answers
18 views

Creating custom Wordpress query with multiple taxonomies

I have a custom post type of "the-talent" and 3 custom taxonomies (level, location, and specialty). I'm trying to figure out how to write a custom query for "the-talent" post type ...
5
votes
2answers
22k views

Using OR conditions in meta_query for query_posts argument

I have searched high and low for this but I cant seem to locate anything. I am trying to filter some results and when I make an args array like this and pass it to query_posts I noticed that the ...
1
vote
0answers
775 views

Polylang non-default language ignores tags in WP_Query

I have a mutual DB of custom posts that I'd like different languages to be able to access. If I loop through the post type only, all posts show in all languages, but once I add a tag to the query it ...
1
vote
1answer
517 views

Sort by page information by Ascending Numbers

Basically I have a problem that I have details being pulled from advanced custom fields and I currently have them ordered by page title in ascending order. However, instead of ordering them Ascending ...
7
votes
5answers
34k views

Return all custom meta data for one custom post type

I've set up a custom post type which has three custom meta fields: name, latitude, longitude. Each post already shows the name on an integrated map based on it's latitude and longitude. I now would ...
0
votes
1answer
572 views

Co-authors plus problems with query_post

I had a query_post that worked, aimed lists only posts by author own, but now that I updated wordpress stopped working. The query_post only works when you have only one author. I updated WordPress 3....
0
votes
0answers
16 views

WP_Query show the posts in sequence of tags entered in Query

Basicly I want to show the post in sequence of what the tags entered are. For instance this is my Query: $args = array( 'post_type' => array( 'providers' ), 'post_status' ...
0
votes
1answer
649 views

Pagination not working on my archive page for a custom post type

First off I have a custom post type called events, and I wrote a custom query in in my archive-events.php file. Everything is working great except for the pagination. To trouble shoot I stripped ...
0
votes
1answer
567 views

get_next_posts_link() stops displaying at page 4

Please start by taking a look at this quick video: http://www.screenr.com/8vSH The problem: get_next_posts_link() disappears on page 4. That is, the "go to older posts" link disappears once I am in &...
0
votes
1answer
2k views

Modify Blog Module layout in Child theme

I need to adjust how the featured image is displayed in their blog module. I need to change the display of the Featured Image from an IMG tag to a Background Image. So I can modify the frame (DIV) of ...
1
vote
0answers
124 views

Blog post per page setting conflicting with custom WP_Query?

I am creating a theme, and have run into a problem with how a custom WP_Query seems to interact with the Blog pages show at most settings found under Settings -> Reading in the WordPress backend. I ...
0
votes
1answer
24 views

Get posts for each user

For a project with students I use WordPress with Timber (TWIG) + ACF Fot this project I created 3 custom post types : dissertation, subject-imposed and subject-free Each student can create only ONE ...
37
votes
5answers
141k views

How do I query a custom post type with a custom taxonomy?

For some reason I'm finding it a struggle to grab any posts using a custom taxonomy... can anyone unravel my stupidity? $args = array( 'post_type' => 'adverts', 'advert_tag' => '...

1
2 3 4 5
24