A generic term referring to the process of retrieving information from a database.
0
votes
2answers
142 views
query if page has not child
I'm trying to create a page which display a few of sub pages (child pages), however if the page has not child I would like to display a message.
I cannot get a query that allow me to do something ...
0
votes
1answer
220 views
query usermeta from custom field
I am using a plugin to create custom fields in the user registration.
I have created a check box field called g300 which is the name of the meta_key stored in wp_usermeta.
It looks like the value ...
0
votes
1answer
405 views
Can I paginate this get_attachment query?
Yeah, basically I want to be able to show 15 images attached to a certain page and have pagination when the page has more than 15 images.
I'm not very well versed on this kind of query so I'm a bit ...
0
votes
1answer
1k views
Can I use $query->set() (in a pre_get_posts() hook) with a custom taxonomy in WP 3?
I can do something like the following with a standard category:
$query->set('category__not_in', $term_id);
But how do I do the same with a custom taxonomy term?
I'm using Wordpress 3.3.1 if it ...
2
votes
1answer
3k views
Get all image from single page using this query
I'm having some trouble with this sample widget code. I want to get all images (Minus the post thumbnail) from a page called "Gallery" but for some reason this is pulling all uploaded images from the ...
2
votes
1answer
2k views
How to get comments by post ID?
I have this custom post query to list all the posts within a specific category. For example I have this:
$args = array('cat' => 'home','post_type' => 'post'));
$post_obj = new WP_Query($args);
...
1
vote
1answer
544 views
order by numeric value for meta value
I have read countless posts on ordering data by numeric value ( as opposed to string - it i have a numeric meta value and it gets ordered like this 1 11 12 2 233 etc as opposed to the way i want it
I ...
2
votes
1answer
987 views
Using WP_Query - how to display something IF there are no results
I've used WP_Query to query and display events. In some cases, though, there are no events to be displayed and I'd like to display a friendly message when that happens instead of displaying nothing - ...
0
votes
1answer
137 views
Query posts alphabetically within this function
I've been given some code to tidy up and edit a bit and the client wants to organize a custom post type named "plans" alphabetically.
It's not a straight forward query and I've never come across ...
0
votes
1answer
98 views
Can I include get_posts in this array?
I am using the custom meta box script from deluxeblogtips.com and I wondered if I could include get_posts within this array so that it displays all posts within a set post type ("Locations" for ...
1
vote
1answer
276 views
Exclude featured image and custom field from this get_attachment query
Is there a way I can exclude the post thumbnail AND a custom field with the value "_lm_comm_logo" from this query that pulls all of the images associated with a particular post?
<?php $args = ...
0
votes
2answers
2k views
Get posts by meta data OR title
I have a working query that calls all my posts that have a certain meta value for one of two meta keys:
$term = $_GET['term'];
$args = array(
'post_type' => 'some_cpt_name'
,'meta_query' ...
2
votes
2answers
693 views
add spans and characters into paginate_links
I am using paginate_links on my custom page query.
What I have already works sweet and this is the code I have so far...
<?php
global $wp_query;
$big = 999999999; // need an unlikely ...
0
votes
2answers
262 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 ...
1
vote
1answer
703 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
212 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
58 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
55 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
354 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
313 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
250 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
234 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 ...
0
votes
1answer
168 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 ...
1
vote
1answer
1k 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
111 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
1answer
1k 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
503 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
355 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 ...
6
votes
5answers
4k 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
414 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 ...
0
votes
2answers
1k 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 ...
2
votes
1answer
163 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
474 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
684 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
108 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 - ...
0
votes
3answers
5k 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
293 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 ...
0
votes
2answers
2k 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
165 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!
0
votes
1answer
1k 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
582 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
266 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
292 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
183 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
391 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
421 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
492 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
216 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
321 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
232 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 ...