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
vote
1answer
88 views

Sorting a query Field by date

I have my site, which at the moment is display university open-days, at the moment they are sorting by order of page title, when actually I would prefer they sorted in order of date, soonest first, ...
2
votes
3answers
2k views

Post count per (day/month/year) since blog began

I'm looking to echo the number of posts per month since the blog began, and for months where there was no posts echo '0'. This is the output I want: January 1, February 3, March 8, April 3, ... ...
1
vote
1answer
73 views

Hook to return true when the_post() is used in a custom while loop

I fetch external data like this, but I also added the_post(); while($slice = mysql_fetch_assoc($result)){ the_post(); rest of my stuff } I need a hook to tell me if the_post() returns true, ...
0
votes
1answer
256 views

using query_posts to pull posts out of a category in a while loop. Getting odd echo

I have a custom template file I've been workin on. I have this code performing a loop after it queries posts from a certain category. This works and I have each post configured with styled divs, but ...
2
votes
1answer
41 views

How do I query for a post by custom field?

I have a custom field called "song-id" and I'd like to lookup a post by a song-id value. Can someone give me the code snippet for it? (bonus: also looking for a code to use the permalink in the post ...
1
vote
1answer
198 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 ...
1
vote
1answer
206 views

Query posts by meta_key whose value is an array

Let's say I'm modifying the default posts query: add_filter( 'pre_get_posts', 'my_filter' ); function my_filter( $query ) { $query->set( 'meta_key', 'my_rating' ); $query->set( 'orderby', ...
1
vote
2answers
98 views

How do you Query posts with nothing in common?

We can get multiple posts manually in a page, but that's generated in a template, AFTER the default query returned something else (page/post, etc) How do you query multiple posts in a public query, ...
1
vote
0answers
313 views

Querying posts with meta value that begins with a certain pattern

I am trying to create a search filter using meta_query. The only problem I'm having now is that I can't compare with wildcards. I think that's how you word it? $keyword = 'sos'; $tlds = ...
1
vote
0answers
341 views

List Posts For Terms Of A Custom Taxonomy For Any Post Type

The function is great and i am using this function with these filter to just display selected taxonomy term posts by id, but what result i am getting is like this Child Taxonomy 1 - Child Taxonomy 1 ...
1
vote
0answers
465 views

define orderby URL with meta_key=post_views_count

I want to make an url with meta_key=post_views_count. E.g: http://www.mysampleweb.com/?meta_key=post_views_count&orderby=meta_value&order=DESC So the posts should be ordered by Views. ...
0
votes
2answers
1k views

How to modify the query to exclude posts by slug?

How can I modify my query in order to exclude certain posts by slug? Is it possible? query_posts(array('category_name' => 'Mycat', 'posts_per_page' => -1)); Ty
3
votes
2answers
669 views

mysql custom wp query

this code is designed to select posts with selected meta value in wordpress query <?php $values = $wpdb->get_results("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = ...
1
vote
0answers
640 views

filter custom field values $min $max

The user needs to query posts by entering a $minPrice, $maxPrice and a category value. Here is my query which returns no results: function result() { $result = array( 'cat' => ...
0
votes
1answer
90 views

Echo a numerical value in query_posts

I am creating an option page for one of my wordpress themes and I am trying to ask user to enter "Number of posts to show" - I am using "query_posts" to show posts This is the code I modified but ...
2
votes
1answer
162 views

reference the current category being used in the category.php page

I have this code in my category.php file <?php query_posts( array('post_type'=>'featured' )); $featured = new WP_Query( array('posts_per_page'=>1, 'tax_query'=> ...
3
votes
1answer
464 views

Query posts: how to exclude results if post is in multiple categories

Say I have 3 categories: A, B, C, and another category D that posts in A,B,C can also be assigned to. D is to denote the featured post for the category, and theoretically only one post for each (A, ...
1
vote
0answers
376 views

Query_posts and attachments

I need some guidance on some WP code. I'm wondering if it's possible to take this code (which is grabbing all the images from the posts across my site and dumping them out): $args = array( ...
0
votes
2answers
434 views

How can I improve the performance of this query_posts loop?

I created a WordPress page template to build a customised XML feed for certain WordPress posts on my site. Specifically, the page template renders XML and only includes certain custom post types and ...
0
votes
1answer
195 views

query multiple posts by id using a string parameter, not array()

I'm looking for a way to query posts by id, and using a string as a parameter, instead of an array. Like this: query_posts('p=153'); But I need to get multiple posts. For example with ID 153 and ...
1
vote
0answers
130 views

Order by category titles

I have a category page called 'features' this is all fine, but the posts in the features category also belong to a certain genre of film, and it's this what I want to order the posts by on the actual ...
0
votes
1answer
245 views

Displaying links to all posts of the same category on the post page

I want to display the links to all posts of the same category of the current post on that page. I wrote the following code in the single.php file. <?php $categories_of_this_post = ...
0
votes
2answers
416 views

Page title in post query

How do i add the current post/page title in a post query? I've tried this, doesn't work: query_posts( 'posts_per_page=10category_name=&' . $post->post_title); if (have_posts()) : while ...
0
votes
1answer
479 views

Getting all ID's matching a title in a custom post type

I am trying to pull out all post ID's that have the same post title. This is in a custom post type called 'course-manager'. Here is what I have so far: $pages = array(); $args1 = array( ...
1
vote
3answers
2k views

Loading post content in FancyBox

I got a tricky question. I have created a custom post type whose posts I would like to display in a scrolling carousel. The carousel will only display the title, the excerpt and a "read more" button. ...
1
vote
1answer
228 views

Order query using custom meta data

I have created a custom post type called Events with the name of events function add_events_post_type() { register_post_type("events", array( "label" => __("Events"), ...
1
vote
1answer
73 views

Have parent category contain only one post?

Projects <-contains basic info about projects -Proj1 <-detailed info about proj1 -Proj2 <-detailed info about proj2 -Proj3 <-detailed info about proj3 I have a post attributed to the ...
0
votes
4answers
5k views

query_posts() - problem with “s” parameter

I'm trying to create a search page for a custom post type. This is the code I'm using: $s = $_GET['s']; $args = array( 'post_type' => 'companies', 's' => $s ); ...
0
votes
1answer
23 views

Post not found when filtered by category ID

On my home page I am trying to filter by a category type and limit it to one post; but I keep getting "no posts found". Here is my following code: <?php query_posts('cat=34&showposts=1'); ...
1
vote
1answer
242 views

Query Custom posts of same taxonomy as the post itself

I have 2 custom post types: "Services" and "Works" and they both have a same taxonomy 'Genre'. Now the taxonomy 'Genre' has as term called 'novice'. 5 Recent posts under "Works" which has the term ...
0
votes
1answer
206 views

Having trouble using this post category query on multiple pages?

I have three pages on my site (Listen, Read, Watch) which each query a different post category: "listen", "read", and "watch" respectively. I created three separate php files with their own unique ...
0
votes
1answer
102 views

Display posts with tag that matches current post title

How would I show posts that have a tag who's name matches the title of the current post? For example if you are on a post called "Hippo" at the bottom of the page I would like posts with the tag ...
1
vote
1answer
422 views

Sorting multiple custom post types without a meta key/value pair by sort order

At this current moment. is it possible to sort multiple custom post/page types without a meta key/value? I'm looking to just sort the posts by page attribute order: What have i done so far? I've ...
0
votes
2answers
96 views

Least Number of Loops to Create Custom Homepage?

I am trying to create a custom homepage where the site content is shown as follows... See image... http://i.stack.imgur.com/ykrdf.png With separate loops this is simple... 3 individual query_posts ...
5
votes
3answers
2k views

How to query post by user role?

I want to query posts by their author role. And do something with the post based on the role. I know we can get the post by get_posts or WP_query, the problem is there are no argument to sort the ...
0
votes
1answer
4k views

Add AJAX “Load more” on custom query block

I have a index,php with various new WP_Query all working ok, but in this block I need to implement that "AJAX thing people love - the load more posts": <h2>Latests articles <?php ...
0
votes
1answer
351 views

Query Posts to fetch Posts with Unique Tag

I am trying to write a query post such that it returns a list fixed list of posts from a category along with any of the one tag associated with it. For eg: <?php $arg = array('cat' => ...
0
votes
1answer
145 views

Exclude All Posts Which Do Not Have A Tag Assigned

Basically I have regular Category Listings that include posts WITH tags and posts WITHOUT tags. I need to modify the loop so that it ONLY includes posts which have one or more tags assigned to them. ...
2
votes
5answers
4k views

Order posts by custom field and if custom field is empty return remaining posts

I have an archive page ordered by a numeric value in a custom field. This returns the ordered posts correctly, but does not display posts that don't have a custom field. $paged = ...
1
vote
2answers
131 views

Why is querying posts messing up my pages?

I am working on a theme at the moment and I have set up a post template. This post template is linked to some custom post types. When I query_posts for my post type on the actual post template ...
2
votes
1answer
364 views

Determine if more posts are available than was asked for in `query_posts()`?

I'm getting products (from a specific category) using a custom query_posts() function. I limited the showposts parameter to 25, so how do I know to activate pagination if there are still products ...
0
votes
1answer
74 views

Change content off every sixth element

I would like to create custom post query where i will list all my posts in the list. Then the tricky bit is to add different content to sixth element off that list. So something like this ...
0
votes
3answers
166 views

Weird problem on if statement

I'm facing a weird issue trying to do what I'm going to explain now. Context Plugins I'm using: Custom Post Type UI / Advanced Custom Fields Functionality: I have a custom post type called ...
0
votes
1answer
979 views

How to make WP_Query not to show irrelevant posts?

I'm using the following WP_Query arguments array: $args = array( 'post_type' => POST_TYPE, 'tax_query' => array( 'taxonomy' => ...
0
votes
1answer
2k views

Posts limit on homepage (genesis framework)

in home.php // NOT working query_posts('show_posts=3'); // NOT working add_action( 'pre_get_posts', 'set_posts_per_page' ); function set_posts_per_page( $query ) { $query->set( ...
0
votes
1answer
256 views

Sticky posts don't show up first in custom loop

I'm using the following query in my frontpage template: <?php $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; $args=array( 'paged' => ...
1
vote
1answer
3k views

Filter query_posts by tag slug on “Tag Archive” page (when tag is 2 or more words)

I'm using the following to bring up a tag archive page: <?php query_posts( "tag=". '' . single_tag_title( '', false ) . '' ); ?> This works perfectly for all tags of one word only, but any ...
0
votes
2answers
982 views

query_posts pagination will always show identical content

Anyone here see why my pagination won't work? I can get "previous page" to show up, but when navigating to "page-2", the content will stay identical to the content on "page-1". <?php /* Template ...
0
votes
1answer
3k views

query_posts doesn't order by title

It seems like stupid bug, but how can i order by title? It anyways orders by date! I'm using: query_posts( array( 'post_type' => 'page', 'posts_per_page' => -1, 'orderby' ...
0
votes
1answer
1k views

How to Loop within a Loop (Display Children and then Grandchildren)

I am trying to develop a query for WordPress that will allow me to display a list of child pages with titles only, and then under each child page title, a list of grandchilden (children of the child) ...