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.

learn more… | top users | synonyms

-1
votes
0answers
22 views

What is the one-query (or the fastest) way to get posts and their terms (more taxonomies)?

Now this might seem like a similar question One query to get posts and their taxonomy terms but it is just similar and does not have proper answer. Goal: I need to get limited number of posts and ...
0
votes
0answers
18 views

Ajax custom taxonomy and query_posts

I'm trying to add ajax load more function on my custom taxonomy template. I'm stuck, It works for me on category templates and stuff, but not on taxonomy template (archive). So, here's my loop ...
0
votes
1answer
22 views

How to get posts from a current post's month?

I want to display the titles of the post of the same month as the blog post. I tried this .. <?php $year = the_date('Y')?> <?php $month = the_date('M')?> <?php $theids = $wpdb-...
0
votes
0answers
13 views

Filtering search results for nested loops

So I have a list of companies that have counties and cities. I need to be able to do something like /findmanagers/miami-dade/ and then build a query that fetches all the companies we have listed ...
2
votes
1answer
26 views

Taxonomy.php issue with search and filters [Solved]

I'm trying to create a custom taxonomy.php page where my users can refine search into that context. I've tried to create a kind of loop like: <?php if(!empty($_GET['ending'])) ...
-1
votes
0answers
29 views

Posts pagination bug

My index.php looks like this: <div class="container"> <div class="row"> <div id="primary" class="content-area <?php echo apply_filters('primary_bootstrap_class', 'col-sm-...
1
vote
1answer
34 views

How to build a WP_Query using mulitple tags and using AND or OR operator between them

I'd like to craft a query to return posts based on the conditional presence of certain tags. The pseudo query is: return posts with "((tagA OR tagB) AND (tagX OR tagY))". But I'm having issues ...
0
votes
1answer
21 views

How to sort posts according to meta value?

How can I sort all the posts according to their meta value? I am using the below code: $args = array( 'meta_query' => array( array( 'key' => 'wpcf-stream', '...
0
votes
1answer
17 views

Sort Events by Venue Title - Sort Post set by related post ids

In wordpress, I am using The Events Calendar Plugin to host events. This includes two post types: events and venues. On an index page, I would like to list ALL events, but ordered by their ...
0
votes
1answer
66 views

How to provide meta_key array to wp_query?

I'm trying to build a wp_query, so far I've managed to get desired result using following query. $args = array( 'meta_query' => array( 'relation' => 'OR', array( //check if ...
2
votes
2answers
41 views

_wp_page_template to dynamically use template

I'm wondering if it is at all possible to set display a page template chosen by the user within the context of a query_posts using get_template_part. In other words, I have set up a page template to ...
4
votes
2answers
57 views

Are there any scenarios where the query_posts may be used?

I feel there is a red button saying "Do not press" below query_posts(). For some time I am trying to demystify this phenomena with very low success to be honest. For example, probable the main ...
3
votes
2answers
68 views

Is `query_posts` really slower than secondary query?

I know the main query is fast, since it gets data after parsing the URL and after WP_Query has been instantiated. We are in OO PHP. But is query_posts really slower than some secondary query that ...
0
votes
0answers
32 views

How to query post from sub-categories on category archive and display posts?

On a custom taxonomy archive from the taxonomy called 'books' (taxonomy-books.php) I want to list all subcategories that are assigned to the parent category. And then for each subcategory I want to ...
8
votes
2answers
136 views

Why query_posts() isn't marked as deprecated?

There are two query_posts() functions technically speaking. One query_posts() is actually WP_Query::query_posts() and the other is in global space. Asking from sanity: If global query_posts() is ...
-1
votes
1answer
21 views

Filter Query Post by Custom Fields(by date)

I want to filter query_post using the 2 meta keys start_date and end_date, i want to get my posts to divide it by upcoming events and past events. start_date and end_date is stored in the timestamp ...
0
votes
0answers
15 views

Publish four random posts each day

I am currently using the following code to publish four posts in my home page. query_posts('cat=14&showposts=4&offset=1'); if (have_posts()) : while (have_posts()) : ...
0
votes
0answers
40 views

Search result by taxonomy name

Currently my search filters by title and I'm trying to filtered by taxonomy tags. How do you I do that. Here is my code: $query = " SELECT * FROM $wpdb->posts WHERE $wpdb->posts.post_status = '...
1
vote
1answer
40 views

pass query string on url to filter media

I have an author page which shows all uploaded media by that author. Each media can have tag1, tag2 or tag3. I would like to add an option where I can show on that same page only tag1 media without ...
0
votes
0answers
22 views

Query returning 1 post per page but saying it has 71 pages with almost 1500 results in total

Something is definitely not right here and I honestly cannot understand what it it. After I put this code on one of my custom made plugins, although it makes the search correctly (the result ...
1
vote
1answer
42 views

Query with custom taxonomy not working

I have custom post type 'mix'. And custom taxonomy 'meal'. And categories in custom taxonomy (one of that is with slug: breakfast) I have problems with making query. My code is : $args ...
0
votes
0answers
10 views

Category and post_lists

I´m trying to make a template for a wordpress site where i need to fetch posts form two different categories - two times. (ie.two loops) But seems like the category sort is just working for the ...
0
votes
1answer
50 views

posts_per_page override by default settings

I'm running some template files outside of the actual theme and I am displaying some posts on this templates. Everything worked absolutely fine but some days ago (maybe the update to 4.5) the default ...
0
votes
0answers
44 views

Frontend Post with JQuery AJAX to Php Issue

My problem is the following. I'm trying to make users publish custom post_type by frontend through a form like this: <form id="msform" enctype="multipart/form-data"> <fieldset id="...
0
votes
1answer
25 views

Trying to show Wordpress category query result as background image

The code is working fine so far, but I want to show the post thumbnail as a background image inside the li tag. Been trying many variations, but can't work it out? Here's the code: <div class="...
0
votes
0answers
39 views

Omitting the latest entry with custom type and taxonomy term from the loop

My agency has inherited a client with a customized theme provided to them from a separate agency, which farmed the work to another agency off-shore. The documentation for this theme is non-existent ...
-2
votes
1answer
53 views

How to remove post duplicate when using query_posts('offset=1')

I used query_posts('offset=3') in index.php, while there exist a problem in pagination. In all page it show the same content of first page. How to solve this problem?
0
votes
0answers
15 views

Configure number of posts to show on Wordpress page using Redux Framework

I am using Redux Framework for theme options on a theme I am working on. I want users to be able to set the number of posts to show in a certain section. Right now it's hard coded to 3. But I added ...
1
vote
1answer
55 views

Query all posts if multiple meta key don't exist

I'm trying to get all posts that don't have a meta ket that starts with aa_. I can do it this way $args = array( 'posts_per_page' => -1, 'category__in' => 23, 'meta_query' => array( '...
0
votes
2answers
77 views

Fetching $_POST from Page Template into functions.php

I'm having an issue with the order WordPress is loading page templates and functions.php. I have front-page.php which has $_POST['sort-by'] allowing users to sort posts using a drop-down menu. It's ...
0
votes
1answer
20 views

order posts by `meta_key`, Does not display posts that does not have `meta_key`

I'm using this query orderby meta_key for show posts. if one of the posts does not have vip_row meta, So not shown; Is it possible that if one of the posts does not have vip_row meta to be displayed,...
1
vote
3answers
46 views

Unable To Get Published posts using query_posts

I'm not sure why this is not working as its a very simple query. It works when i pull all posts including pending, but not when i want to get posts that are only published. I have a function to get ...
-1
votes
1answer
126 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 ...
0
votes
1answer
22 views

How to set class to “current-page” on the currently viewed single post within a CPT

I have a custom post type, "case". I'm currently editing the single-case.php file and in my sidebar I have the following piece of code: <?php $case_query = array ( 'post_type' => 'case', ...
0
votes
1answer
37 views

Create a hierarchical loop at predefined markup requirements

I try to achive this in wordpress based on my theme: fullpage.js demo So I have a predefined markup for vertical sections (parents) and one for horizontal slides (children). Parents only contain ...
1
vote
4answers
104 views

2 loops on page - one with orderby rand second orderby date

What I'm trying to achive, is to set 2 loops on one page. First one takes 11 latest posts and sort them in rand order. Second show the rest of posts ordered by date. FIRST LOOP $args = array('...
0
votes
1answer
61 views

Improving WP_Query for performance when random posts are ordered

I have made a new query after I've asked a question about my query_posts code... you guys didn't find that great, so I decided to change that. I made this: $page = (get_query_var('paged')) ? ...
1
vote
1answer
75 views

How to make draft posts or posts in review accessible via full url / slug?

I am running a website with WordPress 4.2 and have changed the way draft posts or posts in review status are displayed to non logged in users (these posts are, too, visible to anyone who visits the ...
0
votes
1answer
63 views

Does wp_query and query_posts affect website performance? [duplicate]

I've been aware about the difference of wp_query and query_posts. I just want to know what impact does both query methods to the performance of the page? Which query method makes the page load quicker ...
0
votes
0answers
26 views

Set Popular Post by views weekly?

I've tried several times, but still didn't work. Anyone have an idea? EDIT: This actually works, but only get popular post all of time. I want popular post by week. what needs to be added? This my ...
1
vote
1answer
54 views

Change query_posts to WP_Query in page but does not work

I have this code in page.php and it calls the template part for my home. Inside the home.php i used query_posts instead of WP_Query and i wanted to change it into WP_Query. I tried changing it but ...
1
vote
1answer
73 views

Show all taxonomy's terms' posts having another taxonomy's term in common

I am building a website which displays web radio stations. I have created a custom post type called "stations" and 2 taxonomies called "genres" and "locations". In my page I display all genres grouped ...
1
vote
0answers
53 views

How to display an other custom post type in a different custom post type's archive?

Background: I need to display all posts of a custom post type called "recipes", that have a specific taxonomy "fish", right under the permalink "www.mysite.com/recipes/fish". What I have done: I ...
1
vote
0answers
23 views

How to retrieve an array of post IDs by a particular value stored in a custom meta's array

I have a custom post type 'projects' that has custom post meta 'members'. 'members' stores an array of another custom post type's IDs. I'd like to do loop through the 'projects' posts that have a ...
1
vote
1answer
95 views

Call to a member function have_posts() on a non-object on normal loop

<?php defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); define( 'MY_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); define( 'MY_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); ...
1
vote
1answer
70 views

Meta Query with date and time on the same Day before given time

I have a metaquery for a custom post type "events". Their start date is stored as a meta field in this format: 2016-02-05 19:00:00 These are my query args: $args = array( "posts_per_page" =>...
1
vote
2answers
377 views

ACF Custom Field WP_Query, but need to get all posts, if field doesn't exist

I have a custom ACF field set on all posts, called event_date, I would like to grab all posts within a given category, but have posts that have event_date defined put first in DESC order of event_date....
2
votes
1answer
94 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 () { ...
1
vote
0answers
65 views

Random ajax load only works with posts_per_page set to -1

I created a post loader shortcode, that uses AJAX to load posts. Even though I can set the order and order_by query parameters, the order_by should be random. From what I've seen on the web, ajax load ...
0
votes
1answer
34 views

How to order by datediff in WP loop?

I have a custom post type for events with a custom field named event_start_date, and I want to sort the archive loop according to the nearest event_start_date. In other words, the event with the ...