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

learn more… | top users | synonyms

0
votes
1answer
145 views

display certain category on custom template page

i duplicated a portfolio column page template ... On this page I want to show only one category , instead of all categories... I tried a lot, but couldn't get it worked... this is the original code ...
0
votes
2answers
70 views

How to get posts and comments amount per hour, per year and per month?

I have this snippet: function count_user_comments_today( $uid ){ global $wpdb; $today = date('Y-m-d'); $tomorrow = date('Y-m-d', time() + 86400); $count = $wpdb->get_var( ...
0
votes
2answers
158 views

Get first comment link on the post itself

I have this function and a link to a post: <?php foreach ($results as $id) { $post = &get_post( $id->ID ); setup_postdata($post); <li><a <?php href="<?php ...
0
votes
1answer
34 views

Get query result before posts are displayed?

If I want to modify the query, I can use pre_get_posts filter. But what if I want to loop through the queried posts before they are ran through the The Loop? Is there a filter/action hook for that? I ...
0
votes
1answer
54 views

Can't get full post title if there a spaces in title

I want to make a custom query that checks the post title and puts in a different URL like this: <a href=bing.com/search?q=<?php echo single_post_title(); ?>>Blablabla</a> But it ...
1
vote
2answers
51 views

Make one query for adding entries to database

I have a situation where I need several entries to be added to a database table (sometime a few hundred), but using $wpdb->insert() (and $wpdb->update() where edits are necessary) is running ...
0
votes
1answer
51 views

Query Custom Post by taxonomy multiple categories

I need to query posts using certain taxonomy category, but more than one category of the taxonomy, as I can with posts categories.. For example, I have the Portfolio custom posts, and the Project ...
0
votes
0answers
59 views

WP_Query retrieve custom posts but not the post showing

I am developing a custom post type which shows releated posts which are within the category which is working perfect but I cant seem to get the right query to make it not show the current post which ...
0
votes
2answers
26 views

query statement containing variable won't execute

Very confused why the following code does not work. function discount_State() { if(is_page('cart')){ global $wpdb; $current_user = wp_get_current_user(); $need = $current_user->ID; $getID = ...
0
votes
1answer
163 views

Query multiple tables at once?

I want to query all of the posts in my WordPress multi-site set-up looking for a certain string. This is only being done in Sequel Pro (on the command line) for my own inquisitive purposes but there ...
0
votes
1answer
221 views

Using add_rewrite_tag to create urls for page sections

I am dividing my page templates into linkable regions. I'd like to be able to use clean urls to do so. My page urls look like so www.example.com/page-name/?section=example I'd like to rewrite the ...
0
votes
1answer
173 views

Search / Filter posts on Title/Content OR Tags

I need to make a custom query to look for posts (CPT) which match a certain keyword but it have to search posts in both the title, the content AND a custom taxonomy terms. I’ve tried with to queries ...
0
votes
1answer
73 views

Get categories of queried posts

I queried posts from an array of IDs: $args = array( 'post_type' => 'post', 'post__in' => $ids, 'orderby' => 'id', 'order' => 'DESC' ); Now I want to display a form with ...
2
votes
1answer
793 views

Using query_vars filter

I am trying to link out from the WP admin to view posts in a specific way. The url structure for this is example.com/post123/?my-preview=456 /post123/ is the regular permalink for a post. The ...
0
votes
1answer
26 views

Using class id from array for query

I'm using Event Calendar 3. Since there seems to be no easy way of querying all upcoming events as posts, I tried it this way, getting the IDs from the DB and querying the posts from that: <?php ...
0
votes
1answer
108 views

Exclude sticky posts from query

I used orderby=date and orderby=comment_count to show my recent post and popular post, but sticky post is always there on the top. How can exclude sticky posts?
-1
votes
1answer
52 views

Highlighting Sub topic in a post?

Have seen this sub topics highlighter in many blogs. It gives a special attraction to a sub topics used in the post. Is this a plugin or part of code? How can I add this? http://imgur.com/UbGpz7j
0
votes
0answers
245 views

Filter the feed page post limit

WordPress has a setting for the number of items shown in syndication feeds. I want to bypass that setting in a plugin and return a different number of items. Here's what I am doing, but it's not ...
0
votes
1answer
63 views

Delete Query won't run

This is the set up... <form method="post" action=""> <input type="hidden" name="delete_app_id" id="delete_app_id" value='<?php echo $adoptee->app_id; ?>' /> <input ...
-1
votes
2answers
302 views

How to get current user ID in array meta_value?

Here is example: $args=array( 'meta_key' => 'Something', 'meta_value' => '',//here goes current used ID by default. 'meta_compare' => '=', ); $user_query = new ...
1
vote
0answers
68 views

Post 2 Post Site Search

I'm trying to filter search terms bases on categorisation created by posts 2 posts. I'm using the generic site search and then I've created a search filter function my_filter_the_search($query){ ...
1
vote
0answers
34 views

Wordpress Query orderby title with UTF8 string in title

I got posts with titles are in utf8 encoding. When I query posts with orderby is title, those with utf8 characters at the beginning are at the end. Example: post title starts with Đ are at the end ...
0
votes
1answer
24 views

How would I get a list of posts from a custom post type

I know the query method that you would use, that's not what I want. I could query the post type, then do the if statement with the while statement and go from there, but I am trying to populate a drop ...
1
vote
0answers
38 views

Sorting main query by custom taxonomy slug

Is there a way to sort posts by custom taxonomy (shoe_color) ASC|DESC? I would like to do this using query_posts and passing the orderby=shoe_color into it. Here is the code I'm trying to work out: ...
0
votes
3answers
84 views

How to get all post_parents of a post?

Unfortunately, $post->post_parent is a single variable and not an array. I want to get all post_parents of a post (especially of an attachment, which is often linked to multiple posts!).
0
votes
2answers
18 views

How to have more post in a page than in your home page

I am new to the world of WordPress. I own a new site and I'd like my home page to display the latest news and articles (which I accomplished to set in Settings > Reading), but I'd like another page to ...
-1
votes
1answer
46 views

How to get one result using wpdb class?

function asec_get_link_color() { global $wpdp; $query = "SELECT value FROM wp_theme_options WHERE property = 'link-color'"; $result = $wpdb->get_results($sql); return $result; } ...
0
votes
1answer
78 views

Custom Query for searching through custom fields

Just wondered if someone could spare 5 mins to help me understand where I might be going wrong. I have a set of custom fields for jobs - I would like to create two drop down menus as a quick search: ...
1
vote
1answer
45 views

How can I sort homepage by a meta value?

I am trying to sort my home page posts by a custom meta value. I've been told I should use pre_get_posts but I seem to not be implementing it correctly. This is what I am doing: ...
0
votes
0answers
72 views

Show posts using custom while loop with pagination

I have an array of post ids i would like to show in a page 16 at a time. The array may include some repeating ids that is why i could not use post__in in a custom wordpress query because some of the ...
0
votes
1answer
128 views

How do you dynamically display the latest events on a page using an events plugin?

I'm using the plugin called All-in-One Event Calendar, and would like to have the information of next six upcoming events to display on a specific page. I've created the page and followed the ...
0
votes
0answers
82 views

Order Events by Category or Type, The Events Calendar

So I've using the Events Calendar Plugin which is really working well for what I am trying to accomplish. However, I have run into a snag. I want to organize this query below by displaying an ...
0
votes
0answers
39 views

Detecting top parent category fails on home page

I have the following method to detect a top level category. But it fails on home page returning alway true. //detect parent category function in_parent_category($cats,$_post=null){ foreach ...
0
votes
1answer
57 views

WordPress Mysql query and Duplicate

i've a problem with mysql query on my wordpress database. I've custom fields Country and City. At moment I have this query that show all the cities of "UK" Country $querystr = " SELECT wposts.* ...
0
votes
2answers
123 views

Query from multiple category (and)

here is the request : get all post from category=11 (get 21 post), and then in the 21 post got from this category, refilter it, and show only post from category=10. So the request should be : ...
1
vote
1answer
99 views

Wordpress custom archive page

I am trying to build up a custom archive page. However, I would like this archive page to skip the first 5 posts. I've been able to accomplish this with the offset property. However, the pagination ...
0
votes
1answer
109 views

Query post by date (stored custom field meta as yyyymmdd) and differentiate across 12 months

I have a post type that holds a custom meta field with a date in it. The date is stored in the format: yyyymmdd. On the archive page for this post type I want to create 12 separate containers, one ...
0
votes
3answers
145 views

custom user meta query

I've been trying to get this query to work but it keeps failing to return any rows SELECT a.ID FROM wp_users a, wp_usermeta b WHERE b.user_id=a.ID AND ( (b.meta_key='firstname-groom' AND ...
0
votes
1answer
554 views

Query multiple custom post types in single loop

I'm aware there are several other posts that cover similar ground to what I'm about to ask. I have three custom post types running, in addition to 'posts'. I want to run a loop that pulls all posts ...
0
votes
1answer
44 views

Get multiple posts with some custom fields efficient

Is there an efficient way to get some posts with (some of) their custom fields in one go? I have a custom post with some custom fields and would like to create an overview page where I display all ...
1
vote
1answer
29 views

How Can I Query a Specific Page From a MultiPage paginated Post

Let's say I have a post that has been paginated by adding the <!-- nextpage --> code provided by wordpress for this purpose. How can I then query a specific page from inside of that post. ...
0
votes
3answers
171 views

Remove last comma from this query

I'm having trouble fixing this for working in ie8, i find out thats last comma is problem, but dont know how to fix it. this is current code. <?php $args = array( 'post_type' => 'katalog', ...
0
votes
1answer
78 views

Custom Wordpress SQL Query 4 posts per custom taxonomy

I'm currently developing a Wordpress website that has a large navigation that lists the 4 most recent posts within a hierarchical taxonomy. I dont have any experience with $wpdb, but it seems like ...
0
votes
0answers
14 views

organizing taxonomies in custom post type

I created a custom post type named "Gallery" which contains photos in several taxonomies e.g: Sport, Nature, Food, Drink. I want to organize all those taxonomies in my page "Gallery". So I can see ...
0
votes
3answers
493 views

Taxonomy Drill-Down / Plugin Help - hierarchical queries within plugin?

I hope this question doesn't make me look too stupid! I am using a plugin called 'Query Multiple Taxonomies' -- it's a fantastic plugin and is written extraordinarily well. ...
0
votes
1answer
258 views

WP-Snap too slow (caused by WP_Query?)

I have a website with 10.000 posts... WP Snap alphabetizes the posts and puts it out with WP_Query, but it is slow as hell, which is very frustrating. My question would be: what can I do about it? ...
1
vote
1answer
91 views

Searching With Apostrophe

I'm having trouble with my custom theme's search function. I have a number of posts with apostrophes in the title. For example, McDonald's. However, when I try searching say McDonalds, the post won't ...
0
votes
1answer
198 views

How to display posts from specific category using get_option function?

I try to display posts from specific category only in a author page, using get_option function like in the code below but it does not work: <?php query_posts('cat='.get_option('admin_cat')); ?> ...
0
votes
0answers
118 views

How to replace an ID with a get_option function in wordpress?

This is my code to retrieve the related posts from the same author in Wordpress: <?php function get_related_author_posts() { global $authordata, $post; $authors_posts = get_posts( array( ...
0
votes
3answers
120 views

search through post-type attachments titles

I have a page where I show all the attachments of a page in a table which has id=10. I have hundreds of attachments and I would like to implement an AJAX search form that uses the title of attachment ...