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

Why is that gdsr_sort=thumbs (GD start rating plugin) only works with query_posts and not with WP_Query?

This correctly sort posts by thumbs vote (GD star rating plugin): <?php query_posts('gdsr_sort=thumbs&post_type=bbp_reply&posts_per_page=2&post_parent='.$post->ID); ?> <?php ...
1
vote
2answers
3k views

Select category in custom query

I'm sure this question is asked alot, but I cannot figure it out, since all the different ways to query posts are confusing me.. Here is my current code. How can I tell the code to only get posts ...
1
vote
1answer
205 views

Show Posts From Same Category OR Same Tag

Assume a post is categorized in "Fruit" and tagged with "Apple". The following code shows posts with category "Fruit" AND tag "Apple" $args = array( 'tag__in' => $tag_in, ...
1
vote
1answer
458 views

Show individual author rank from query of cumulative post view count for all authors

I originally was going to post a question on how I would go about ranking a list of authors by the amount of post views from all of their posts combined. But I luckily found a solution here: List ...
1
vote
1answer
2k views

Ensuring sticky posts are retrieved first (without using two queries)?

I need to maintain pagination for use with infinite scroll. Is there no way to tell query_posts to retrieve sticky posts first? It seems to be default behaviour on a standard wordpress blog on the ...
1
vote
1answer
199 views

How to know which one is the main query?

I just did an action on the query using pre_get_posts and it didn't work. When I removed the $query->is_main_query() it did work. So, how do you know that what is the main query. I know there is ...
1
vote
2answers
557 views

Limit the post for differents custom post type in the same wp_query

I have three custom post type: books magazine videos Now i want to limit the number of post for custom post type, for example: books => 3 post magazine => 2 post videos => 1 post I used a ...
1
vote
1answer
1k views

Sorting Posts Via Custom Taxonomy Values Using Checkboxes?

I am working on a project that has a dropdown of custom taxonomy values called "Disciplines", there are only 4 of them in the dropdown. The way it has been designed is that you can select more than ...
1
vote
1answer
3k views

Dynamically excluding current page id

I'm attempting to create a "related posts" section on pages using query_posts. I'm wanting to use this simply because we want to show random posts from one category on one page, so a plugin would be ...
1
vote
2answers
304 views

making random query button using $_GET

Im trying to make my post random when i lick on my button using $_GET but it just keeps refreshing my page instead of refreshing with the random post. <a href="<?php echo $my_query; ...
1
vote
1answer
979 views

Order posts using a custom array

I have an array of post ids which I'm passing to query_posts using 'post__in'. My question is how can I use the order from my array rather than ordering by 'date' etc?
1
vote
1answer
2k views

how can i get posts from custom post type particular taxonomy category

I have registered custom post type Article in my template using register_post_type function. and i also having taxonomy category for this article posts. Here i want to filter the posts under ...
1
vote
1answer
668 views

Read More is not working in query posts

I have Query_posts in my page. the posts have tags to separate for read more, But while doing query posts it is pulling all content for <?php the_content('read more..');?>
1
vote
2answers
332 views

how can i use custom field in query post

I want to get all featured items using query post. featured is meta_key using custom field plugin. I tried bellow,but it failed $featured_item = new ...
1
vote
3answers
3k views

how to group custom post type posts by custom taxonomy terms

I would really appreciate if you could help me :) I'm very stuck and don't know how to proceed. I have a custom post type called event and 2 custom taxonomies registered for it: event_type with ...
1
vote
3answers
3k views

query_posts for child pages

I am having problems looking for info on the codex on how to query for child pages. It seems to be missing the reference for the available parameters
1
vote
1answer
1k views

Is it possible to query_posts using post__in and then Loop through them in the ordered they were queried?

query_posts( array ( 'post__in' => array( 5, 76, 21, 56, 3 ) ) ); I'd like to query the Loop using post__in and a set Wordpress IDs. I'd then like to run through the Loop in the exact order of ...
1
vote
1answer
2k views

How to insert content from another Custom Post type into Post?

Say I have a custom post type called "Performers". This gets populated with different bands/performers. These posts have a featured image as well as custom fields (mp3 file, facebook link, myspace ...
1
vote
1answer
10k views

using multiple meta_key and meta_value in query_posts

how can i use multiple meta_key and meta_value in query_posts? For example, I want to find multiple content with two different meta_key and meta_value. How do I do this? i using this code but not ...
1
vote
2answers
128 views

Custom query works but returns “Undefined Offset: 0”

My custom query works, except when debugging it throws off an error: Undefined Offset: 0 in /wp-includes/query.php This is what my query looks like : <?php $loop = new ...
1
vote
1answer
7k views

How to get current post id of a custom post type in a loop using template singel-{custom type}.php?

I have a custom post type template where am looping through all post. what i am trying is when i go to my custom post page i want to get the current post id in the loop. So i tried to check if the ...
1
vote
1answer
288 views

'category__and' for custom taxonomy?

I've a custom post type 'post-type-x' and three custom taxonomies attached with it 'taxonomy-1', 'taxonomy-2' and 'taxonomy-3'. I want to retrieve all the posts that have custom taxonomies ...
1
vote
1answer
48 views

How can I sort homepage by a meta value?

I am trying to sort my home page posts by a custom meta value. I've been told I should use pre_get_posts but I seem to not be implementing it correctly. This is what I am doing: ...
1
vote
2answers
789 views

WordPress get posts by date without query_posts

I'm want to get posts from the last 30days in a sidebar but I don't want to use query_posts, is there a way to achieve this with the get posts function?
1
vote
1answer
925 views

How to query a custom post type with a taxonomy filter but display post type archive page?

I'm filtering the main query of Jigoshop with my own taxonomy with this hook (The file responsible for Jigoshop queries that I'm hooking, Jigoshop hooks onto WP 'request' filter): add_filter( ...
1
vote
1answer
194 views

How to paginate posts correctly that belong to a particular category and are random ordered

I was interested to read the answer to this question on how to paginate posts correctly that are random ordered. Is it possible to paginate posts correctly that are random ordered? My goal is to ...
1
vote
2answers
914 views

Create dropdown list post

I want to create a drop down list that will list all the posts in the category. I want the drop down list to appear on every post. So for example if I view a post that belongs to category Apples it ...
1
vote
2answers
1k views

Custom posts per page does not work with pagination

I have one page in my template where I would like to set a custom posts_per_page. Here is the code I have used: <?php global $query_string; query_posts($query_string . '&posts_per_page=4'); ...
1
vote
1answer
405 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 ...
1
vote
1answer
37 views

I would like to give special promotion for the first 100 posts in my blog? Can anyone tell me how to do that?

My website is a multi author blog. I would like to give special promotion for the first 100 published posts in my blog? What is the proper way to implement it? I mean should i add some meta value ...
1
vote
1answer
227 views

Custom post types instead of regular post's categories in a page template

So I got this template which originally queried regular WP posts by their categories so that the page would show a category name for "category 1" as a headline and then posts from that category below ...
1
vote
1answer
10k views

How to show related posts by category

In my gallery site i want to show other pictures under the current picture (in single post). I seen more codes but it i asks to specify the category, but i dont want want specify the category manually ...
1
vote
1answer
1k views

WP_Query last five posts, simply ordered by meta_value

I can't believe I'm asking this question. It feels like such a simple method, yet I've poured over the WP pages and dozens of similar questions to no avail, so here it is... I've got a WP_Query with ...
1
vote
1answer
803 views

Wordpress Search Filter Only for Page with Child of Child of Child of Child of Child

after browsing question from this site I found the workaround for this: function SearchFilter($query) { if ($query->is_search) { global $post; $query->set( 'post_parent', 21 ...
1
vote
2answers
3k views

Working with query_posts ( arrays and query strings)

I'm trying to use the search query along with an array of arguments to narrow down search results, but I'm failing horribly. This is what I have so far. $paged = (get_query_var('paged')) ? ...
1
vote
2answers
226 views

Tricky WP Query

I am trying to use wp_query (or another native Wordpress query class) to do the following: get all posts WHERE ( post_type = 'post' AND category = 7 ) OR ( post_type = 'case-studies' AND meta_key = ...
1
vote
1answer
2k views

Wordpress pagination showing same posts on each page

I need to make adjustments to a horribly written WP theme that (a custom theme that was written in tables, and bad code). The theme has several custom templates, but pagination wasn't used and ...
1
vote
1answer
3k views

Wordpress query_posts and orderby page order

I have a page that lists all sub pages of the current page. Each page has been assigned an order number in the wordpress editor but they aren't ordering for some reason. I'm set up like this: ...
1
vote
1answer
470 views

IF.. post meta show… Conditional Tag Help…?

I have the following conditional tag, which a friend helped me with... Currently it works doing.. 1) If a featured image just show that. 2) If images attached show featured image wrapped in a link ...
1
vote
1answer
2k views

tax_query operator woes

I am trying to filter posts by multiple taxonomies. My code below works great, but their is one thing I can't quite figure out. When I filter the posts it seems that they only show the posts that ...
1
vote
1answer
1k views

Custom Post Type sorted by Title

I created a non-hierarchical custom post type and, by default, it's sorted by date published. I know I can reorder them by Title with query_posts() in the archive template: global $query_string; ...
1
vote
2answers
650 views

cannot get multiple loops using tax_query

I am trying to get three loops to display. they all belong to the same post type and the same taxonomy family. but i'm trying to separate the taxonomy by three different values. $argsOwners = array( ...
1
vote
2answers
444 views

Placing post data (title, date, and excerpt) nested in static content

I apologize if this is a newbie question, but I am very new to working with WP template files. I am working on a campaign site (that I unfortunately can't show you before the launch in a couple ...
1
vote
1answer
199 views

previewing my posts on static page?

I am new to WP. What i allready have - I am building a news blog with few posts categories. each category function as a different section (Economics, Sports etc.) What i want to achieve- What i ...
1
vote
2answers
448 views

Exclude newest post from category X but show rest

I would like to show all posts but only exclude the NEWEST post from the 'Featured' category, other posts from this cat should display. Any idea what I should add to the loop to achieve this? I want ...
1
vote
3answers
732 views

WordPress Custom Query

I have posts that use a custom field for start date and end date. query_posts returns an array of posts that exist in the category I'm filtering. How do I query posts using this custom field that has ...
1
vote
1answer
1k views

Order query by meta_value with multiple custom fields

I would like to get ordered all my posts with multiple cutom fields (WordPress 3). Exemple, I've 2 custom couple meta_key/meta_value : " order_submenuexpositions / numeric " " ...
1
vote
2answers
643 views

query_posts() ALWAYS displays something?

OK, I'm using posts_query() to display posts. The problem is, at least in my case, posts_query() always outputs something. For example: <?php $paged = (get_query_var('paged')) ? ...
1
vote
4answers
1k views

Wordpress Posts Out Of Order after 3.1 Update

The first posts I wrote are now showing on the homepage. After Googling, the problem is because I am using query_posts to exclude a certain category on the main loop. <?php ...
1
vote
2answers
4k views

query_posts and only show results if a custom field is not empty

How do I query_posts and only show results if a custom field is not empty or has a value. I want to put in a url in a custom field and only show these pages if there is a url? current code but I ...