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
2answers
20 views

query_posts adding extra code to homepage

I've made a custom post type "brands". I have a custom template that display's these brands on this page: http://www.southernms.com/new/brands/ I also want these brands added to the homepage. So I am ...
0
votes
0answers
22 views

pre_get_post alter current post id

For some purpose, we want to apply a change to the Wordpress flow that affect's WooCommerce product page being displayed. When a product page is displayed (e.g. www.mysite.com/?product=my-product), ...
0
votes
1answer
22 views

Multiple search queries on one page

I need to display results of three different search queries on one page. More precisely, there is a searchbox on my page where a user enters a search phrase. Once the search phrase is submitted, I ...
0
votes
0answers
16 views

Some posts appear in duplicate with paginated query

I'm querying a custom post type with some custom post meta, and then output the results. This is the query: $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $properties_query = array( ...
-2
votes
0answers
22 views

How to display 10 first posts (not summary)

This is related to this question how to display an excerpt of the latest post on the homepage? However, I do not want excerpts. I want full posts so that things can work with adsense plugins. How ...
0
votes
0answers
26 views

How can I make Pagination Work on a WordPress Static Front Page

I have this pagination function I have been using on traditional post listing pages. But on my home page I have a section where I have post listings and I want to paginate them but it is not working. ...
0
votes
1answer
17 views

Query Products & Store IDs in array

I'm attempting to query Products in WooCommerce and return their IDs as an array that can be used to filter conditionally. I'm using ACF Pro to add custom fields into the product, for which I'm then ...
4
votes
2answers
97 views

Query Multiple Post types each with own meta query

I have 2 post types: lets say products and product_variations. I'd like to be able to modify the query via pre_get_posts to get all product with meta_keys "_visible" = "true" and "_available" = "true" ...
0
votes
2answers
27 views

Creating attachments archive in tags and categories

Per this question (How to create an attachments archive with working pagination?), I've been using the following function to have archive pages display attachments as well as pages and posts. It was ...
0
votes
0answers
10 views

Get the page that have particular value in advanced custom field

All my pages have advanced custom field called : “Program slug” I would like to get link to the page that have particular value in that custom field. For example : Want to get link to the page that ...
0
votes
1answer
17 views

Query post only from categories that have subcategories

My categories structure : Category 1 (8 Posts ) subcategory1 (2 Posts) subcategory2 (2 Posts) subcategory3 (2 Posts) Category 2 (6 Posts) subcategory1 (2 Posts) subcategory2 (2 Posts) ...
0
votes
1answer
31 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
34 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
16 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
37 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
73 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
32 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
48 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
25 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
26 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
109 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
34 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
76 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
36 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
54 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
24 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
58 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
59 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
40 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
46 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
26 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
59 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
25 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
74 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
88 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
132 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
140 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
159 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
90 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
69 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
22 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
34 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
28 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
59 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
69 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
101 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
77 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 ...