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

0
votes
0answers
12 views

Custome column sort by date not title

I've created a custom column. Currently they are automatically sorting by title however i want them to sort by date. I've tried adding a "query_post" like: ...
0
votes
1answer
24 views

How to use 'WP_Query' or 'query_posts' to display content in a descending order

How can I list posts in a descending order of the $json_data->data[0]->total_count values ? I want to display top shared posts descending, but I can't really use WP_Query or query_posts the ...
0
votes
0answers
8 views

Menu not showing while using filter hook for custom posts

I have a custom post type named event and each event has a meta value named event_date. event post type has two custom taxonomy event_category and event_location. On the homepage I'm trying to show ...
0
votes
0answers
27 views

How can I add recent posts to menu like mashable

I would like create a mega menu that uses recent posts for hover state. Like When you hover a submenu you get a list of recent post relevant to that menu item like in Mashable. I I would like a menu ...
0
votes
1answer
41 views

Display post list within category list sorted by name [duplicate]

I'm trying to display a list of categories sorted by name and all posts of each category inside it. Like this: Category A Post B Post F Post Z Category B Post A Post C Post G Category C Post D ...
0
votes
1answer
27 views

Way to cache a query for 24 hrs

Would like to show a random tip from tips category in wordpress and change it every 24hrs... is it possible? Here is my query // Random post link function randomPostlink(){ $RandPostQuery = new ...
0
votes
1answer
32 views

Display only one post each WEEK

I have custom post type named 'NEWS' where i already published 52 posts at a time. Now, in front i would like to display them ONE NEWS for ONE WEEK. So 52 NEWS will cover one year for me. My ...
0
votes
0answers
6 views

merging two meta_keys

i want order posts with a combinaison between two meta_keys for each posts .. this combinaison is 'meta_key'=views/post_views_count .. & because i use the query_posts before loop so i have ...
0
votes
3answers
18 views

Get next/prev image/attachment in time with date query

I have a big amount of images in WP, that are not attach to any post. They are grouped in custom taxonomies (ignored in code below). The images get uploaded to WP in random order and the post_date is ...
-1
votes
1answer
16 views

How to do query_posts on tags pages

So I am using the tags.php on my WordPress site to create special featured pages; what I would like to do is create a featured area on the index of every page that contains the first five posts. I ...
1
vote
1answer
16 views

Post count for category and tag

I have this code that counts the result found when a search is made. Here goes the code. <?php /* Search Count */ $allsearch = &new WP_Query("s=$s&showposts=-1"); $key = ...
1
vote
1answer
68 views

Better way to display posts from specific categories, in a grid layout

I'm using the following code to display posts from a specific category, in a grid layout, on my home page. It works exactly how I want it to, but I keep reading that I shouldn't ever use query_posts. ...
0
votes
2answers
23 views

Query post category & remove any post id

I have category_id=3 and have 10 post in category_id=3 with post_id= 1=>10 How to show list post category_id=3 with no post_id=1,3,5 value as query_posts('cat=3& -p=1,3,5 &showposts=30
0
votes
1answer
36 views

Wordpress wp_get_attachment_thumb_url full

My code in index: (show all attachment by one post ID) <?php query_posts('p=1498'); if (have_posts()) { while (have_posts()) { the_post(); ?> <?php $args = array( 'post_type' => ...
-2
votes
1answer
33 views

Incorrect posts displayed on category page

I'm using this loop to show my 5 latest posts but even if I'm selecting a category it still shows the 5 latest posts from all category. query_posts('showposts=5'); <?php if (have_posts()) : while ...
0
votes
2answers
37 views

How to order by multiple fields using standard query_posts?

In our archive.php we show all the items which match our selected category. This works absolutely fine. Then we improved it by adding (just before the loop) a sort and upping the posts per page from ...
0
votes
1answer
21 views

show latest authors blog post

how do you display the latest authors blog post? I have the below code: <?php $author = get_the_author(); $args = array( 'numberposts' => '1', 'author'=>$author ); $recent_posts = ...
0
votes
2answers
52 views

Wordpress custom post type

hello i have post_type "product" and taxonomy "price" can someone help me to query that custom post type with the selected taxonomy? my current code is like this <?php $term = get_term_by( ...
0
votes
0answers
47 views

How to get Last post Id of custom post type in wordpress

I want to get last post id of a custom post type in wordpress. For this I tried this code- args = array( 'post_type' =>'soto_property', 'posts_per_page' => 1, ...
0
votes
1answer
32 views

How to get main div html to print a list of posts inside?

I have created a function that lists custom post types with a specific term and prints the html. I'm using it as part of my plugin code. I reused part of this information: ...
0
votes
1answer
28 views

Multiple posts/pages in one page?

I'm trying to create website with index page which will have 2+ different boxs with different content generated from post or pages in WP administration. This page will be looks like this wireframe. ...
0
votes
2answers
23 views

Order for custom field after the loop

I have a table, where each post has a custom field with "region" and "city": 01 > SP > São Paulo 02 > RJ > Rio de Janeiro 03 > SP > Campinas 04 > RJ > Niteroi This query is working ...
0
votes
2answers
44 views

Using $post->post_name in body id causing error: Trying to get property of non-object

I'm getting the following error in my debug.log: PHP Notice: Trying to get property of non-object in /my-wesbite/wp-content/themes/express/header.php on line 36 This is line 36 of header.php in my ...
0
votes
1answer
21 views

Incorrect ordering of custom post type based on time

I have a custom post type as event which accept Custom fields' values as gp_event_date as ( 2015/02/26) gp_event_time as (SIMILAR) to 08:00PM - 10:00PM format. And on the list page, it orders the ...
0
votes
2answers
52 views

How to make an archive page displaying posts in a date range

I'm trying to make a couple of Page Templates for different Pages that should act as an archive to display posts (a Custom Post Type actually) in a certain date range. The website it concerns is ...
0
votes
1answer
68 views

Custom query - get_the_terms not work

I want to to show my customer works in a slide This is my query to show these works. I want to obtain the term of the taxonomy "idm_real_tax" for each custom type record. $query = new ...
0
votes
1answer
90 views

3 Posts in Loop, Show Stickies First

Okay I am starting to wonder if it is even possible to do this! As I've found very little info on the matter online. This is a fresh WP install that I've been experimenting on so that I can work in a ...
2
votes
1answer
115 views

Add field to posts (checkbox) that only one post can have

I am trying to add a field to Wordpress posts (not pages) which would simply include a label and a checkbox. Something like: Make this the sticky post? If check, the key should be set to TRUE or ...
3
votes
3answers
141 views

Query posts distinct authors

I am trying to get post from a category ordered random, but making sure that the author does not repeat itself. So I have this query which works as intended, but there is the chance that the author ...
0
votes
1answer
20 views

How to put forward a blog post

I would know if I can put forward a blog post natively using Wordpress ? For example, I have created 20 posts, but I only show 5 on my homepage. Then imagine that I want to put the 18th at the first ...
0
votes
1answer
71 views

Display 2nd category, only once, as sub-heading, in the loop

I have a Custom Post Type ("Rental"). I am using the code from this article I found to display Rental custom posts on a page, with the Categories of a custom Taxonomy ("Region") as headings between ...
0
votes
2answers
64 views

WordPress custom post type queries

I'm using custom post types and listing them in single-[customposttype].php?type=example <?php if (have_posts()) : while(have_posts()) : the_post();the_content(); endwhile; endif; ?> Now I ...
0
votes
1answer
21 views

query_posts clarification needed

I understand for the most what query_posts does and how it works. I also know it's not good practice to use it. But I would like to know exactly what the "$posts" variable does in this setup: ...
0
votes
0answers
29 views

Optimising specific Query with ACF meta objects

Is there any way I can improve the following query without touching the server, as it's taking around 5-6 seconds to execute, the SQL is outputing as: SELECT wp_posts.* FROM wp_posts INNER JOIN ...
0
votes
0answers
27 views

post by Category not working after setting 4 post per page

I am trying to show 4 posts on my homepage that is working fine but whenever i click on sidebar post categories it still shows the 4 post from homepage i.e the filter doesnot works and it shows 4 post ...
0
votes
0answers
53 views

Order posts by ACF checkbox

I would like to order the posts (archive.php) by listing the ones with the ACF checkbox "Premium" first, could someone please offer some advice?:) This is what I've tried so far: <?php echo ...
0
votes
2answers
56 views

display news with pictures 3 small and one large (loop)

I'm trying to put 4 news with pictures 3 small and one large, have gotten displaying them but the "large" is repeated with the last "small" <?php $b=1; $args = array( ...
0
votes
0answers
93 views

Query Posts with meta_query key in array

I am trying to query posts using meta_query to get a series of dates stored as an array in the key repeat_intervals. I am able to query the first date using the following: global $post; query_posts( ...
0
votes
1answer
61 views

query_posts() with multiple meta data comparisons

I have a bunch of posts belonging to category 6, each having the same meta fields. I'm interested in two fields in particular: "pce_monday_open" and "pce_monday_close", both of which have numeric ...
0
votes
1answer
156 views

Query post order by post and desc not working

I have a query that displays post the order of the post 1 to 10 and front-end added: <?php print intval( $post->menu_order );?>º there shows 1º, 2º, 3º ... 10º must reverse the display but ...
0
votes
1answer
181 views

How to use filter hook posts_join for querying taxonomy terms in posts_where?

For the last few hours, I have been trying to use the filter hooks posts_where and posts_join to search for posts based on taxonomy terms, in this case, the taxonomy is 'category' and the term is ...
0
votes
1answer
102 views

WP_Query condition affects posts_per_page count

I'm trying to create a new WP_Query that displays the last 5 posts from cat 1 that doesn't have a thumbnail. This actually works: <?php $the_query = new WP_Query( 'cat=1&posts_per_page=5' ); ...
1
vote
1answer
35 views

List children on child post

I have a custom post type with children posts. If I'm viewing one of the children post how can I list other children posts that uses the same parent?
0
votes
1answer
131 views

List all posts in taxonomy term

I have a custom post type called anime and a taxonomy called series. If I view any post and that post belongs term Banana it should list all the posts in term Banana in a dropdown list. Here's the ...
0
votes
0answers
28 views

Auto create child post from custom field?

I have a custom post type that has 3 custom fields. If I create a post with data filled in those 3 custom fields I want it to auto create child posts for each custom field & using the data from ...
0
votes
1answer
44 views

Wrong post title displayed from loop

I'm building my own theme. I have a page set for my blog (with a template that I made) which I'd like to just display a few of my posts. It uses the following loop: <?php ...
0
votes
0answers
52 views

Advanced Custom Fields shows all posts

My ACF plugin shall only show posts with my organisation type = socialbusiness. Somehow it doesn't even care about my meta_query, it also doesn't care about the categories I selected (it shows "blog" ...
0
votes
1answer
45 views

2 queries with counters

I have 2 loops on a page both containing a counter to implement slightly different code every 6 posts. For some reason though the second loop is implementing the different code sometimes after 4 items ...
-1
votes
2answers
219 views

query_posts different amount of posts per page

I have a posts_per_page query to paginate multiple post types, which works great! Now though, as it paginates it to show (in this case) 100 posts per page, I'm wondering if you can show 100 on page ...
0
votes
1answer
33 views

Query all post types but limit to parents

I'm building a site with several post types and am using a single index.php to query the archive for each one in turn. One of these post types is hierarchical and I'd like to just query the parent. I ...