Check if your post_type is exactly listings
and not listing
. Also check this approach:
<?php
function filter_where( $where="" ) {
$where .= " AND post_date > '2009-03-01'";
return $where;
}
add_filter( 'posts_where', 'filter_where' );
function parse_wp_query( $query ) {
$query->set( 'post_type', array( 'listings' ) );
return $query;
}
add_filter( 'parse_query', 'parse_wp_query' );
$posts = query_posts( 'posts_per_page=-1&post_type=listings' );
remove_filter( 'posts_where', 'filter_where' );
remove_filter( 'parse_query', 'parse_wp_query' );
echo '<ol>';
foreach ($posts as $post) {
echo '<li>' . get_the_title() . '</li>';
}
echo '</ol>';
?>
Related Posts:
- query_posts doesnt show pages with given ID when post_type => page
- query_post by title?
- Why query_posts() isn’t marked as deprecated?
- how to query posts by category and tag?
- How do I query by post format in WordPress 3.1
- How to set posts per page using WP_Query()
- How do I create a random post that will last for a day
- Modify main WordPress loop with a parse_query filter
- Problem with ‘post__not_in’
- Custom Post Type “Event”: chronological list of recurring events
- Order by meta value, pro first, then free
- Having trouble generating pagination links on custom query
- How to create an attachments archive with working pagination?
- query_posts and pagination, still stuck after much research
- Query posts by taxonomy term name
- Sorting problem with ‘query_posts’ funcion in wordpress. Sort by custom field not working
- how could I get the pagination as I want to when query posts using get_posts function
- Counter code for paginated category pages in wordpress
- Author List page: Exclude based on last post date
- Replace query_posts with pre_get_posts
- query_posts sort in multiple directions
- Filter query_posts by tag slug on “Tag Archive” page (when tag is 2 or more words)
- Warning: urlencode() expects parameter 1 to be string, array given in and not getting the preffered output
- Show Posts From Same Category OR Same Tag
- Example Query Posts Showing the Latest Post with the Featured Image
- Using database meta_values to calculate new post order using pre_get_posts or a ‘request’ hook
- exclude ids through post__not_in
- Different number of posts on the front page
- Query posts without a specific ID
- Integrating post archive wtih another source and preserving date ordering
- Show individual author rank from query of cumulative post view count for all authors
- Multiple post type queries (with specific arguments for each)
- Order posts using a custom array
- WordPress query_posts and orderby page order
- IF.. post meta show… Conditional Tag Help…?
- How do I correctly get all posts within the last year using the query_posts function?
- Show Only Posts Owned By Logged In User + my post
- How to filter query to display posts from parent category only?
- Custom MySQL Query with logic
- child of post type (custom)
- Display random post on a page with post permalink in URL
- order posts by meta value on posts page
- Query_post($args)
- Get post and all posts after it by ID?
- trouble with query to fetch next and previous posts
- How do I make query use exact post title
- WordPress tax_query not showing private posts
- WordPress /page/2 not working
- Simple custom post query for all the posts or many of them not working
- Hook to return true when the_post() is used in a custom while loop
- My post repeats itself on the second page [closed]
- How to remove a plugin filter’s priority on specific loops (custom queries)?
- Proper syntax to add boolean in array()
- get_the_title outputs title until spacing; it does not get full length of title
- using query_posts to pull posts out of a category in a while loop. Getting odd echo
- Echo a numerical value in query_posts
- why to use query_posts() in custom page?
- Query posts to get all but the most recent post
- Always using the same ARRAY on different querys
- Display trimmed version of the_post()
- How to show the number of each post has been read in a while loop?
- Modify loop but keep the original query, what am I doing wrong?
- Post per page not working if no category specified
- How do I use pagination in WordPress?
- Does WordPress run a post query when a page is invoked?
- How exclude 3 latest posts of a category in query_posts
- Multiple posts/pages in one page?
- query_posts orderby multiple ways
- Pagination linking to first page
- Weird problem on if statement
- How to check a list or feed of all posts under a category and tag?
- Issue with sidebar widgets not showing when I do custom queries
- query_posts call sets is_home() to true
- show all in query_posts on category.php?
- Query Posts Incorrectly Displaying Tags Archives
- Best Query for blog posts
- Most Effective Method? Exclude Category and Number of Posts Per Page
- Script that gets the first tag of post and query all other posts with the same tag
- Trouble highlighting correct menu parent with wp_nav_menu classes while viewing “single posts”
- Custom query looking at multiple custom fields and properly sorting
- Latest 5 post excerpts from 5 different authors in Sidebar
- post var problem with shortcode loop
- Pre-existing arguments when using queries
- Help with query_posts function
- Get posts for each user
- Pull new posts using feed
- query_posts() with multiple meta data comparisons
- query_posts not working after wordpress 3.7 update
- get_next_posts_link() stops displaying at page 4
- Multiple post queries -category,posts per page,orderby
- Is that the query_posts() the real criminal here?
- How to can I search range of products using between
- query_posts and sub pages?
- How to refine WP-Query with further criteria
- Query Posts (post meta)
- Including post data in a sidebar occurring outside of and before the Loop
- get all posts with certain meta data
- prevent display duplicate titles on main page
- How do I find the first item in the post array?
- Quering array of post types & pagination. Articles are repeating sometimes on different pages