Linked Questions

1
vote
1answer
160 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
2answers
851 views

WP_Query or get_posts?

When using the 'fields' => 'ids' parameter, is it better to create a new WP_Query in the code below rather than doing get_posts? How would the loop look if I used WP_Query? function ...
1
vote
1answer
187 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
7k views

How to get posts published between a date and today?

Is it a way to get posts published between a date and today with query_posts() ? Example : All posts published since 2012-04-01 Thanks EDIT : How to add the filter date on this Query Posts ? ...
1
vote
1answer
2k views

How to display related posts from same category?

Is it possible to display related posts from same category as the current post?
1
vote
1answer
360 views

Get random posts between specific dates / of specific age

I need to get post IDs from a custom post type randomly and the posts are posted within 30 days. But I can't really find a solution. How can I do it? This is my query. ...
1
vote
1answer
175 views

Loop after page content

I just upgraded to 3.4.2 from 2.9 (i know, i know, but if it ain't broke...) I have page templates that are (or at least were) set up to display the page content first, then start a loop of posts, ...
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
44 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
165 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
358 views

Tabbed content with Pagination

I've stumble across an issue on a site Im building. I have tabbed content each holding a category for price ranges in seprate loops. The tabs work great filtering the categories, however some of the ...
1
vote
2answers
131 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
181 views

category.php displays ALL posts instead of just those with the current category

I'm simply trying to display a list of categorised posts (with the custom post type of 'project') on the default category.php page. I can't get it to work! If I simply use the base theme category.php ...
1
vote
2answers
485 views

sticky post in custom loop

I have a problem with showing sticky posts in a custom loop. This is the code I'm using to for the custom loop: <?php $post_from_cat_a = new WP_Query(array( 'category_name' => ...
1
vote
2answers
112 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 ...

15 30 50 per page