A generic term referring to the process of retrieving information from a database.

learn more… | top users | synonyms

0
votes
1answer
268 views

Query specific Pages

I wonder if someone would know how to query specific pages (not by id), lets say I create a custom field called "product", and I would like to query all pages with that custom field. Any Help? Kind ...
0
votes
1answer
178 views

If more than 1 image show post link?

I have an image gallery of sorts its displayed on the page using the following template code... <?php $featured = get_post_meta($post->ID,'_thumbnail_id',true); $attachments = ...
0
votes
1answer
130 views

Form Data Causes “Page Not Found”

If you go to http://redoakchrysler.net/vehicles/new-vehicle-inventory and select 2012 from the drop down menu in the years list, you will be taken to a 'page not found' page. But if you select any ...
0
votes
2answers
398 views

Display latest post from Wordpress Featured Category that is also in X,Y,or Z categories

I want to display the latest post from a "featured" category (id=1) that may also be in either X category, Y category, or Z category (id=2,3,4 respectively). Note, there are other posts in categories ...
4
votes
1answer
781 views

Why does `get_permalink()` produces an add. DB request without $post->filter?

I'm currently working on a custom loop/query where I need to add the permalink of a post to the array of posts I'm retrieving from the DB. Sadly get_permalink() produces one additional DB request ...
0
votes
1answer
929 views

How to query posts by month based on date custom field?

I currently created a custom field for a custom post type that stores a date in the format dd/mm/yyyy is there a way to query the posts by the month? I "kind of" got the functionality I need using ...
1
vote
1answer
163 views

Query the post which have a thumbnail

I've got a highlight section on the header of my website which shows the title and the thumbnail of the last X posts having a thumbnail. Is there any custom query which allows me to retrieve only the ...
0
votes
1answer
2k 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
2answers
292 views

Query posts WITHOUT a custom meta field

I'm trying to build a custom query that will return all posts that DON'T have the associated post meta. I'm not quite sure how to do this...here is what I am working with, and for your reference ...
0
votes
1answer
92 views

querying a custom field

I'm trying to hack a plugin to show the contents of a custom field where its currently showing the title. how would I get this to show a custom field called restaurants instead? Thanks, ...
0
votes
1answer
183 views

Custom query Custom-Post-Types creates error

I created a custom-post-type for members of a firm. On the start-page I tried to call them via custom query but it shows an error. Heres my code: http://pastebin.com/rRzNcqPP and the error says: Call ...
1
vote
2answers
334 views

Query all posts which do not have tags assigned to them

Is there a way to query posts which do not have tags assigned to them? query_posts('tag='tag_exmaple'&posts_per_page=-1'); Ty very much!
0
votes
1answer
123 views

Code in custom widget queries all posts, when it should only query the current post

I have a query in a custom widget (my first one!) which, if it's of custom post type book, retrieves the post ID. This then gets used in a WP_QUERY to retrieve data about the page. This works ...
2
votes
2answers
3k views

view queries made?

I know I can use get_num_queries() for the number of queries. However, how can I see what queries Wordpress actually makes? I've tried using $query but that didn't work.
0
votes
1answer
294 views

Get current taxonomy and display query accordingly

Okay i'm having a bit of a catogorisation/taxonomy/filtering problem here and am at loss on how to solve this. I hope someone could help me on the way a bit. Say I've got a blog about food, with a ...
1
vote
2answers
516 views

Conditional custom field query

I'm working on a job board-type site, and the client want to sell featured posts. They want the featured posts to expire from showing up in the "featured" section after a predetermined period of time, ...
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 ...
1
vote
1answer
2k views

Wordpress 3.2 query_posts and pagination, permalinks issue

My question is not new but it just does not work with all found solutions in my case. I am trying to display recent posts on single post using custom query_posts loop. The permalinks structure must ...
1
vote
1answer
1k views

$wpdb doesn't appear to work on page inside of a plugin

I have a plugin folder foobar. Inside this plugin I have a page called foobar.php. Inside this page I have global $wpdb; $orderby = (!empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : ...
0
votes
1answer
679 views

Add custom post type to query

$saved = $wp_query; query_posts(array('tag__in' => $tag_array, 'showposts' => $args['posts_per_page'])); I need this to query standard posts and a custom post type called "property" I can't ...
1
vote
1answer
151 views

Help with Wordpress Query

I'm sort of a noob when it comes to Wordpess; I've only recently started building themes and I've run into a wall. I'm trying to feature 3 different articles at the top of my site using wpquery and ...
3
votes
2answers
618 views

Sort X categories by last update and show image

I want to display X categories, and sort them by last update. I also want to grab the image of the latest post with the category. <img src="<?php echo ...
1
vote
2answers
1k views

Can't pass table to $wpdb->prepare

I'm having trouble passing a table variable to $wpdb->prepare(); Here is functioning code: $table = $wpdb->get_blog_prefix( $blog_id ) . 'my_table'; $voters = ...
0
votes
1answer
135 views

Prevent duplicate pages from being added

Im using this code to prevent duplicate post from being added but i also need to prevent duplicate pages too. Can Someone please help? function clearDuplicatePosts(){ global $wpdb; $prefix = ...
0
votes
1answer
187 views

Conditional Tag Custom Querys?

I think thats what its called... Basically a conditional statement if there are any posts in a specific custom post type/custom taxonomy, show posts, it not show an img or include whatever…? But ...
0
votes
1answer
630 views

How to display content from external db with relevant urls

I am working on a website that needs to display information about electronic resources which is stored in an external database. This information will be presented three different ways (alphabetical ...
2
votes
1answer
1k views

query multiple taxonomy and show post count

I have custom post type 'Product', and 2 custom taxonomies 'category' and 'product status'. What i am trying to do is list categories in page template and show how many total products in category ...
0
votes
1answer
1k views

Formatting a date/time returned from a custom $wpdb query

I'm definitely a rookie WordPress/PHP developer, so please forgive ignorance :-) Q: How do I format a date/time returned from a custom query against $wpdb? Here's the scenario: I'm trying to write a ...
0
votes
1answer
158 views

Query pulling a single post per month

I am trying to only show a single post per month on a query. I can set the date as a variable and use something like the php array_unique function to check the dates and only echo out unique ones, ...
1
vote
3answers
544 views

I want to create a filter for the query string is this possible?

I have spent the last few days working on and researching this question and have found no solution. Basically I want to replace the query string which wordpress parses in order to query the ...
0
votes
1answer
723 views

Show 10 latest posts only from users with contributors role

How to achive this in sidebar.List of 10 latest permalinks(post titles) from contributors ?
1
vote
3answers
3k views

Display page content AFTER a loop of posts

This is probably easy once you know but I'm having trouble getting the static page content to appear AFTER a list of posts. I'm using a named page template which displays posts as a slider and I want ...
1
vote
1answer
1k 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 ...
0
votes
1answer
2k views

WP_Query with checkbox meta_query - Wordpress [duplicate]

Possible Duplicate: WP_Query with checkbox meta_query Ok, so I have a custom post type and have used the Verve Meta Boxes plugin to create some custom meta values for the post type. The ...
3
votes
3answers
749 views

Fulltext search in posts sorted by relevancy

I'm building a custom search page and what I need is to sort results by relevancy (eg. occurences of a keyword) Using MySQL docs I've built this query: SELECT ID FROM $wpdb->posts WHERE MATCH ...
0
votes
2answers
1k views

How to setup a query to output posts by groups of five?

I'd like to have a query that returns posts grouped five by five. Right now I have a simple query loop like this one : <?php if( $query->have_posts() ) : ?> <ul class="posts"> ...
0
votes
1answer
631 views

Trying to exclude custom posts based on date, while sorting by custom field

I have a custom post type named "performance". I have a custom post query that orders posts by a custom field value (order-date). Now I want to exclude posts that have order-dates that are in the ...
0
votes
1answer
153 views

making an index from custom taxonomies and tags of posts (not hierarchical taxonomy)

i have attached custom taxonomies to posts. now i'm looking for the best way, architecturally speaking, for automatically creating list that would look like this: energy (32): how to build a solar ...
0
votes
1answer
3k views

How to count post type that has a particular term?

What is the best method to count the number of posts in a post type that have a particular term? I don't believe get_posts accepts a term query and I have had no luck with new WP_Query, though I might ...
0
votes
1answer
420 views

Wordpress, custom post type and posts query help!

I have a homepage witch i am trying to query a custom post type as well as everything from the default posts, right now i have 2 loops running everything looks good except i want the 2 different ...
7
votes
3answers
677 views

Order posts (across the whole site) by metadata date

My custom 'Home' page is set to sort my custom posts via the custom date field with this (updated to be custom named) code in functions.php: // sort order for home page add_action('wp', ...
3
votes
2answers
276 views

Identify which loop you are hooking into; primary or secondary?

What is the most efficient way to determine which loop I'm in? I have a few plugins that alter the query by hooking into various parts of WP_Query::get_posts(), through the usual suspects, ie ...
2
votes
1answer
925 views

orphaned taxonomy terms remove by sql query

I have 3 custom post types each of these CPT's have posts that are set to auto delete via a given time scale by cron jobs, thing is when they are deleted it leaves behind orphaned taxonomy terms in ...
1
vote
1answer
507 views

Help with wordpress custom query and advanced custom fields plugin

first of all sorry for my bad english. Let me explain what I`m trying to do: I have a column inside a SQL table with a string using the following format: yy-mm-dd The thing is, it doesn`t use a ...
0
votes
1answer
1k views

Filter all queries with a specific taxonomy

Is there any way to filter all post queries and add a specific taxonomy? Case in point, I have a taxonomy object of "Region" with terms like "Global", "Americas", "Europe", etc. (Users designate ...
0
votes
1answer
129 views

How can I query for all values of a custom taxonomies?

Suppose I have a Custom Taxonomy "Fruits". I want to query for all the values available eg. Oranges, Apples, Mangos etc. How can I do that?
0
votes
1answer
106 views

db query for retrieving comments without any reply

what is a query for selecting a list of comment id's that have not had a reply yet so I can use it to iterate though each comment id and echo out the post it is on and the excerpt of the comment along ...
0
votes
2answers
1k views

Different Main Navigation per category

I have a client who has the categories listed in the right-hand sidebar. He came to me today requesting a different "navigation" in the header for each category. So basically, if you click on ...
1
vote
1answer
183 views

Most effective use of DB querys

I've got a custom database table with lots of data that I'd like to query several times from a custom template file I've built. Say the db table looks like this: id name city zip 23 ...
0
votes
1answer
165 views

Cache DB queries result

On my new site i am displaying most of the images instead of text. I show images for recently written, recently viewed, mostly viewed posts etc. I found that in 40% of cases posts are same. so i need ...