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
1answer
239 views

Query posts in a category and include only one post per author?

I'm attempting to list posts from a category (a random selection). However, I only want to display one post per author. Thoughts? Appreciate the help.
0
votes
1answer
294 views

2 loops, is_home won't work, count is off

Alright, I've made a bunch of themes over the years, and I've written a lot of queries. And I just realized that I apparently have no clue how to get multiple queries to behave. So, here is the loops ...
0
votes
1answer
83 views

Querying a query

Let's say I have a query stored in a array. I want to parse this array, find the first posts inside this array that match a certain value from a certain key, and so extract the whole post. Is there ...
1
vote
0answers
181 views

Tough Custom query: archive page with custom meta_value_num [closed]

I trying to add parameters to the query string of an archive page. So I verified that the following method works: query_posts($query_string . ...
0
votes
2answers
812 views

How to query blogs posts of WordPress sub domain?

I am using WordPress 3.2.1 multi-user. I need to show posts from a specific sub domain in my home page, for example: http://mysite.com/sub-blog. I need to show posts from sub-blog in my home page. Is ...
0
votes
2answers
782 views

query_posts and sub pages?

I have a Page layout like this Parent Page - Sub page 1 -- sub sub 1 -- sub sub 2 -- sub sub 4 - Sub page 2 -- sub sub 1 -- sub sub 2 -- sub sub 4 I want to query every single child page, ...
1
vote
1answer
672 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
1answer
1k views

how to exclude “featured” posts from the main loop?

In a category.php template, I built a function that lists "featured" posts before the main loop. The featured posts are selected using a custom field and get_posts(): function ...
1
vote
1answer
267 views

Search breaks when querying main loop for category

In my theme I provide an option for users to set a 'blog category' that queries and displays only posts from that category on index.php using WP_Query: $shortname = get_option('of_shortname'); ...
1
vote
2answers
2k 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
1answer
424 views

Query_post($args)

it is possible to use a array by the this query? This Version doesnt work: $args = array( 'order' => 'ASC', 'meta_key => array('city_1','city_2), 'meta_value' => ...
1
vote
1answer
922 views

how to query posts and auto assign category if post title has keyword

how can i query posts by current date and auto assign category based on keyword found on post title, something like if title contains 'oranges' auto assign it 'oranges' category maybe something like ...
0
votes
1answer
1k views

query posts with custom field meta value

<?php query_posts( array( 'showposts' => -1, 'post_parent' => $post->ID, 'post_type' => 'page', 'orderby' => ...
0
votes
1answer
1k views

Problem with 'post__not_in'

I am running a custom query below each post, to get other post from its category. Now I want to exclude the current post. This is my Query: <?php // related_posts(); $exclude_post = ...
0
votes
1answer
171 views

Can't get pagination to work for sticky posts only

I don't get my pagination to work. I need to filter my posts on sticky posts and display only two per page. Tried almost everything but can't get it to work. It is totally ignoring my posts_per_page ...
1
vote
2answers
220 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 = ...
0
votes
1answer
91 views

How to refine WP-Query with further criteria

I have a WP-Query which I pass post IDs to via 'post__in' => explode(',', $my_ids) I then want the ability to refine this list by a custom field value (if present). I have tried including the ...
1
vote
1answer
6k views

Wordpress pagination with get_posts?

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 ...
0
votes
2answers
90 views

Post Title displaying but not in the wrapped HTML I need

I have a custom query to get the post title, permalink, and featured image. However the Post title is displaying but not in the container I want it in. here is the query <ul ...
1
vote
1answer
1k 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 ...
0
votes
2answers
151 views

Best Query for blog posts

I am not getting any headway in this one problem I have a separate homepage from the normal blog page. However the site needs a blog so How do I structure a query that will display something like the ...
1
vote
2answers
483 views

How do I call posts with a certain tag?

I use this to call posts: <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $per_page = get_option('to_count_archives'); ...
3
votes
4answers
6k views

Query posts by custom taxonomy ID

I have a custom post type called portfolio and a custom taxonomy called build-type (acting as categories) I am trying to query portfolio posts by build-type ID e.g. all Portfolio posts in "Hotels" ...
0
votes
1answer
106 views

Query Posts Creates 404 Error

When I'm on archives pages I am using the code below to query posts. In my theme options to_count_home calls the number of posts. WordPress isn't generating the correct number of pages based on ...
1
vote
1answer
685 views

Authors List page - How to include only those with wp_user_level as Author

At my Authors template page, I want to show a complete list of Authors only (i.e. wp_user_level=2) the code I used is like this: $current = (intval(get_query_var('paged'))) ? ...
0
votes
2answers
4k views

Sort posts alphabetically by category/custom taxonomy, insert divider between different types

first of all I'd like to thank you for all the great work you're doing. I've found a lot of useful infos and tricks taking a look around in Wordpress Answers. Well, I'm here to ask so that's my ...
1
vote
1answer
433 views

Authors List page : how to exclude posts from certain category

I have a magazine wordpress site in which I have designed a separate page to show all the authors with their nice_names (with URI) and no. of posts. the code is like this: $current = ...
0
votes
2answers
465 views

Query all posts under one taxonomy? Why is my code not working?

I'm trying to show all the posts associated with a Taxonomy (not a term) but it seems to not work. <?php $args = array( 'post_type' => 'projects', 'tax_query' => array( ...
0
votes
1answer
665 views

Query pages by category

Trying to query pages based on the category they are associated with. I am passing in the cat_ID, but it doesn't seem to be working. Always returns a single post with the title "Hello World" while ...
0
votes
1answer
2k views

Filter Loop by Custom Field Value

I'm trying to filter a loop by a custom field value. I've tried all of the suggestions on the site, but it just won't filter. This loop is being used for a custom template of an rss feed. It pulls ...
0
votes
1answer
115 views

Most Effective Method? Exclude Category and Number of Posts Per Page

I want to create a loop that excludes a category and only displays a certain number of posts per page. I have tried both have_posts and query_posts to do this, but I'm a bit stuck on the most ...
1
vote
1answer
2k 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: ...
0
votes
1answer
2k views

How to create an attachments archive with working pagination?

This might sound like query_posts with pagination problem number 2103024 but I think this one might be special. My WordPress site is basically a huge database of car images. Each image should have ...
-1
votes
1answer
271 views

Integrating custom API for post content into Admin interface & Public Website [closed]

EDITED question to be more specific and added bounty in hopes someone has a solid coded solution: So, here is an interesting task I have been trying to find a solution for. I have added a bounty ...
1
vote
3answers
7k views

How to set posts per page using WP_Query()

I'm trying to set the number of posts_per_page dynamically using my own variable. This code works fine: query_posts( $query_string . "&posts_per_page=" . $myvar ) // then display the loop using ...
-1
votes
2answers
187 views

Lots of SQL queries

I have a site with more than 300,000 posts (but really little posts) and cheking why is going so slow I've seen that in the hompage it makes something like this: "Generated in 15.024 seconds. Made ...
1
vote
1answer
441 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 ...
0
votes
1answer
149 views

How do I query based on the modified date?

I would like to list posts by the "modified" date not the published date. Is there a way to do this? $documents = array('posts_per_page' => 10, 'post_type' => 'documents',); ...
0
votes
1answer
785 views

Change or update WordPress loop based on dropdown selection

I have a Contact Us page which is showing 9 locations on the sidebar by querying the custom post type "Distributors." I want the user to be able to use a drop down that is populated by the taxonomy ...
0
votes
2answers
2k views

Show posts from category specified using a custom field

I have a post that shows the titles and excerpts from a specific category underneath the content. Currently this is coded into a specific template like this: <?php ...
0
votes
1answer
131 views

Problem with writting correctly a query posts args in Wordpress

In my posts custom fields, I have a meta_key named ending. The value of it is a date in the form of 30-11-2011 (dd-mm-yyyy). I tried this below but with no luck. ...
0
votes
3answers
47 views

Not displaying any articles on a custom made file

I have created the file latest.php in the public_html so that when I go to www.domain.com/latest.php it will show me the latest articles. Sadly, nothing of the posts came up. Later, I will sort them ...
1
vote
1answer
1k 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 ...
0
votes
2answers
1k views

Order by & include array by specific post ids

I have the following: <?php $num_cols = 2; // set the number of columns here $args = array( 'post_type' => 'testimonials', ...
0
votes
1answer
46 views

odd behaviours from template tags

Some of my template tags are playing up, and they have left me confused. On one site, that has been live for over a year without any of these issues, on all the pages that have custom query loops, ...
0
votes
1answer
869 views

Get the ID of the latest post

Been all over looking for the best way to do this. I want to get the ID of the latest post of a certain post_type. How can I do this in the cheapest way possible (by cheapest I mean using the least ...
0
votes
1answer
352 views

Having an issue doing a WP_Query with post_content and category__and

This is the array for my arguments for the WP_Query. Array ( [showposts] => 4 [paged] => 1 [post_type] => post [post_content] => tree [category__and] => Array ...
0
votes
1answer
272 views

How do I query multiple specific posts from a custom taxonomy?

WordPress 3.2.1. I want to query several specific posts that are part of a custom taxonomy. This is what my query looks like for retrieving one post, using the id for that post. $args = array( ...
-1
votes
1answer
139 views

Query not returning CPT posts

Ouch, banging my head against a wall! I am trying to query my post type 'clips' in index.php but it's returning only posts from the default 'post'. I need some insight! What am I doing wrong? My ...
0
votes
1answer
56 views

query_post problem

I am running query_post with the following arguments, <?php $args = array( 'category' => $cat, 'orderby' => 'post_date', 'order' => 'DESC', 'post_type' ...