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
3answers
1k 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
1k 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
203 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
185 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
105 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
219 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
185 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
841 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
388 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
240 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
161 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
223 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
6k 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
533 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
2answers
3k 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
1k 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
660 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
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
266 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
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 ...
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
482 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
684 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
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 = ...
1
vote
1answer
901 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 ...
1
vote
1answer
698 views

How to limit search to first letter of title?

I was wondering if there was a way to make the search only look for the first letter in the posts title, basically let's say my search query is www.mysite.com/?s=q I'd like to get all posts that start ...
1
vote
2answers
1k views

Conditional Query of Custom Post Type and custom taxonomy

I am working on a project that has a custom post type called 'Experience Statement' Custom Taxonomy attached to that post type called 'Expertise' 6 different terms for the custom taxonomy: Coastal, ...
1
vote
3answers
433 views

will post_id ever change? Can I safely use post_id for custom queries?

What are the best practices for using post_id? Can I use this safely in my templates to call specific posts, or will these post_id's ever change? The reason I ask is that randomly today the ...
1
vote
2answers
328 views

Get post and all posts after it by ID?

Maybe this is super obvious and staring me in the face, but I'm stumped. Is there a way to pull and sort posts by ID? I'd like to grab an arbitrary post, and then x number of posts after it. ...
1
vote
1answer
568 views

sort posts by alphabetic plugin suggestion

I am looking for plugin to sort posts by alphabetic orders. Sort: A-Z Z-A Newest Oldest and option to view per page like in stake exchange websites Per Page: 20 40 60 All if not exists, can i ...
1
vote
1answer
1k views

Function to show random posts from a category

Hi to all I'm trying to create a function that can ECHO the excerpt of a random post from a choosen category. What I did up to now is: <?php function $titoloslide() = { ...
1
vote
1answer
1k views

How to select posts from multiple categories and metavalues?

I need to select posts who are in multiple categories and have certain post metavalue. I can select multiple categories with query_posts( array( 'category__and' => array(1,2,3) ) ); But also I ...
1
vote
1answer
112 views

Filter custom posts with / without comments

I need to display (for pages that use a particular page template) a list of custom post type objects filtered into 2 sets - those with comments, and those without comments. Each of these sets should ...
1
vote
1answer
853 views

Modify Wordpress SQL Query to pull from within a category

I am using a wordpress plugin called "kf most read" which stores a count of how many times a post was read, and lets you output a list of most read posts. This works well. The issue is, I am trying ...
1
vote
1answer
704 views

query_posts() on key's value, or key's existence

I recently started using simple fields on a project to differentiate between types of posts. All posts from now on will have one of four possible meta values associated with this (Story, Article, ...
1
vote
2answers
262 views

quey posts from different categories with taxonomy

I wonder if someone could help me. I just upgrade my wordpress and start to use taxonomy. what I want to do is to query posts from different categories. I used to do it like this ...
1
vote
1answer
805 views

list child page items (1 level with meta keys)

I need to have a index page and it can pull out the title (with link), meta key description and meta key image (meta keys from custom fields) of its child pages, but only one level down. e.g. I have ...
1
vote
1answer
2k views

meta_compare seems to be treating values as strings instead of integers as expected

Trying to use meta_compare as suggested in the codex: query_posts('meta_key=miles&meta_compare=<=&meta_value=22'); Here is my code: global $wp_query; query_posts( array_merge( ...
1
vote
1answer
438 views

trouble with query to fetch next and previous posts

I'm new to wordpress. I'm having trouble with a query I wrote to fetch the previous and next posts. ( I check $sql = " SELECT * FROM wp_posts WHERE post_date < ( SELECT post_date FROM wp_posts ...
1
vote
1answer
27 views

get_the_title($postID) OR get_the_title()?

I would like to know which could be more performant between these two approaches of getting data of a post To use a loop after a WP_Query($aConditions) and use functions like get_the_title() ... and ...
1
vote
1answer
14 views

How to display posts by vote count and if no value continue with latest posts with no votes?

Maybe someone can help me with this. I want to display posts by votes. Users can only vote up. So what I want is - the most voted posts by vote count on top and then latest posts with no votes. The ...
1
vote
2answers
34 views

Different Ways to Query Custom Post Types?

I'm using this code to use custom post types like regular post: add_action( 'pre_get_posts', 'add_my_post_types_to_query' ); function add_my_post_types_to_query( $query ) { if ( is_home() && ...
1
vote
1answer
28 views

How To Get Posts With A Specific Word

How to retrieve posts with a specific word in the loop. For example, I want to retrieve all posts with the title of the profile post (custom post type): ...
1
vote
1answer
21 views

Query a WordPress page by its title (which has a parent page)

I have created a wordpress query which takes the entire content from 1 particular page using the its title So far i have the following: <?php query_posts('pagename=features'); if (have_posts()) : ...
1
vote
1answer
33 views

What is the difference between “manage_{$post_type}_posts_columns” and “manage_edit-{$post_type}_columns”?

What is the difference between manage_{$post_type}_posts_columns and manage_edit-{$post_type}_columns? Could somebody explain what is the difference between these two approaches?
1
vote
1answer
265 views

How do I create my own nested meta_query using posts_where / posts_join?

Some of my posts (not all) have a price as a meta key/value. Today I use the pre_get_posts action so that my users can search for prices that are between a certain value. This is the code that I'm ...
1
vote
0answers
61 views

BBPress Search results in Wordpress search

I want to display in Wordpress search results page - 10 or less found results from BBPress (plugin) forums. I know that BBPress use custom post types (forum, topic, reply) but I don't know how to do ...
1
vote
1answer
107 views

Adding conditional content to single post-type template

I have a new custom post type set up that will be where an online copy of our email newsletter lives, like any web-based archive of newsletters. I am trying to create a conditional statement to add ...