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

learn more… | top users | synonyms

1
vote
0answers
41 views

Query to get number of posts last week

I want to receive each monday the number of posts that were posted on my site during the week. The first part of the code retrieves the number of posts, and the second part sends me an email with the ...
0
votes
0answers
7 views

Add current user filter on WordPress's default celendar

I want the WordPress default calendar to only show the posts from the current logged-in user. Not the entire posts of the site. I had to hack the general-template.php to do that but really need to ...
0
votes
1answer
43 views

Display year value before a set of posts

This is what I am trying to accomplish: I have a page template which displays "case studies" where "case studies" is a custom post type. the page template called: page-case-studies.php I actually ...
0
votes
1answer
30 views

Querying users by meta value and getting a strange answer

Here is my case: I am trying to get all users with some value related to a specific meta key. In other words, I don't want to select users that have nothing on that meta key (mps_finalDate). So here ...
0
votes
0answers
52 views

Restrict access to custom post type and filter from every query

I created a custom post type topic which is just for internal use. I managed to assign the correct capabilities so that users of certain roles can edit/publish/delete posts. Now I want to redirect ...
0
votes
4answers
153 views

Insert widgets into loop/custom query at every nth position

The basic challenge: I have a 'normal' custom query, e.g. of news posts from a certain category and want to add in several elements (CTAs, generally speaking) at every nth position, while the loop of ...
0
votes
0answers
43 views

Show posts in numeric price order using meta query combining 2 meta keys

I've built a custom estate agency website for a client but I'm stuck on this one last thing before it's good to launch. I'm using custom meta fields to allow for additional meta data such as Price, ...
0
votes
0answers
40 views

wp query custom orderby not custom field

I am working on a products archive page where I show 20 products on each page with pagination. Each product's price is calculated by a formule which gets his parameters by data saved in the database. ...
2
votes
1answer
35 views

Modifying loop on a custom page, strange behaviour

I want to setup a custom page on my site that pulls in posts from only one category. I've taken my main blog page template, duplicated the file and assigned it as a template to my new page. I've then ...
0
votes
0answers
81 views

Function inside shortcode doesn't display WP_Query properly - custom post type

I have a problem with some shortcode and a function to display list of shops based on another shortcode. I wrote some code: Shortcode function shops_list($atts){ extract(shortcode_atts(array( ...
0
votes
0answers
32 views

How set offset on query with specific post_type from functions.php

I have a page template called 'page-blog.php'. On that page I have 2 queries that both obtain the posts of a different post type like so: $posts = ...
0
votes
1answer
39 views

Get previous posts list

I'll give up. Have searched and searched and tried and tried... Can't find any solution to list previous posts. On a single post: I want to show a list of the 10 previous posts, the 10 before the ...
0
votes
0answers
18 views

Displaying Taxonomy titles with their post

Suppose i have a taxonomy note_navigation like this Class 11 --Science --> THis is children of Class 11 ----Physics --> Children of Science and grandchildren of Class 11 ------ QUantum Physics ...
1
vote
2answers
129 views

Query string parameters from custom fields, inconsistent results

I've got a custom post type called course. Within a course post, I have a number of custom fields, specifically (all AFC select dropdowns): course_or_project, time_to_complete_project, ...
0
votes
1answer
33 views

Creating a custom search for a specific post type

Ok, so we know Wordpress comes with a built in search form. However, I've created a custom archive page that lists posts from a specific post type. I would like to integrate a search box that only ...
0
votes
1answer
37 views

Custom pagination (Title, date and teaser)

I'm working on implementing a custom pagination for a website. Unlike default Wordpress pagination with "Older" and "Newer" links, this one requires to show the title, the date and the teaser of the ...
0
votes
1answer
20 views

Mark a page of a queried menu as active

Im trying to mark as active a page of a queried menu --> (I found the answer) function render_main_menu(){ $args = array( 'post_type' => 'a_cpt', 'tax_query' => array( ...
1
vote
1answer
13 views

My SQL function to change user_name

My wordPress database was hacked and all users_names were changed to the same thing. I'd like to write a mySql query to replace all usernames that = "x" to the user_nicename. I'm unsure how to do this ...
0
votes
1answer
97 views

Query Custom Post Types with checkboxes

I have Custom Post Type (Courses) with a field "course-location" that is a checkbox. I would like to filter the listing page with the checked items. The below code is working when I select ONE ...
1
vote
1answer
61 views

How select a specific query when setting offset?

In wordpress I added a function which sets the offset like so: add_action('pre_get_posts', 'myprefix_query_offset', 1 ); function myprefix_query_offset(&$query) { if ( ! $query->is_home() ...
-2
votes
1answer
58 views

Custom Query for wp_posts using wp_postmeta

In postmeta lets say meta_key = 'count' and meta_value = '5' meta_key = 'count' and meta_value = '6' meta_key = 'count' and meta_value = '7' now i want to get all post WHERE meta_key = 'count' ...
0
votes
0answers
61 views

Display result from custom post meta query

This is driving me crazy! I'm trying to simply echo the contents of a meta field (twitter) from the wp_postmeta table of a custom post type with the following query outside of the loop : global ...
1
vote
2answers
60 views

WP_Query Authors OR Categories

I'm trying to create a feed where posts are pulled based off a set of authors, OR a set of categories, but I haven't had much luck. I've tried using meta_query and tax_query, but neither worked. ...
0
votes
0answers
68 views

Standard WP_Query Returns No Results

Edit: found the problem. The fields I'm trying to filter on are custom fields. They were created with the "Load value based on the post's terms and update the post's terms on save" setting UNchecked. ...
0
votes
0answers
18 views

Custom Query Problem

I want to get posts specified with just parent category, not with childs of it. But when I'm using category property, posts_per_page not working. If I remove category proerty, posts_per_page working. ...
0
votes
0answers
24 views

Filtering by custom fields select?

I have a custom template listing all the posts under a category x. This is how my current loop looks like: <?php query_posts('cat=522'); while (have_posts()) : the_post();?> All the ...
0
votes
1answer
66 views

Using URL variables on a custom WP_Query

Background I have a page with a custom template 'listen', with a custom wp_query running on it... $custom_query_args = array( 'post_type' => 'post', 'tax_query' => array( ...
1
vote
1answer
36 views

Style Post Differently In Query

Hi I'm using the query below to display 7 post from a certain tag, but I'm having a problem. I want to style the first post one way and the next 6 post differently. What I have noticed is that it ...
0
votes
1answer
20 views

Show certain number of post from tags

Hi i am using the query below to display post from a certain tag term, but what I want it to show multiple post. So far the query is displaying only 1 <?php $args = array('tag_slug__and' => ...
0
votes
0answers
66 views

Too many categories drastically slow down my website

I'm building a WordPress website that needs something like 7.000 categories. I added them, but now I have very long loading times. Pages need something like 30-40 seconds to load completely, and I'm ...
0
votes
1answer
51 views

How to fetch meta_value and meta_key in matrix after ajax request by post_id

Well, I have 2 custom post types: A = Properties B = Property Owners Inside CPT Properties, I was created a Meta Box to: Search a registred Owner (CPT) by VAT number (CPF in Brazil) Relate Owner ...
0
votes
0answers
34 views

How to use query on pre_get_comments?

I'm trying to make a search field for comments but when I try to modify the query in pre_get_comments nothing changes to the output. This same way IS working with pre_get_posts but for some reason I ...
0
votes
1answer
87 views

Help ordering custom query by Title, Ascending

I have an old project (custom post type query) that needs an alteration and my memory/skill level is lacking for what to do. With the code below, I'm needing to return the first query in alphabetical ...
0
votes
2answers
39 views

Write WP Query that selects posts that are part of the same two categories

How would I go about writing an intersect query (using WP Query) that returns a set of posts that are in both category A and category B?
0
votes
1answer
40 views

Show last 12 uploaded images on home page, but only from posts

I want to show the last 12 images that were published with articles on my front page. This is the code to get the latest 12 uploaded images, but i want to show only the ones attached to a post ...
0
votes
1answer
113 views

How to get posts from many categories using WP_Query

I'm trying to get posts from multiple specific categories. This is my code: $myquery= new WP_Query( array( 'posts_per_page'=>7, 'cat' => array(5,3,7), ) ); It isn't working - what am I ...
0
votes
1answer
59 views

How to add parameters for custom post type

I need to add a parameter to this custom query below. post_type=customer-stories&tag=microsoft,google I now need to add a parameter that will allow me to customize how many of each type of ...
0
votes
0answers
52 views

Ordering Posts by parent category, name ascending

I am currently creating a theme, and I have 2 parent categories: Budget and Brand. On home.php, I want to order all the posts ascending by their sub category name without showing the category title. ...
1
vote
1answer
19 views

What's the equivalent of Hide From Menus on MODX on WordPress?

In MODX, there's a checkbox on posts that will hide it from the main navigation and the post query. This is a very good way of making the post private for reviewing or simply having the post ...
-2
votes
2answers
107 views

How to display search query as formatted text?

I am trying to display a site vistors search query on the search page. The form has custom fields so is not showing if it's "Search" and it doesnt show none of my custom fields. My search form - ...
0
votes
1answer
97 views

How to get category link without a database query

I use Wordpress 4.3.1 with PremiumPress Business Directory Theme. The theme's homepage renders a list of categories using code that's basically: $args = array( 'taxonomy' => ...
0
votes
1answer
58 views

Loop through incrementing custom fields

I created 4 custom fields for a specific page. Field type: Post Object (I grab thumbnails and titles from the posts) Field names: featured_content_1 featured_content_2 featured_content_3 ...
0
votes
1answer
108 views

Looping Through Custom Tax Terms and Displaying All Posts For Each

I'm using the following code to attempt to loop through each of the terms within my custom taxonomy category-film and then output the term name as a heading together with displaying all the custom ...
1
vote
1answer
83 views

Error when using setup_postdata()

I am trying to get the most recent and show it using the native function (e.g. get_the_title()), do NOT want to use $post['post_title'] but when I do this I'm an error. global $post; $featured_post ...
0
votes
1answer
29 views

empty query breaks other queries

Hi I have a cpt query which displays 1 latest event based on date. It works fine - problem is when date is < today (theres no future events to display) this query is empty and also breaks other ...
0
votes
0answers
59 views

SQL Query to export Buddypress Profile data

I need to use sql query to export for http://wpdatatables.com, the code the plugin generates comes with error and I've tried phpmyadmin and sql pro with same error SELECT wp_bp_xprofile_data.value, ...
0
votes
1answer
45 views

Wpdb empty result only if language is Russian

I'm having a little problem with wpdb query. I need to change content of an HTML select by changing another one ( simple and clean ), so, this is my query: $_queryString="SELECT ...
1
vote
1answer
86 views

post loop causes wp_users and wp_usermeta DB queries for each users

Continuing my previous question: My post loop produces 2 queries per post: SELECT * FROM wp_users WHERE ID = '53' require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), ...
1
vote
1answer
136 views

Date query year and month OR just year

I am a bit stuck with setting up this date query. I am using a dropdown select box to allow the user to choose which date archive they want to view. It works for the months, but when I select the year ...
0
votes
0answers
38 views

How to exclude child page on siblings and parent page in WordPress?

I'm trying to hide details about a child page when I'm on the siblings and it's parent page and I don't know how. What I made is exclude the child page details when I'm on it. I want to exclude the ...