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

learn more… | top users | synonyms

1
vote
0answers
44 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
48 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
144 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
55 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
110 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
48 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
113 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
43 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
65 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
306 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
161 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
141 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
168 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
913 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
52 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
34 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
266 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
88 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
3answers
677 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
270 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
133 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
262 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
3answers
171 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 ...
0
votes
0answers
91 views

Order custom fields by string length

I am trying to reorder a custom field from one of my Custom Post Types. I'd like to get the custom field string which is called 'first name' and order all of the first names by their string length. ...
0
votes
0answers
211 views

Advanced Custom Fields Post Object

I am looking to create a custom proposal system with WP and ACF. I created 3 custom post types. Proposal Objectives Proposal Items Proposals I created some custom fields in ACF to include in ...
0
votes
3answers
234 views

2 wordpress loops showing 1 post from same post type - how to avoid showing the same post?

I got to two loops in my template files. Both querying the same thing essentially. This loop in my header: $testimonial_head = new WP_Query(array( 'posts_per_page' => 1, 'post_type' ...
0
votes
2answers
80 views

New Wordpress WP Query using posts from certain categories

I want to display the last say 6 pieces of work from my portfolio. So i have written this query <?php $the_query = new WP_Query array( 'category_name' => 'portfolio', 'showposts=6' ); ?> ...
0
votes
1answer
63 views

How to use Greek characters/letters in a query?

I have a problem with Greek characters in a query. Here is the code Using the Greek characters in the 'meta_value' => 'Ναι' the query can't work, because of the language. How can i make it work?
1
vote
2answers
82 views

Is there a conditional tag for latest post or do i need a query?

I need to display an avatar in the post info position which i have written the code for but i only want to display it on the most recent post on the home page and not a specific post as this will ...
1
vote
2answers
584 views

Optional Meta Query

I have places stored as posts in WP's posts table. I am doing some geo-locating using Geo Data Store (http://wordpress.org/plugins/geo-data-store/). This is working great for me, as I can currently ...
0
votes
1answer
116 views

How to callback custom field text

I have a plugin where the user can click a button to feature a post. I added a text field but i want the text field to call back whatever is posted in it Here is how it looks now ...
0
votes
0answers
84 views

Combine Query and Select Database to create directory loop

I have a query loop on my page that I am using which displays all users on the page with certain custom fields filled out. It's working fine however, I need to also query these users for their level ...
1
vote
4answers
252 views

Add a class to posts in increments of 2

Is it possible to add specific classes to posts/pages in a query in increments of 2? For example Post 1 Post 2 Post 3 (add custom class) Post 4 (add custom class) Post 5 Post 6 Post 7 (add custom ...
0
votes
0answers
114 views

Marginal pagination on home.php

I'm trying too make a custom wp-theme and use a few loops in home.php. But now I can't finish home.php because of pagination. How cant I realize any type of pagination with saving that kind of ...
0
votes
1answer
379 views

How to add a prefix to existing custom fields over MYSQL query?

I've got the problem that after a plugin update I can make the custom fields on our directory site searchable, but only custom fields which get the prefix booking_ to them. Now there are some pages ...
0
votes
2answers
36 views

Find all posts via SQL beginning with A of type B

I have problem with post and taxonomy query. What i need is to get all post's from custom post type which starts with A and have defined term. Here is my sql: SELECT * FROM $wpdb->posts, ...
0
votes
1answer
40 views

How do I add tags/taxonomy to images + a query field on page to query 'albums' (images with same tag/taxonomy)

I've got lots and lots of photos on my site and I want to seperate them into albums. Every album is a client album (photoshoot). Though.. I want all my clients to query their album on my site. ...
0
votes
1answer
56 views

Show links to child pages on both parent AND child pages

I have a client who wants the following; They have a series of pages, each of which have children. On the parent pages they want to show links to all the children. For this I am currently using this ...
1
vote
1answer
803 views

WordPress Loop: List All Posts by a Category & Subcategory

I want to display all post under a category and all subcategories under the parent categories. But couldn't find proper suggestion over forum or failed to understand the solution. It's possible to ...
0
votes
1answer
51 views

Checking for existing title in custom db query not working

I want to check if the title exists before the wp_insert_post() is triggered. However, the condition seems not to work as expected: if( $wpdb->get_row("SELECT * FROM wp_posts WHERE post_title = ...
-1
votes
1answer
154 views

Multiple loop with pagination in same page

In my home page i have two <section> in which i perform two different loops on different post categories. Here the code: <section> <ul class="loop-article"> ...
0
votes
1answer
152 views

List of buyers for each product

I would like to know if it's possible to get the complete name of each buyers for a specific product or the orders list of a specific product ?
2
votes
1answer
299 views

How to implement time filter to show random post 1 month for one category and 3 months for other categories

I started to work on one website after another developer and there is problem with his "popular widget" which is basically showing 3 random posts from category. There is some Switch statement which is ...
0
votes
1answer
114 views

Best practice to limit results in get_row()?

This is my query to check if a title exists (it's in a loop, therefore [$i]). $wpdb->get_row("SELECT * FROM wp_posts WHERE post_title = '" . $titles_arr[$i] . "'", 'ARRAY_A'); Anyway, I would ...
0
votes
1answer
66 views

Post content stays the same but permalink changes ?

This is really weird. I made a posttype ' mediagallery ' via the plugin Types fields. I simply want to load the post content and switch the posts with a next & prev button in de sidebar. The post ...
1
vote
3answers
867 views

How to write: $wpdb->update having WHERE NOT value pair in the array

I need to update all meta keys in the postmeta table that have a value other than 0, to the value of 0. I tried this.. no love (though I cannot figure out why....): $status = $wpdb->query("UPDATE ...
0
votes
0answers
145 views

List number of posts with a specific meta_key for each meta_value

I would like to list my posts by a specific custom field. At the same time, for each custom field, I would like to count the number of posts with a specific custom field value. I have a custom field ...
0
votes
0answers
135 views

Complex WP_Query Using Post Date And Post Meta

I am using Wordpress as a CMS on a website which has standard posts, a custom advert post type and a custom event post type. The event post type has some custom meta which stores the event start date. ...