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

learn more… | top users | synonyms

0
votes
2answers
402 views

wordpress showing all posts instead of date range

When going to http://craigmdennis.com/articles/ Wordpress uses the index.php template. When you go to http://craigmdennis.com/2010/05/ Wordpress uses the same template (markup below) but shows the ...
2
votes
1answer
1k views

Query & Sort Comments by custom comment meta

I added a basic "favorite/recommend" functionality for posts and comments to a wordpress site I'm working on. I'm storing the total numbers of comment "likes" in a custom comment meta field (...
0
votes
1answer
1k views

Retrieve query var within functions.php

I have query var set using the following filter: add_filter('init', 'add_query_vars'); function add_query_vars() { global $wp; $wp->add_query_var('user_login'); } I am able to retrieve ...
0
votes
1answer
77 views

Custom loop attached to link

I have a custom post type named companies. When you add a new company you need to check if it's a leader or not, so I created custom metabox with two radios, one for "yes" and another for "no". In ...
0
votes
1answer
66 views

Is there a way to add a link directly into this media query?

I am running this query which pulls all of the images attached to a particular post and outputs them into a slideshow (See example here - http://powers.deanelliott.me/property/1428-elm-street/) Is ...
0
votes
1answer
766 views

How to query two meta fields and display results between them

I am making a search form that searches for posts within two meta box values and display results between them. I have this set $prefix = 'ghes_'; // start with an underscore to hide fields from ...
0
votes
1answer
567 views

paginate_links on custom query in admin - 'sufficient permissions' error

I have created a page in my admin with this custom query: $rows = $wpdb->get_results("SELECT * FROM ej_feedback ORDER BY createdtime ASC"); I have made it successfully paginate as required in ...
0
votes
1answer
1k views

working with term_relationships table

I have this little code to insert posts via custom form: $post = array( 'post_author' => 1, 'post_title' => 'my title, 'post_content' => 'my content', 'post_category' =&...
0
votes
3answers
384 views

Custom Select Query - Selecting the Year?

I have a query were I'm grabbing all post types of "news" in 2010, but it doesn't select the posts from that year. What am I doing wrong? $querystr = " SELECT $wpdb->posts.* FROM $wpdb->...
0
votes
1answer
399 views

How can I override one post and make it display content for another post?

I have two pages on my Wordpress site: mysite.com/?p=100 mysite.com/?p=200 I think I should be able to hook into Wordpress' actions somewhere and re-query the post, so that content for mysite.com/?...
4
votes
1answer
5k views

Meta Query with AND & OR?

I'm trying to do some filtering for some posts in WP_Query, but I can't seem to get the right condition. Basically what I wanna do, is get posts that have the custom field event_data (sorted by this ...
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
5k 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
22k 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
351 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
729 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
358 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 != 'domain.com'...
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 class="inner-items">...
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
244 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 = preg_replace('/[^(\...
1
vote
1answer
793 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
845 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
923 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( $tag-&...
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
307 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
401 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 = $wpdb->...
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 = $post->ID;...
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
935 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
272 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 ...