0
votes
2answers
47 views

WP_Query issues with argument posts_per_page

I have a query that displays the names of donors as well as a dedication. It displays using a date meta query. $args = array( 'post_type' => 'donors', 'order_by' => 'id', 'order' => ...
0
votes
2answers
33 views

How to add multiple images to a custom post type single post?

I have created a custom post type and I need to add multiple images to every single post, so I can create a loop and use them in a slider. So far my search on Google etc. has turned up nothing. ...
1
vote
2answers
55 views

Multiple filter conditions for WP_Query

I'm having a hard time figuring out how to accomplish this (really simple) task: Get 4 random posts, but only select from the 10 most recent posts. This works great for the random part, but ...
1
vote
2answers
90 views

Why won't my taxonomy query show up?

I'm attempting to display posts from a 'Uncategorized' category under a custom taxonomy called 'Reviews' but without much luck. I'm using get_template_part('loop','review') to call loop-review.php ...
0
votes
1answer
210 views

How to create Page templates for showing Blog posts in different layouts?

I'm creating a Wordpress Theme, and I want to create few Page Templates for creating Blog pages with different layouts. So for example, I want to have blog-4-column.php, blog-3column.php and ...
0
votes
1answer
49 views

Writing less unnecessary code with WordPress

I've got a simple homepage, that pulls content for 4 different categories. To do this, I'm writing 4 different WP_Query, and only the category name is changing (and as a result, the WP_Query name, ...
0
votes
2answers
75 views

Get posts after calculating meta key

I have 2 meta fields for the posts, eg. meta_value and meta_count. Both are numbers. I want to divide meta_value by meta_count and based on the results I want to fetch the top 10 posts. So for ...
0
votes
1answer
82 views

posts_nav_link(); not showing up on static pages

I've got two different loops. The default on the homepage, but a secondary loop on the archive page. It grabs all the content, like so: <?php // WP_Query arguments $args = array ( ...
0
votes
1answer
56 views

WP_Query not getting all posts, just tagged posts

I'm trying to create an archive page that grabs every post submitted. At the moment, I have this, which doesn't work: <?php $args = array (); $query = new WP_Query( $args ); if ( ...
0
votes
1answer
57 views

tag__in does not return posts

I want to get a custom post type posts with the same tags. Here's what I'm trying: $tags = get_the_terms( $post->ID, 'item-tags' ); //returns tags array correctly if ($tags) { $tag_ids = ...
0
votes
0answers
108 views

How to Display Custom Post Type's Gallery (images ) in Through WP_Query

I am trying to load an Image Slider images from a Custom Post Type image Gallery Feature. For example let say I have an Custom Post Type called banner which I can load images to it's Gallery and I ...
0
votes
1answer
49 views

Toolbar Hidden in a Virtual Page

I am trying to create a virtual page, but my admin toolbar is not showing up. This is how I am creating the virtual page: functions.php add_action('init', function() { ...
0
votes
2answers
36 views

Not the typical order by posts by date question

I am using WP_Query to get all posts from a custom post type. This works great for listing out all the posts. However, the post itself has a custom date field and I want to list all posts for a ...
0
votes
1answer
54 views

View list of all attachments on site

I'm new to WordPress theme development and I'm trying to figure out if there is a way to display a list of public attachments similar to how you can view a list of posts with a specific tag or author. ...
-1
votes
1answer
38 views

query posts in wordpress

I want to filter my query results just before the_loop starts in word press. I only want the results having term_id or term_taxonomy_id equal to 1. ...
2
votes
1answer
752 views

add_filter and remove_filter added before and after wp_query

I have just started with WordPress Development, and found following block of code online (in some tutorial) function filter_where( $where = '' ) { // posts in the last 30 days $where .= " AND ...
1
vote
2answers
125 views

Why is the first query affecting the second query, even after wp_reset_query() and wp_reset_postdata(), but not on the second page?

I am literally clueless as to why the code does not function properly on the first page, but functions as expected on the second page. I have already tried running the second query via another ...
0
votes
1answer
138 views

Paginated WP_Query doesn't return 404's, even when posts don't exist

I'm currently building a theme for a client, and one of their requirements is endless scrolling on a "Charts" page. They want this to be paginated, and the endless scroll to load the next page below ...
1
vote
1answer
84 views

Keep sticky posts out of query unless they have featured image

I have a query running which prevents posts without various criteria from appearing, one of these is the necessity to have a featured image. Sticky posts however seem to end up in the query ...
0
votes
1answer
120 views

Make Next and Previous on single-$posttype.php use the same order as archive-$posttype.php

I have a custom post type events and am displaying these events using archive-events.php and single-events.php from the template hierarchy. I have a custom query in archive-events.php $paged = ( ...
0
votes
1answer
749 views

issue displaying variations in custom template using WPeC 3.8.9.2

I’m having trouble displaying variations in a custom built template, each time i call the wpsc function have_variation_groups() within my loop i get the following php error ...
1
vote
5answers
1k views

WP_Query returns no results

I'm using wp_query to create a custom query that retrieves search results but it is returning 0 results. Here is the code: $query = 's=the&posts_per_page=5&paged=1'; $custom_query = new ...
0
votes
2answers
63 views

multiple queries to get posts from same category?

I am trying to make a so called featured category on my theme homepage. In that category I would like to display 6 posts from same category. The problem is that, I would like to devide these posts ...
0
votes
1answer
102 views

Search.php gets metadata from first post

I've got this in header.php in <head> section: $page_color = get_post_meta($post->ID, 'page_color', true); It works fine because it gets correct page_color for posts and pages but when I ...
0
votes
1answer
70 views

How can I prevent posts with no title showing up in my query?

How do I prevent posts with no title showing up in my query / loop ? ( I am doing aside, quote etc post-formats and I want to exclude title less posts from one particular loop) I have nothing on ...
0
votes
2answers
425 views

How can I use the WordPress Loop and Pagination in multiple instances but different scenarios throughout my site?

I am using the Starker Theme as a foundation to build my custom WordPress theme. The Starker Theme comes with a loop.php file for setting up the main loop. I decided to use the loop.php file to ...
0
votes
1answer
2k views

WP_Query with custom post type ID

This code isn't echoing out anything, even though I'm 100% positive $mixtape_id is set to an integer which corresponds to one of the posts within the 'mixtapes' custom post type $query = new ...
2
votes
3answers
1k views

Get list of months with posts

I am trying to add a filter on my custom theme based on post month, similar with the archives but with some differences. What is the best way to get a list of months in witch we have posts? Thanks, ...
0
votes
1answer
806 views

CSS class on last post in loop ( custom query )

I have been using this question to try to do this but I am having some difficutlty. I have a custom post type, media, and I am working on the archive-media.php template. I have it partially working ...
0
votes
1answer
273 views

Custom Post Type Query issue

I have a conflict issue with 2 custom post types. I have a template file archive-media.php and have created the related 'media' custom post type. This all works well, however in the sidebar I have a ...
0
votes
1answer
48 views

Adjust query on single

I am building an event manager. One of the template files I have is events-single.php which displays single events. At the bottom of this I have next and previous events using next_post_link and ...
0
votes
2answers
213 views

How to order by multiple date meta_values?

I am trying to find some way when using WP_Query of ordering by multiple meta_values. I know I can order by multiple values and I know how to order by meta_values but I cant seem to figure out how to ...
0
votes
1answer
309 views

2 loops, is_home won't work, count is off

Alright, I've made a bunch of themes over the years, and I've written a lot of queries. And I just realized that I apparently have no clue how to get multiple queries to behave. So, here is the loops ...
0
votes
2answers
99 views

Best practice for implementing a blog page / section in wp_menu_nav()

I currently have a theme I am developing and had a thought on best practice. I am using wp_menu_nav() for my menus and they are linking to 4 or 5 pages respectively. I would like to add a page / to ...
1
vote
2answers
153 views

Finding posts containing matching array elements in a meta field usign WP_Query

I have a metafield, that contains a series of options and writes the results to an array in a single meta field: array([0]=>'First', [1]=>'Second', [2]=>'Third', ); I find ...
1
vote
3answers
957 views

Custom URL parameters in template files

SETUP I want to pull a query variable from the URL and use it on my single post template (single.php). For example: mysite.com/2011/07/29/testPost/?myvar=someValue To do so, I added the custom query ...
2
votes
2answers
1k views

Check for featured image in WP_Query

Is there a way to filter posts by featured image when initialising a WP_Query object? Example $my_query = WP_Query(array("has_thumbnail"=>true)); or, more ideally $my_query = ...
0
votes
2answers
373 views

How to query the latest 5 posts and sort them by title?

I'm looking to draw a menu listing of the latest "n" number posts, where the number "n" will be a user defined setting stored as an option. n = 5; //Pull the latest 5 posts from the database. The ...
1
vote
1answer
200 views

Metadata Query when storing data as array possible?

Suppose I store all my post meta data in an array like $meta = array( 'img' => '', 'caption' => '' ); update_post_meta($post->ID, 'theme_banner', $meta); Can I query posts where ...
0
votes
2answers
472 views

How to create query to get top 3 sticky/latest posts

I hope I will make sense, and if you have a better suggestion please let me know. I am just starting WordPress I want to layout my theme such that I get 3 sticky, not more than 1 month old, or latest ...