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

learn more… | top users | synonyms

0
votes
0answers
55 views

Import SQL tables from SQL file on plugin install

I'm building a plugin, on installation of the plugin it needs to create several tables. Now I found out that I can do that in the plugin code sorta like this.. // Function to create new database ...
1
vote
1answer
57 views

List all posts from past week grouped by sub-category

On a category specific template, I want to list all the posts from the last 7 seven days for that single single category and group them by subcategory. This is the code I have so far, which lists the ...
0
votes
2answers
123 views

How to get my loop to pull posts into three columns

I have my page template pulling one specific category & pulling the featured image & title into 3 different columns on my site. The problem is they all pull the CSS class .proj-left how can I ...
0
votes
2answers
18 views

Do not show children of a category

I'm trying the next code: $categoria = get_the_category(); $hijosCategoria = (array) get_term_children($categoria[0]->term_id, 'category'); $queryBase = ...
0
votes
1answer
19 views

Update vs Insert logic but the last key is always inserted?

I have added a custom db table which looks like usermeta table, just storing some key - value pairs. But now i am stuck with the following logic a/ if key exist for a user use an update query else ...
0
votes
0answers
86 views

Get post ID and custom taxonomy of posts that belongs to certain category, efficient by SQL?

I have a large Wordpress site with almost 200 000 "posts" (everyday is aded more than 2000 new) and sppecific homepage with about 30 loops to get last 5 posts from every category (sngle loop = single ...
0
votes
0answers
97 views

Custom query to update user meta data (also with a custom table)?

I have add a custom table (wp_shopping_metavalues) to the WP install which looks like wp_usermeta. I am displaying user values from both tables. For the insert i use function ...
0
votes
1answer
46 views

Query Custom Post Type posts by Keyword/url slug

I am running an affiliate shop with around 10k products and I am trying to build Landingpages for SEO/SEM purposes. Those pages should contain a title, some text and related products. I would like ...
1
vote
1answer
26 views

Custom Field Create Bulk via SQL Query

I have a question. A created a custom field named video_desc. I have ofer 2000 posts and I need to add this custom field to all posts and add the text "Description Here" to it. How can this be done ...
0
votes
2answers
149 views

How To Get Some Data From WordPress Database Using WordPress $wpdb Query?

I am trying to get some data from WordPress database tables in a plugin. For that, I am using the below code... global $wpdb; $findID = $wpdb->get_var("SELECT ID FROM wp_posts WHERE post_name = ...
-1
votes
1answer
43 views

wpdb query with dynamic column name?

How can i dynamically set a column name in $wpdb query? i tried $which_column = 'phone'; $data_check = $wpdb->get_var("SELECT '.$which_column.' FROM wp_shopping_preferences WHERE wp_user_id = ...
0
votes
0answers
28 views

What's going on with the get_pages() 'number' argument?

According to the codex, the get_pages() 'number' argument works the same as an SQL LIMIT. number (integer) Sets the number of Pages to list. This causes the SQL LIMIT value to be defined. ...
0
votes
0answers
20 views

Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?

I have the following problem with featured tag posts I have a page of a website in wich I want to show only the posts that have setted a specific tag (using the loop). So in this page I have put ...
0
votes
0answers
13 views

Why I have this strange behavior when I try to exlude the featured post from posts visualization?

I am quite new to WordPress theme development and I have a strange behavior with this custom theme on which I am working: http://lnx.asper-eritrea.com/ As you can see in the home page I have 2 areas ...
0
votes
1answer
56 views

Advanced SELECT query with condtional statements

I am having trouble understanding the proper way to write an advanced select query. I have the following the code here. if (!empty($_GET['3321body_type'])) { $bt = $_GET['3321body_type']; ...
1
vote
1answer
150 views

How to get the posts published in last two days using WP_Query?

I am trying to loop through all the post to get the top most shared posts on social network. I want to use the date_query parameter in the WP_query to get the posts of last two days , last 5 days, ...
0
votes
1answer
41 views

Next 10 posts data of currently viewing post in blog page

I am developing a theme and using WP_Query to fetch the content from the database, but now i wanted to implement a loop using a WP_query that will show me the next 10 posts with title links and ...
1
vote
2answers
102 views

Select Multiple meta_value from WP DB; Single Query

I am trying to retrieve each user's first and last name, phone, email, and address from the usermeta table. I'm having trouble selecting multiple meta_values, each with its own meta_key, using a ...
1
vote
2answers
73 views

Transient not working for custom loops

I'm working at a WordPress theme. Since I need to display featured posts, related posts, some widgets with recent posts and so on, I need to use multiple custom loops. Because of this, the number of ...
0
votes
0answers
22 views

Archive query not working correctly

I think I am missing something while trying to create an archive page for my post type I decided to put three levels of data in one post type and was going to separate it by templates depending on ...
0
votes
0answers
51 views

trying to update post meta in bulk

I have been trying to arrange my site so that my URL structure is set to domain.com/collection/%collection%/%product-group% Where %collection% is a taxonomy term, collection is the index, and ...
0
votes
0answers
147 views

Unserializeing multiple column values that are stored in one database results variable

Lately i have created a custom template to search for data in a database, and also displaying it, by the use of checkboxes. So, a user can select multiple checkboxes to search data on and the query ...
0
votes
0answers
64 views

How to group by custom posts by child taxonomy term

I have registered a custom post types named "property" , a custom taxonomy "city" is associated with that post type . I have couple of city like Ontario Toronto street 1 street 2 ...
-1
votes
3answers
47 views

WP Query outputs three items within a div

At present I have a basic query that outputs 12 custom posts, each in a div. I need to restructure this to output four divs, each with three of these items inside. So it's sort of like a nested div. ...
0
votes
2answers
74 views

Determing number the query ran by core wordpress

I wanted to find out, how many queries does wordpress core run, and how many queries the theme run. Is there any way to get they number of both of them separately ? As i run `echo get_num_queries(); ...
0
votes
1answer
40 views

How to overwrite orderby with add_query_var

So I would like to have an archive that displays its posts in a random order. <?php $query = new WP_Query($query_string."&orderby=rand"); ?> But also then if the user chooses they ...
0
votes
1answer
31 views

How do you display the number of a post in a query?

I want to display the number of a post beside each post title in a query, such that it literally appears like this: Post title one in query Post title two in query Post title three in query How do ...
-1
votes
2answers
74 views

Query: offset post list, unless it's a specific category

Here's my code: <?php query_posts(array ('showposts' => '1', 'cat' => '-11')); if (have_posts()) : while (have_posts()) : the_post(); get_template_part( 'content', 'archives' ); ...
0
votes
2answers
237 views

Advanced Custom Fields - Relationship post foreach query

I've created a post type, called Package (for news packages), and want to be able to link to specific blog posts and display them on the single-package.php page. I'm using ACF relationship fields, and ...
3
votes
1answer
55 views

Query Custom Meta Value with Increment

I have a Query searching for a meta value I have added to my posts (meta-select). I have it feeding out in a loop with 4 results. Let's say I want this loop to start with the meta value "2" and work ...
0
votes
1answer
122 views

Can't update multiple rows with $wpdb query

it seems that I cannot update multiple rows to change the post_type of posts having a specific tag. I follow different method, even if it seems the good one is this one : global $wpdb; $result = ...
0
votes
0answers
15 views

Incorporating a meta query into a mysql query in wordpress

I'm trying to find a way of inserting a meta condition into this bit of SQL below... $query = "SELECT COUNT( ID ) as num_events " . "FROM $wpdb->posts " . "WHERE ...
0
votes
1answer
107 views

Only show upcoming event or current events

I've been working on this website event page http://aishaarab.com/events/ everything is working but I have 2 problems: I can't get it to only show upcoming event meaning when an event is ...
-1
votes
2answers
53 views

What's wrong with my $wpdb prepare

I can't get my head around this. I get this error: Parse error: syntax error, unexpected '"' in 224. The line is this between foreach $html: $html = ''; foreach ( $recent_across_network as $post ...
0
votes
1answer
241 views

Custom MySQL Query for Post and Post Meta

I have a custom table called "tags" that contains a charity_id that is a reference to a post ID ... I need to query the "tags" table to grab this charity_id and then pull in the post title and a few ...
0
votes
2answers
97 views

Why in this archive page that call query_posts() function show only the last 10 posts?

I am pretty new in WordPress theme development and I am finding 2 problem with this posts archive page: http://lnx.asper-eritrea.com/archivio/ The previous page have to show ALL the blog posts into ...
0
votes
1answer
36 views

How to get link and title of next and previous post on single page

Guys How can I get the link and title of both next and previous post on the single page? Just like in the screenshot below. I try to use this but nothing shows up. $prev = get_previous_post(); ...
0
votes
0answers
39 views

Horizontally paginate through sets of blog posts?

I have my posts set up like this: I would like users to scroll through the posts using the left and right arrows. So when users click on the right arrow, for example, the next six posts would slide ...
0
votes
1answer
40 views

Some doubts about how the loop work (trying debugging it)

I am very new in WordPress development (and also in PHP development, I came from Java and C#). Today I have installed Aptana and configured XDebug to inspect what happens into the TwentyTwelve theme. ...
0
votes
0answers
32 views

Title outside of the loop in page template

I have a page template, with a very simple default query. The problem is that the title is outside of the loop, because of the layout. What do you think, is it problem? Or do you know an other way? ...
0
votes
0answers
65 views

Problem with correctly registering query variable

I have an admin page for my plugin, which lists records from database. I want to sort them under some conditions. To call different sorting options, I've decided to use query string. Step 1: At ...
0
votes
0answers
59 views

Cron Job to Delete over 30 days old post from post type

This is my first time creating a WP cron job and I would like to have someone else review it for mistakes. I wrote this cron job to delete temporary wishlists that are over 30 days old. The wishlists ...
2
votes
1answer
136 views

Filter Media Library by author or post_parent

I am trying to filter the Media Library so only media items that are uploaded by the current user OR children of the post being edited are visible. I've had no problem doing it if the conditions are ...
0
votes
1answer
189 views

post__in not working with pre_get_posts, but post__not_in does work

I have an action setup on pre_get_posts which I would like to use post__in on. I used the following code as a test: $query->set('post__not_in', array(74485,1528,71460)); This works, the total ...
0
votes
2answers
61 views

How to orderby meta_value_num with dollar ($) sign

The custom fields all have prices including $ signs, and a dot as separator. $theQuery = new WP_Query(array( 'orderby' => 'meta_value_num', 'meta_key' => 'price', 'order' => ASC )); All ...
0
votes
1answer
37 views

how to insert missing tags into the posts through mySQL?

I am looking for a SQL query to insert a tag to multiple posts from a specific category. A pseudo query looks something like this: INSERT INTO POSTS VALUES TAG = "tagName" where Posts ...
-1
votes
2answers
210 views

show all custom posts types in home page

Hi i am working on custom post types in wordpress presently we are using below code to display the custom posts, but the thing is the custom post types are keep on increasing, add_action( ...
0
votes
1answer
54 views

Apply ordering args to newly merged queried

I have two queries with arguments and then I merged them to form my new query - $wp_query. I would like to now apply arguments to the new query to show the merged pages/posts by meta_value_num. This ...
0
votes
0answers
61 views

How to organize a WP_Query's list of posts by category and display category title?

If I run a query with some args and get a list of posts, how can I organize the posts separated by category and display the title of each category? $array_out = array(); $args = array( 'orderby' ...
0
votes
0answers
38 views

Can I use multi (sub) levels of relation (AND | OR) on custom query?

I'm tryng to do the equivalent of: $args = array( 'post_type' => 'post', 'tax_query' => array( 'relation' => 'OR', array( 'relation' => 'AND', ...