A generic term referring to the process of retrieving information from a database.
0
votes
0answers
4 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
1answer
401 views
Query get post,how to add comment box
Hello I have a query that gets a post with id=x and it works but it leaves out the comment box.
Is there a way to add "get comment box" to the query?
<?php
$post_id = 104;
$queried_post = ...
1
vote
2answers
25 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
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 ...
2
votes
2answers
116 views
Rearranging posts based on categories
Hey everyone on Stackexchange!
I'm trying to find a way to prioritize posts based on a category in a loop, which is sorted by dates. All posts are grouped under their respective dates. The date ...
0
votes
0answers
31 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
1answer
15 views
Adding an orderby filter, casting postmeta with multiple keys
I am using this filter to sort my query by a date field stored as text (legacy data)
add_filter( 'posts_orderby', 'my_posts_orderby_date', 10, 2 );
function my_posts_orderby_date( $orderby, $query ) ...
0
votes
0answers
20 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.
...
0
votes
2answers
32 views
Set conditional on template based on referring page slug
I have a portion of a page template that is conditional upon the following elseif
<?php elseif( isset( $wp_query->query_vars['details'] ) && $wp_query->query_vars['details'] == ...
1
vote
1answer
347 views
Sort posts based on multiple custom fields
I have a three custom fields
Meta Key → YOUR_PREFIX_newcar_body_type
Meta Key → YOUR_PREFIX_newcar_transmission_type
Meta Key → YOUR_PREFIX_newcar_variant
and I have to sort posts ...
-2
votes
0answers
30 views
Get all posts starting with first two letters in Wordpress
I have a plugin in which an alphabetical list is posted where people can click on a letter and they get the posts with that letter. So if they click on A, they see all post titles starting with the ...
1
vote
2answers
105 views
Query last updated posts (posts updated in the last 24 hours)
I'm having some difficulty to find an example of how to create a loop with posts that had been updated in the last 24 hours.
My idea is to have a page of posts or perhaps on the index.php a lists of ...
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 = ...
2
votes
2answers
998 views
Get category slug and display it on a query_post
I just read "How to create option page for wordpress theme" in wp.tutsplus.com - I have a problem with getting categories .
there is two parts to my question
- Part A - Get category slug and ...
0
votes
1answer
187 views
Load more posts with multiple queries
I've been developing a theme which uses the load more ajax plugin, everything is setup and working great with the main query.
But, once I setup a new query for popular posts, the load more posts ...
0
votes
0answers
17 views
Displaying hierarchical taxonomy terms on taxonomy template
Sorry if this is a little long but it is somewhat complex. I thought I was going down the right path. Here it is. I have created a custom post type and a custom taxonomy for it named location. In this ...
0
votes
1answer
16 views
How can I get the name of term post meta value which equals term id
I have a custom taxonomy (location) that is being populated automatically by an advanced custom field on user save. The issue is that it saves the term_id in the postmeta meta_value field. When I echo ...
1
vote
1answer
34 views
Perform query with meta_value date
I am trying to perform a query on a custom-type post using the value of a custom field.
This field contains a string date: dd.mm.yyyy.
The post type name is 'event'
The custom field name is ...
0
votes
1answer
27 views
Exclude all sticky posts front page twenty twelve
I am attempting to exclude all sticky posts from my front page in twenty twelve theme. I have attempted the following. I am making all changes to the child theme.
To remove the following code from ...
0
votes
0answers
19 views
Run a query when in last category
Can anyone help? ive searched google but with no luck.
currently Accounts has sub categories but no posts
/accounts/ = /billing1/ + /finance/
Billing and finance have posts but don't want ...
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 ...
0
votes
2answers
193 views
shortcode using multiple WP_Query's with multiple category names not fully functional
we're working on a bilingual site,
Larry A. Downs
all the posts are categorized into two categories, english or spanish, along with other categories. so every post has multiple categories,
i've ...
2
votes
3answers
469 views
Wordpress query by category, sorted by custom field
I have three custom fields set for each of the posts in the events category — year, month, and day. I am already querying for the events category, and now I'd like to sort the posts by the custom ...
0
votes
0answers
25 views
Pre Get Posts fails with more than 1 Post Type
Inside Functions.php
function custom_filings_archive( $query )
{
if(is_post_type_archive( 'filings' ))
$query->set('post_type',array('the-reports','press-release'));
return $query;
}
...
0
votes
2answers
36 views
Disable the MySQL query in the main query
I would like to disable the MySQL portion of the main query, i.e. I want every step to be followed on this page EXCEPT step 4.3: http://codex.wordpress.org/Query_Overview
What's the easiest way to go ...
0
votes
1answer
102 views
Pagination in wp query with transient api
I have intergrated wordpress transient system with w3 total cache. Now i can`t to do pagination for this query.
<?php
$paged1 = ...
0
votes
1answer
38 views
How to display only one category in a custom post type?
I have a custom post type called 'portcat' and I want to display the results of only one portcat category ('games' - which has an ID of '3') on my page. The below code displays all of the categories ...
0
votes
0answers
38 views
Retrieve post data via WPDB class
I'm trying to figure out doing a custom query using the $wpdb Object.
I have custom type posts, event_posts, that have meta data, images, as well as event dates which are input in the post with the ...
0
votes
0answers
24 views
URL build query
I have the following that builds a list of custom taxonomy(location) terms on the archive page for a custom post type. My issue is that when it builds the URL it is picking up the last post as part of ...
0
votes
2answers
94 views
$wpdb returns no results with SELECT query on custom post type, works on default post type
EDIT: Adding more background info.
I've coded a plugin that adds a meta box to the post page. When the post is published, the plugin will generate a random ID for the post, and insert the random ID ...
0
votes
1answer
186 views
wp_get_post_terms Order by not working
wp_get_post_terms Order by not working
My code is here
query_posts(array('post_type' => 'product','post__in' => $product_ids,));
while (have_posts()) : the_post();
global $post;
$args = ...
2
votes
1answer
121 views
Show All Posts Insert Edit Link
When I click to insert/edit link in the tinyMCE rich editor for a post, then click "Or link to existing content", it shows only posts that are live and published. Is there a way to get the list that ...
0
votes
0answers
36 views
How to exclude 2 Portfolio Categories from page?
I want to exclude 2 Portfolio categories (IDs 4 & 23) from a page using the code below but it still displays all categories. Similar code works for 'Posts' but not for 'Port' - can anyone see what ...
0
votes
1answer
134 views
Export all posts to import as product items
Up until now, my client has been using WordPress posts as his way to display his products. I now need to export all these posts into a CSV format so that I can format the CSV file and import it back ...
0
votes
1answer
32 views
add_query_arg to look up page title
I'm trying to get the code below to look up the status name, i.e. new, open, pending or resolved with the word ticket together to find pages called new tickets, open tickets etc.
$ticket_status = ...
0
votes
0answers
44 views
get_query_var('paged') giving same result
I have a custom page, in that page i am using a custom select query for my search functionality.
The problem is pagination not working. I used $on_page= get_query_var('paged'); for pagination. When ...
0
votes
0answers
27 views
The offset option breaks the pagination
I have a problem with a website of mine, I was hoping you can help me.
I added the offset option to ignore the first couple of posts in the main loop. It does its job, but the navigation got broken. ...
0
votes
1answer
22 views
How do I query for posts by custom meta and those that have been stickied?
I realize how clumsy and inefficient this query is but SQL is not my strong point. I use the following query to pull the latest 8 events from a custom post type called Event Posts. However, I also ...
0
votes
1answer
66 views
Specific Loop For 2 <div> Within Each <li>
I need to create a loop that can logically be described as the following for a carousel:
Requirements:
3 Loops
2 Posts Per Loop
No Duplicates
Order by Post Date
Visual:
< Start Loop #1 >
...
0
votes
1answer
331 views
Displaying Portfolio Filter by Category Order (alphabetically)
I have created a custom post type to display churches in Europe. I used this tutorial to make it filterable: http://wp.tutsplus.com/tutorials/creating-a-filterable-portfolio-with-wordpress-and-jquery/
...
1
vote
2answers
739 views
Help with MySQL to $WPDB query
Here's my issue. I have three tables I'd like to query - states, points, and state_points.
States contains stateid, and name. Points: pointid, pointlat, pointlng. State_points: Stateid, Pointid.
...
0
votes
0answers
19 views
Listing custom post type items from a couple of custom taxonomies
I know I have asked a similar question in the recent past (Listing all custom post types using a specific term on the said term's template page, in groups), but in this case, the template is more ...
0
votes
1answer
187 views
How to retrieve attachments from child pages of a specific Page?
How would I retrieve attachments from all subpages of a specific Page ID?
Example:
SPECIFIC PAGE
Child (with attachments)
Child (with attachments)
Child (with attachments)
I'm currently ...
0
votes
0answers
47 views
Special Query: Title, Terms, Content - %LIKE%
I'm working on a them theme that is search-heavy, and my users are putting huge priority on an improved search function.
I think I will have to use a special direct query to search these things:
...
0
votes
0answers
58 views
Custom query on Wordpress custom table
I am working with a custom table where some values will be inserted or updated if they already exists, I have checked and rechecked the syntax and it seems to be working fine, if I run the same query ...
0
votes
1answer
108 views
Passing values by form to create a query
I have this structure:
taxonomy
- term1
-- child term1
-- child term2
-term2
-- child term1
-- child term2
I have two select boxes. First one shows the parent terms (term1 ...
0
votes
1answer
38 views
pre_get_posts : 'post__not_in' doesn't work with global variable
I'm trying to set a post__not_in which use a global $popular variable, defined in the index.php.
-index.php-
$popular[] = 1 //post id=1
$popular[] = 2 //post id=2
$popular[] = 3 //post id=3
...
2
votes
1answer
151 views
Grouping related postmeta data via SQL query
I am using someone else's WP plugin which stores lots of related data in wp_postmeta using an "artificial key". So effectively we hijack wp_postmeta to create a nested relational database. So one row ...
1
vote
1answer
20 views
wpdb query problem to access previous 3 days posts
I am trying to get all published posts titles by author id 2 most recent by post date for the last days. Here is my query:
"SELECT post_title FROM $wpdb->posts WHERE post_status = 'publish' AND ...
0
votes
1answer
163 views
How to retreive and display value from post type to another page using Advanced Custom Field plugin?
I use Advanced Custom Fields in a post type and I would like to display them in another page. In addition, I would filter them according to 3 categories (3 tabs), for this I used a select field. Here ...

