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

Query posts by category AND custom field, then ORDERBY another custom field - help!

OK I need to query posts using the following criteria: category_name=office, meta_key=featured_post, meta_value=Yes and order these results using a second custom field which has a numerical value ...
1
vote
1answer
1k views

Trouble with get_next_post() get_previous_post() returning null

I'm using wp as an engine to put blog features in an existing site. I have a place in the blog page where I load wp-load.php. I want to get the next and previous posts, but when I load a post from ...
1
vote
1answer
693 views

How can i display the posts per week in a particular month?

I have to display the posts as the following September 2010 Friday September 24, 2010 post1 post2 . . . Friday September 17, 2010 post1 post2 . . . Friday September 10, 2010 post1 post2 . . . ...
1
vote
1answer
31 views

Order posts by condition

I need to get 15 posts. If there are any with a tag featured, I want them to be first. If there are none, I want the rest to be random posts. My idea was to sort posts based on a condition ...
1
vote
1answer
25 views

Inserting custom data to the_post() during loop

I have some posts on my WordPress site, and let's say I want to add a random number for each post with $num as key and random() as value. Then I want to access them with something like: $post->num ...
1
vote
1answer
106 views

WP query exclude post within the last month / only show over 1 month old

I need to create a landing page which only shows posts that are at least a month old. Everything I've read / tried with the date query so far seems aimed at including posts between the last month ...
1
vote
1answer
66 views

How to query_post custom posts within default taxonomy?

I'm trying to query_post custom posts. It works very good with custom taxonomy, but not with default "category" taxonomy. I tried using "category_name" and "tax_query", but it doesn't work for me. ...
1
vote
1answer
230 views

Wordpress Custom Query to show posts from last x years

I have found a way to show all posts from the current year with this code: <?php $today = getdate(); $lastyear = $today[ 'year' ]; $args = array( //'nopaging' => true, 'paged' => ...
1
vote
1answer
96 views

Get posts between custom dates

I created an event CPT and a meta box with a date. I saved the date as post_meta in the form dd.mm.yyyy. Now I want to create a shortcode that queries all posts which's dates meet the condition ...
1
vote
2answers
133 views

Trying to find a way to query post like normal search would do. within search.php page

I have a costume search in a site i am making. When a user search a certain term, i want to display category list with a count of how many posts are found with in that category. I thought of a way ...
1
vote
1answer
737 views

Using loop pagination on single.php

I want the main front-page loop to show in a section on both index.php AND single.php templates, with pagination. Pagination works fine on the homepage, but not on single posts. This is the code ...
1
vote
1answer
196 views

using post__in allow duplicate post id

I have an array of ids in a specific order. I use post__in in my query to get posts from this array. I have some duplicate post IDs that I need to show twice in the page but the query seems to ignore ...
1
vote
1answer
230 views

Custom MySQL Query with logic

I have wp e-commerce plugin installed and custom building custom global search My query looks like this SELECT * FROM aka_v_posts LEFT JOIN aka_v_postmeta ON aka_v_posts.ID=aka_v_postmeta.post_id ...
1
vote
1answer
41 views

child of post type (custom)

I registered a custom post type (foo) with register_post_type, setting 'hierarchical' => true,so now when I want to use it I have post_type=foo. How can I query child of foo? any ideas? thanks!
1
vote
1answer
785 views

query_posts and custom taxonomy posts order

i have a custom taxonomy defined for "Projects" and a page that shows all the projects. In this page there's a jquery filtering menu (isotope). Initially the page must show all the projects but ...
1
vote
1answer
3k views

Filtering custom taxonomies

This is a cross post from the WordPress forums, which I apologize for, but it has been almost a week and not getting any response there so hoping someone here can help. If I do get a reply in either ...
1
vote
1answer
352 views

order post my meta value m/d/y format with year as included value

current order: 01/01/2013 12/07/2012 12/08/2012 . . . . 12/31/2012 ------------- 01/01/2013 should appear last My code: $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1; $today = ...
1
vote
2answers
341 views

Query Posts Exclude Entire Category

I am using the standard wordpress loop that looks like: <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <h2><?php the_title(); ?></h2> ...
1
vote
2answers
310 views

Page template with different page and post content

I am using a wordpress theme which has a page template named roomtypes. I am not a php pro but as far as I understand this template gets the posts. When I add a Room type, it is created as a post with ...
1
vote
1answer
416 views

How to use custom taxonomies to reference complex relationships?

I'm working on a site that will in part house information on products that many people have worked on in different roles. I'd like for people, the projects they've worked on, and their roles in the ...
1
vote
1answer
135 views

Show 1 post and after a specific date show the next one

I used the following query to have only 1 post published on the homepage from a particular category: <?php if ( have_posts() ) : ?> <?php ...
1
vote
1answer
326 views

Author List page: Exclude based on last post date

I have a Author page that I built using this code and it works fine. However, I have several writers that range from frequent to one-time writers. I would like to seperate out writers that have not ...
1
vote
1answer
451 views

is there a way to show the the post title after the image?

Trying to show the post title after the image in the main blog page and single page, I have tried to edit the content.php but unable to achive the result I need, which is basiscally IMAGE TITLE META ...
1
vote
1answer
174 views

Logged in user ID as post ID

Is there a way to automatically insert the current user ID as the post category name or maybe have WordPress display only the post with a category name that matches the current logged user ID? ...
1
vote
1answer
915 views

search query within custom taxonomy term, post title and meta field

I want to create a search that does: Search within my custom taxonomy - custom-tags search the post title search select meta field ?? dont know search with custom post type - easy part I looked ...
1
vote
3answers
2k views

Query posts by taxonomy term name

I would love to get the list of posts by their custom taxonomy (=store) name. Here is what I have so far, but it is not working. Please help with the code. $mystorename is a variable holding the ...
1
vote
1answer
2k views

How to order posts by slug using query_posts/ Wp_query

I want to display posts sorted by slug on a page. Is it possible to order posts by slug using query_posts or Wp_query?
1
vote
1answer
218 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
210 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 ...
1
vote
2answers
115 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 ...
1
vote
1answer
242 views

Displaying terms based on loop posts?

I have a shortcode that shows a loop for a custom post type: while ( $loop->have_posts() ) : $loop->the_post(); // do something endwhile; Some of the posts are in categories ...
1
vote
1answer
200 views

Get latest 3 posts from multiple CPT in one query

I'm looking to create a site wide feed on my site and have multiple custom post types. I'd like to display say 3 posts from at least 3 different post types. I can get the latest 10 posts across each ...
1
vote
2answers
1k views

Using Query Posts With Multiple Post Types And A Taxonomy

I am developing a site that has two different custom post types; one of them is called Articles and one is called Sketchpad. Sketchpad is user submitted content that is assigned a custom taxonomy term ...
1
vote
1answer
455 views

Possible to display posts containing a short code ?

i have some posts with a certain shortcode in them. unfortunately these posts are in different categories and contain different tags so i am not able to query them. is it possible that i run a query ...
1
vote
1answer
264 views

Display all posts that were published before full post on single.php

The way I would like my blog to work is a user clicks on a post that was published on 12th March 2012 (for example) they get taken to single.php where the content of that post is displayed as normal. ...
1
vote
1answer
167 views

get custom post type

I am using this code to get custom posts in rows. <?php query_posts('posts_per_page=72&cat=' . $cat . '&order=ASC'); $columns = 5; $increment = 0; ?> <table class="cat"> ...
1
vote
1answer
239 views

Category Foreach keeps looping?

I'm using the following code to acquire all the child categories of a category and displaying the child posts of the child categories. <?php $cats = get_categories( 'child_of='.get_query_var( ...
1
vote
1answer
639 views

How to make “sticky” pages (and query by them)

I have query_posts() with page_type set as 'page'. Is there any way I can make certain pages appear higher and thus, make them sticky?
1
vote
3answers
4k views

Number of posts per page setting is not working?

OK, here's my prob. I have static homepage and a separate posts page on my wordpress site. I have defined the two in the admin panel. Now, I have also set the max number of posts to be displayed to ...
1
vote
1answer
2k views

Sort query_posts for Parent Pages to menue order or the count?

thanks to a member here i display my Parent Pages in a 2 column grid with title and excerpt. But for some reason i can't figure out how to sort all 5 Pages by the menu order for example or the order ...
1
vote
1answer
777 views

Custom Query num_rows returns wrong amount

So I have a custom query that fetches all posts in a given category. I am trying to get the number of rows returned but it is giving me the wrong number. Instead of 11, I am getting 14. Does anyone ...
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
325 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
1answer
452 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
1k 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 ...
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 ...
1
vote
2answers
567 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'); ...
1
vote
1answer
743 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'))) ? ...
1
vote
1answer
464 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 = ...
1
vote
1answer
1k views

Using ajax with paging and a custom sub-query

I have a page that uses three queries to retrieve a variety of content. One of those queries grabs posts that are related to the topic of the page. Since these posts can be of all sorts and related ...