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

learn more… | top users | synonyms

0
votes
1answer
131 views

WordPress post type “event” query string fix?

What am I doing wrong in this query? I want to select events from a custom post type called events and order by the event date and only show ones after the current date. It doesn't seem to work... ...
1
vote
1answer
152 views

Add post_type to index.php

I search for an hour now without result. Does anyone can explain me how to show my custom post_type (dictionnaire) in the homepage (index.php). I use 'Easy post type' to add custom post types and I ...
1
vote
1answer
573 views

WP_Query Performance Issues with meta_query

I'm working on a custom template for a new theme that uses a WP_Query instance to select posts from 2 post types with 2 custom fields that are NOT empty. Depending on the section of the site, a ...
1
vote
1answer
114 views

how would I create a custom query to get all users, and a related post based on a postmeta field?

I have about 50 users. Its pretty easy to list them all. However they are related to a special custom post type through a postmeta field called wpp_agents. So I need to list Users, but also the ...
1
vote
1answer
854 views

How to use wildcards in $wpdb queries using $wpdb->get_results & $wpdb->prepare?

I am attempting to make a custom search for BuddyPress groups. Here is my method: public function search_groups($string){ global $wpdb; $results = $wpdb->get_results($wpdb->prepare( ...
1
vote
1answer
233 views

Get Metakey value while saving post

I am trying to insert metakey value while saving or updating post but somehow it is not inserting metavalue to link column of my custom talbe called wp_banner_views function ...
1
vote
1answer
146 views

Is there a reason why Pages are not publicly_queryable?

I am building a segmented search (by post type) with the ability to filter to a specific post type and realized pages were not publicly queryable. What I know I can do is the following: function ...
0
votes
1answer
154 views

Any way to insert text on page from a query results?

I'm using Woocommerce and its atributes (custom taxonomies). I have some pages which I query this way: http://example.com/?tax1=term1&tax2=term2 This query gives me the posts from taxonomy 1 ...
0
votes
1answer
244 views

WP_Query () using taxonomy, custom post types

I want to implement this query using WP_Query(). SELECT * FROM wp_posts as posts LEFT OUTER JOIN wp_postmeta as postmeta ON (postmeta.post_ID = posts.ID) LEFT OUTER ...
0
votes
1answer
98 views

Syntax help needed: Taxonomy Query

I have a template called taxonomy-book_style.php to handle all the terms in book_style. On it I just have a simple loop <?php if (have_posts()) : while (have_posts()) : the_post();?> I would ...
1
vote
0answers
64 views

register_taxonomy() take much queries

Sorry for my poor English, I'm russian. I have a problem by adding a lot of taxonomies. When I added about 80 taxonomies, I get the following results(without caching): before: 44 queries 0.352 ...
0
votes
1answer
198 views

Loop to display random posts only if a custom field matches category

Working on a website and need loop that will show posts ONLY if custom field value is equal to the current category name. I have category 'fun' and custom field 'genre'. I would like to show on ...
0
votes
1answer
66 views

Show custom posts with a specific “custom TAXONOMY slug” on startpage

I am using this code to get all the custom post types shown on the startpage: add_action('pre_get_posts','wpse57309_alter_front_page_query'); function wpse57309_alter_front_page_query( $query ){ ...
1
vote
1answer
542 views

mysql query from wordpress page using custom table

I want to a mysql query that matches a page title. Not sure of a better way to accomplish this task, but I am stuck. This is my basic test code. <?php $page_title = wp_title(''); echo ...
0
votes
1answer
185 views

Adjust the order for returned posts

I have written a neat responsive slider for my Wordpress featured articles (feel free to use it): <?php $responsive = 'on' != get_option('henrik_responsive_layout') ? false : true; ...
0
votes
1answer
273 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 ...
-3
votes
2answers
1k views

How to execute SQL SELECT query and see the results?

I want to run a SELECT query on the Wordpress database and get the results on the screen. Any widget which does it?
2
votes
2answers
246 views

Splitting the main query in multiple loops with query_posts and/or pre_get_posts?

I have a custom post type 'events', to which I have associated a custom taxonomy 'calendar'. The calendar has 12 fixed terms, for each month of the year ( 'august', 'october', 'november, etc.). I'm ...
0
votes
1answer
928 views

$wpdb query a post type within a specific taxonomy term while ordering posts by custom meta value?

I have a custom post type 'event', a custom meta field 'event_date' and a custom taxonomy 'locations'. I want to query $wpdb to retrieve posts in this way posts must be of the 'event' post type ...
1
vote
1answer
77 views

Most liked page not displaying posts

I was looking for a post rating system for a while, then I stumbled across a great tutorial: http://wp.tutsplus.com/tutorials/how-to-create-a-simple-post-rating-system-with-wordpress-and-jquery/ I ...
0
votes
1answer
148 views

wp_list_pages() refuses to output posts

Someone help me understand why the following do not output anything: wp_list_pages( 'post_type=post' ) wp_list_pages( 'post_type=event' ) Yet the following work as expected: wp_list_pages( ...
0
votes
2answers
68 views

Access Tables with number prefix

I have multiple sites setup within my site. I need to access all the various options tables which are named 'wp_#_options'. How can I select these tables that have a number prefix? Using ...
0
votes
1answer
187 views

Start Query from 2nd Post without offset

is there a quick and easy way to load all the posts, starting with the second post and making the first post the last post? If I use offset, I then lose the first post, but I don't want to lose it, I ...
1
vote
1answer
75 views

Limits, not all post are showen when querying for posts by view count

I'm having some difficulty getting a loop that gives me post by most viewed. I started by following this tutorial ...
0
votes
1answer
2k views

Get the number of rows from $wpdb->get_results not working

I want to count the number of rows of this custom wordpress query and it does not work: *PS I am accessing a custom table inside my wordpress database, mabe by myself. The $wpdb->get_results part ...
1
vote
1answer
668 views

Is there any need to use both wp_reset_postdata and wp_reset_query together?

Is there any need to use both wp_reset_postdata() and wp_reset_query() together? Is it a case that I would pick one of the two functions; is there any point in doing this after a query : ...
2
votes
1answer
1k views

WP_Query vs get_posts

I have read a number of questions on SE regarding these but I still can't figure the exact difference wrt usage. Would it be true to say that I would probably use WP_Query for the majority of ...
0
votes
1answer
177 views

List author's posts with SQL

I want display authors'posts with the code below but authors' name aren't showing. What is wrong? <? // query test $qry = $wpdb->get_results( $wpdb->prepare(" SELECT * FROM $wpdb->posts ...
1
vote
1answer
113 views

Query Page Content From Theme Options?

I'm trying to create a slider where you choose what pages are shown in the slider, using a theme options panel based on the https://github.com/vauvarin/options-framework-theme That lists the pages in ...
1
vote
1answer
135 views

posts_per_page option limits the number of Gallery items

I have noticed that if I have a query where posts_per_page are set to 4, any (image) gallery that belongs to one of those posts will too have only 4 items (although when I create the gallery from Add ...
0
votes
2answers
624 views

Exclude some authors from query

This script list users with their last post. How to exclude some authors from guery ? <?php //List of users sorted descending by date of lastest post written by user $uc=array(); ...
1
vote
0answers
65 views

Why orderbyb meta_value_num won't affect the generated SQL Query order?

I've exhausted myself with this and I couldn't figure out why when I do this $myposts = new WP_Query( array('numberposts' => 5, 'offset' => '0', 'post_type' => 'noticias', 'orderby' => ...
0
votes
3answers
590 views

Split wordpress loop to multiple layouts

OK so I've searched a lot and couldn't find a straight forward answer to my question. I am simply trying to use one category loop that will display posts in a category page in a wordpress site. lets ...
0
votes
1answer
643 views

Display posts with a start OR end date later than current date

I'm working with an upcoming events list. I create a custom post type, with a custom field: [event_start_date]. I also have some multiday extension events, defined by an additional custom field: ...
0
votes
1answer
89 views

Query does not return content

Working on updating an old WP site developed for WordPress 2.0 and have a post (page) query that does not return the "post_content" data. Here is said query: $the_query = ...
1
vote
2answers
97 views

How to organise this data within WordPress

I have a dilemma in how the data in this scenario should be organised, as well as queried. The main elements in the scenario are the following: Competition Team Player Each player plays for one ...
0
votes
2answers
270 views

Duplicate posts

I'm currently working on a Magazine style website and on the main page I have three different sections where I display the latest news. Slider, latest news and more news. The problem is I can't ...
0
votes
2answers
148 views

get last post's link with SQL query

I have installed a WP on website A and I want the last post's links in site B. I haven't in site B any WP and I want to get the link of last post from website A. so I can't use WP API like WP_Query ...
2
votes
1answer
307 views

Adding posts of custom type into the main feed

I'm having some trouble with a subject that seems to be pretty basic, so I'm starting to feel (a little, only a little) dumb :-) Here's the thing: I want my main feed to include the posts and other ...
2
votes
1answer
37 views

How do I query for a post by custom field?

I have a custom field called "song-id" and I'd like to lookup a post by a song-id value. Can someone give me the code snippet for it? (bonus: also looking for a code to use the permalink in the post ...
1
vote
0answers
65 views

Dynamically adjust single-posttype.php query, based on current taxonomies

I have a single-teamphoto.php template loading data from a Team Photo - Custom Post Type, showing team photos with team member names below, one photo at a time, with a navigation list of available ...
1
vote
0answers
85 views

category pagination got broken suddenly

i need some help here please! The pagination just stopped working suddenly with the default post type and default wp query, with plugin "wp-paginate" or even with next/prev arrows! It echo 404 error ...
1
vote
0answers
268 views

Exclude posts with taxonomy term from appearing on home page query

I am really confused about this one, I am usually pretty good at working out basic queries but I can't seem to work this one out. Please see below my index.php query. Now it is not your basic query ...
0
votes
2answers
655 views

How to modify the query to exclude posts by slug?

How can I modify my query in order to exclude certain posts by slug? Is it possible? query_posts(array('category_name' => 'Mycat', 'posts_per_page' => -1)); Ty
1
vote
1answer
627 views

Display category posts grouped by taxonomy

I'm working on a project where I use the default posts as "Products", default category as "Application" and a custom taxonomy called "Groups". I want to list "Products" by "Application" ...
0
votes
3answers
419 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 ...
0
votes
2answers
195 views

Transient api Caches confused

This code works for page 1 <?php $paged1 = (get_query_var('paged')) ? get_query_var('paged') : 1; $recent1 = get_transient( 'recent1' ); if ...
1
vote
1answer
1k views

Use get_post_types to query only custom posts types

I need to query only custom posts types - that is all post types in my WP install excluding posts and pages. I have used get_post_types to build a string of all custom post types which I want to ...
0
votes
1answer
149 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
105 views

Query post & loop problem.

i having trouble while i added query to loop. please have a look whats the problem. here is the link <div class="fl" id="main_article"> <?php $count = 1; $the_query = new WP_Query( ...