Tagged Questions
-1
votes
1answer
25 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
34 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
53 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
75 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
0answers
46 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
0answers
24 views
All posts not being displayed [closed]
I have built a site that uses the "posts" type to display their galleries as normal posts. It is set to be sorted by custa meta date and continue on down the page.
As of right now, I have made 15 ...
0
votes
1answer
82 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
307 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
4answers
161 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
44 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
68 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
51 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
350 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
1k 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 ...
1
vote
2answers
366 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
505 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
222 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
43 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
204 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
243 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
80 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
108 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
698 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
1answer
709 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
262 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
183 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
426 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 ...
