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

learn more… | top users | synonyms

0
votes
1answer
124 views

Allow admin to determine the order of queries?

I have a custom query that I created to display the team members of a company, but my client has asked whether they can have control over the order in which each team member is displayed. Is this ...
0
votes
2answers
4k views

How do I create a meta box for dates?

I am creating a custom events page and I want to know how to create a custom meta box to save event dates. I don't want it to be a regular meta box because I will be using this to make a custom search ...
0
votes
1answer
1k views

pagination in author.php template returns 404 error

Hi to the community!!! I need some help with pagination in author.php template. I have pagination working in all my loops except in authors.php that i get a 404 error. In my settings/reading i have ...
0
votes
1answer
651 views

Display upcoming events in the next 30 days by querying posts with timestamp in custom meta

I have a custom post type "event" which stores a custom meta as a timestamp ($event_date). The date is always in a dd-mm-yyyy format, so I can generate a unix timestamp from this key. The timestamp ...
12
votes
6answers
21k views

Wp get all the sub pages of the parent using wp query

Here is my code $my_wp_query = new WP_Query(); $all_wp_pages = $my_wp_query->query(array('post_type' => 'page','post_parent'=>$parid,'orderby'=>'title','order'=>'ASC' )); It displays ...
0
votes
1answer
1k views

Changing WordPress sort order for returned child pages

I have a custom WP_Query that looks like this: $this_page_id=$wp_query->post->ID; $images = new WP_Query( array( 'post_type' => 'menu-item', 'post_parent' => $this_page_id ) ); My ...
1
vote
2answers
9k views

How do I search events between two set dates inside WP?

I am building a WP site with an events feature. The events page was made with custom post types. I want to make it possible for people to search/ filter events by dates. For example, they can search ...
3
votes
1answer
344 views

Multipart/formatted MySQL query problem

I'm creating a plugin and I want to automate the creation of a MySQL Trigger on a table. The problem seems to be that $wpdb->query doesn't appear to accept either multipart statements and/or formatted ...
1
vote
1answer
1k 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 display posts under a specific subcategory of a given category

after a long search online I have decided to post my problem here in the hope of getting a solution to this issue. Well, I have a custom post with various categories (novels, books, magazines etc..) ...
0
votes
1answer
129 views

Wordpress search results

I have installed Job Manager and managed to filter the search to only display jobs (i.e. post_type = jobman_job) and it works ok however, when displaying the search results, it only shows the title - ...
3
votes
3answers
9k views

Using nextGen Gallery.. how can I call a list of all Gallery Names?

I'm trying to make a nav to access all the different galleries on a single page. Instead of hard-coding all their names out. I was curious if it was possible to make this dynamic and just call all ...
0
votes
2answers
725 views

Display posts between two particular dates

I have this code for display posts between two particular dates: $s = '2011-10-23'; $e = '2011-11-17'; function filter_where($where = '') { $where .= ' AND post_date >= $s AND post_date ...
2
votes
2answers
6k views

get post id using the $query_vars variable

How can I get the ID of a post (or page) based on the $query_vars variable? I want to do something like $query_vars['post_id'] But I don't have a reference page that has the list of $query_vars ...
0
votes
1answer
356 views

Anyone know a php snippet for showing the first 200 characters of the most recent post?

I wish I knew PHP as well as I do Rails. I'd imagine this is fairly intuitive. Thanks!
1
vote
1answer
4k views

Nginx rewrite rules

I am having some problems with the Nginx rewrite algorithm for WordPress. I am using this for the rewrite and it works good; server_name www.domain.com domain.com; if ($host != ...
1
vote
2answers
2k views

How do I search inside specific taxonomies in Wordpress

I am trying to search for posts in specific taxonomies but any time I search, I get results from all the other pages instead of Wordpress searching within the selected category in the taxonomy. I ...
0
votes
1answer
364 views

Insert html after certain amount of posts?

Is it possible after a certain amount of posts to close of a list and start a new one, like so... Particularly after 6 posts... <ul id="carousel"> <li> <ul ...
0
votes
1answer
530 views

Wordpress query unique post meta - finding all of one value without duplicates for a drop down

My wordpress posts have a city/state combo in the post meta. I want to create a list of cities with published posts from the post meta. How would I go about this?
0
votes
1answer
243 views

How to query an out put value?

I have this custom query that Im working on and I need to be able to query output values as well as actual stored values. Example: $string = "This is #*&^% a test"; $string = ...
1
vote
1answer
788 views

Is it possible to have pagination with an offset loop?

I am developing a blog page that requires 3 different post styles (Ie; one full page width with featured image and content, one full page width without featured image and the rest are half page width) ...
0
votes
1answer
838 views

Posts 2 Posts: query connected — orderby problem

Using Posts 2 Posts plugin I've created 'piece', 'person' and 'collection' custom post types: any piece may be connected to person (with roles 'author', 'conductor' etc) and collection. Now the ...
1
vote
1answer
1k 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 ...
0
votes
1answer
237 views

How to add a Variable to post query

the query is : <?php // Headlines variable can control admin area // Its like ; 3,4,5,6 $headlines = ".get_option('t_turmanset')."; query_posts( array( 'numberposts' => 4, 'post__in' => ...
0
votes
1answer
915 views

How to include post count in this “get_tags” snippet

Can anyone tell me how I can show a post count in this code snippet? <?php $tags = get_tags(); if ($tags) { foreach ($tags as $tag) { echo '<li><a href="' . get_tag_link( ...
0
votes
1answer
340 views

Only show content slideshow if “slideshow” custom field exists

I am developing a theme for general release and there is a large content slideshow on the homepage. I have included a checkbox meta box in the post edit screen that allows users to determine which ...
0
votes
2answers
322 views

bulk post_content update

I need to replace all post_content in a particular tag/category to the desired one i have. is their a plugin to accomplish it or is their a query to finish this. Iam sick of doing this manually, is ...
1
vote
3answers
306 views

query in category.php repeats itself

I'm need some help on my query. I'm building up a category page where on top a post need to show where custom field key 'uitleg' has value 'ja'. Per category there is only one post with that value. ...
0
votes
1answer
400 views

create a link to a random post within the current category

I've got some code which creates a nice link to a random post - any way to amend it so that on a category page it selects a post from the current category? thanks, <?php $randomPost = ...
0
votes
3answers
2k views

How to count get_users query?

I have been searching high and low for a way to count the amount of results from a get_users query. Most of what I found is to count the total number of posts in a post query, but nothing for ...
0
votes
1answer
3k views

Problem with 'post__not_in'

I am running a custom query below each post, to get other post from its category. Now I want to exclude the current post. This is my Query: <?php // related_posts(); $exclude_post = ...
0
votes
3answers
1k views

Exclude categories from the_category();

function the_category_filter($thelist,$separator=' ') { if(!defined('WP_ADMIN')) { //list the category names to exclude $exclude = array('Something','Something Else','Blah','YAY'); ...
3
votes
2answers
3k views

How to rename a custom field?

I have 3000 posts with that custom field name 'refer' and i need to change it to 'ref' for theme needs, instead of doing it manually i need a query or technique to change them all. Question 1 I am ...
1
vote
2answers
232 views

Tricky WP Query

I am trying to use wp_query (or another native Wordpress query class) to do the following: get all posts WHERE ( post_type = 'post' AND category = 7 ) OR ( post_type = 'case-studies' AND meta_key = ...
0
votes
1answer
932 views

Searching with Multiple (Parallel) Criteria on Custom Fields?

I'm just an basic Wordpress user. I need to make search box with multiple criteria inputs (multiple conditions) to search inside various Custom Fields. For example including following Custom Fields: ...
5
votes
3answers
7k views

How to use a custom post type as front page?

I would like to set a site's front page to be a single post from a custom post type. I have been able to alter the request for my front page to a Custom Post Type archive with the following code ...
0
votes
2answers
163 views

Best Query for blog posts

I am not getting any headway in this one problem I have a separate homepage from the normal blog page. However the site needs a blog so How do I structure a query that will display something like the ...
2
votes
2answers
1k views

Next & Previous (Pagination in this case) Not Appearing

I am using a custom page template for my portfolio. The code is calling the correct number of posts per page but for some reason the pagination links won't show up :-S My query <?php $loop ...
0
votes
1answer
270 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
181 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
131 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
811 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
951 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 ...
1
vote
1answer
3k 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
299 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
185 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
341 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!