"wp-query" ambiguously refers to one of two things. 1) WP_Query is a class native to Wordpress which allows users to query the posts database using a number of criteria. 2) $wp_query is the default object that holds the main query object on each WordPress page.
0
votes
2answers
16 views
Prevent pre_get_posts filter on specific post type
I am running into one issue with pre_get_post filter.
Actually I have 4 post types. Post, Pages, Events, and Venue. I created one custom field called city for event and venue post type.
When ...
0
votes
1answer
14 views
posts_per_page is not working
I have a query to display custom post type categories' posts, but I want to limit the posts_per_page to 8, so I am using the code below.
Please tell me, if I'm doing something wrong.
<?php
$args ...
0
votes
0answers
6 views
Get posts from similar time as current post
Hi guys I've been struggling with this for a while and wondered how you lovely people would go about implementing it.
I would like to show 4 posts that were posted before and after the current post. ...
2
votes
0answers
21 views
How do you get the count of posts in an archive page?
I have a custom posts archive page of the type archive-my_custom_post_type.php and I am using the "standard" loop which consists of the ever-so famous
<?php if(have_posts()) : ?>
<?php ...
0
votes
1answer
33 views
Display count number of posts with the same specific meta_key meta_value
I want to display a list of posts ordered by a specific meta_key.
My posts have the following custom fields: author_lastname and author_firstname.
So far, it works good. The posts are displayed ...
2
votes
0answers
52 views
How to make a WP_Query search with custom post types?
I've registered a custom post type called "node".
When I create a basic WP_Query to get posts of that type, it works just fine. Example:
$args = array(
'post_status' => 'publish',
'post_type' ...
0
votes
0answers
26 views
Wordpress posts showing at random [on hold]
I'm having an odd situation where some of the posts I mark as one of the categories below show sometimes and other times not.
I've even stripped this down to the bare minimum but it's still acting ...
1
vote
1answer
25 views
How to ensure “the_content” filter runs only for the main displayed content?
I have a plugin which adds the method to "the_content" filter.
add_filter('the_content', 'myFilteringFunction', 10000);
Within that function I want to add some links on the beginning and the end of ...
-1
votes
1answer
24 views
How to query posts from specific authors and categories using WP_query?
I currently have a WP_query where I am getting posts from a specific set of authors. To this, I want to add specific categories as well.
$args = array( 'author__in' => $authors, 'posts_per_page' ...
0
votes
0answers
14 views
Archive by months with pretty url?
I wanted to able to get the archive months working, I tried this
http://codex.wordpress.org/Function_Reference/wp_get_archives#Last_Twelve_Months
but it only gets the last 12 months, what I wanted ...
0
votes
2answers
38 views
Highlight current post title on a page
In my menu I have a page that is called Campaign.
When the user enters to Campaign the page displays the last custom post type of campaign-post.
In the sidebar of Campaign page, I'm displaying a ...
0
votes
1answer
26 views
Wordpress Numeric Pagination with Query String [duplicate]
So I have a dynamic loop which is affected by a query sting in the URL..
For example I have 3 categories and when they click the category it just adds a query to the URL:
<a ...
0
votes
0answers
7 views
Problem accessing values from $wp_query in plugin
I am creating a custom plugin where I am passing parameters in the url and trying to access the values of those parameters using $wp_query directly in the plugin, but it returns an empty array. I ...
0
votes
0answers
28 views
wp_update_post not working
I have the following code in a single script to be run one time to fix post names which are empty.
// WP_Query arguments
$args = array (
'post_type' => 'books',
...
0
votes
3answers
22 views
Query Vars Not Set in Main Query
I have a function that checks page specific and global settings to determine a class related to sidebars. I call the function from the archive.php template and try to check that post_type is 'post', ...