A generic term referring to the process of retrieving information from a database.
-1
votes
1answer
9 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
19 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
0answers
23 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
0answers
16 views
Post from one WordPress site to another
I have two sites running on WordPress. I have a form on one site that generates a custom post type, and I would like this custom post type to be posted to another WordPress site. How can I do this? Is ...
0
votes
1answer
24 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
27 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
2answers
27 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
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
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
1answer
17 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
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'] == ...
-2
votes
0answers
35 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 ...
0
votes
0answers
18 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
17 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 ...
0
votes
1answer
29 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 ...
1
vote
1answer
35 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
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 ...
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
41 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
39 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
97 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
0answers
38 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
33 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
69 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
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
0answers
59 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
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
...
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 ...
1
vote
1answer
27 views
Admin Posts List (edit.php) by post IDs
I'm writing a plugin that creates posts in bulk. I provide a way for the user to set certain parameters of the created posts beforehand. But it would be useful to use the WordPress default "All Posts" ...
0
votes
0answers
36 views
Order posts by meta value then by random with pagination
Firstly thank you in advance for your help.
I am creating a directory site. My client needs featured directory listings to appear before standard listing but they also need to be in a random order ...
0
votes
1answer
34 views
Different layout based on post amount?
Is it possible to change the layout of the query posts depending on how many there are?
So simple query page listing posts...
Up to 4 posts show them in a list.
If there are 4 posts and over show ...
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
25 views
Get Related Posts (custom post type) of Custom Taxonomy, Most to Least?
I'm working on an image page feature which retrieves the MOST related posts ("image" custom post type). So images with most terms in common should be listed first. But this does not seem to be ...
-1
votes
1answer
37 views
query_post or single-[cpt].php?
php query_posts( 'post_type=listing');
Or
single-listing.php?
According to my reading I have presumed that to display a custom post type all I need to do is copy my single.php and rename it ...
0
votes
1answer
51 views
PHP variable in WordPress database query
When running the following code :
$voucher = 'MK0186';
$is_in_database = $wpdb->get_results( "SELECT * FROM my_codes_table WHERE code =" . $voucher );
I get : WordPress database error: [Unknown ...
0
votes
2answers
89 views
Select min/max meta from query
Kind of lost on what to do here. I have a meta price for each post. I'd like to get the min and max price meta values of this search/query. At the moment its returning the min max values for all ...
0
votes
0answers
27 views
Displaying posts by year
I'm trying to display posts on the homepage from the current year only. I am using the following:
<?php if ( is_front_page()) { ?>
<?php $current_year = date('Y'); ?>
<?php ...
0
votes
1answer
22 views
Query for first 3 posts to change the look and feel
Is there a way to query for the first three recent posts and then change how they display on the front page?
I want the first three posts of my blog to show differently than the rest of them i.e. ...
0
votes
1answer
54 views
Better wordpress attachment query then this
I have a site with more then 10.000 posts and images, its classipress site. I need somehow to show all images from posts that are on pending status, and who havent expired(post meta). This is the code ...
4
votes
1answer
183 views
Changing the meta_query of the main query based on custom query_vars and using pre_get_posts
I've registered custom rewrite rules and query_vars to use for displaying a list of events based on ISO date format. For example when a user requests the URL, http://site.com/by-date/2013-04-04/, my ...
0
votes
1answer
84 views
How to delete all posts, categories and tags from Wordpress database
I have WP website with over 40,000 posts. Now I'll like to delete all posts, categories and tags. So All content and related meta. All I want to keep is static files. Is there a easy way to do this ...
0
votes
0answers
12 views
sequnce in enter words in wordpss search using query
I have a problem in creating advanced search with custom query and using $wpdb->get_results($query , OBJECT);
In Normal search in wordpress when we search xxx yyyy or search yyyy xxx we have same ...
0
votes
1answer
86 views
wordpress category.php query for featured news item, broken pagination and repeating posts
I am having a few issues with a site I am building, on the news page It has 1 featured post from the news category and then under that more news category posts, but missing out the featured news item ...
0
votes
0answers
16 views
Cannot insert % sign in SQL [duplicate]
I cannot insert a % sign in the SQL database. I'm using the following function:
$wpdb->query($wpdb->prepare("insert ".$wpdb->prefix."dq_category_master_catrules set ...
0
votes
1answer
87 views
How to customize a title by passing query string?
I have a profile page, it is a template. Every time when I click one of a doctor, the profile page will show the specific doctor info by passing a query string. Something like
profile?doctorName=abc.
...
