Set up The Loop with query parameters. This will override the current WordPress Loop and shouldn’t be used more than once. This must not be used within the WordPress Loop.

learn more… | top users | synonyms

0
votes
0answers
19 views

Styling every second Post differently? [duplicate]

I wanted to style every second post inside of a query post and I found a solution which nearly works. the thing is: it outputs just two posts (older ones will be igrnored) but i want to output ALL ...
0
votes
1answer
1k views

orderby:date not working

I have been searching for an answer and it seems like there are a lot of answers for the opposite issue. I am trying to sort by publish date, not by date modified, using this code: ...
0
votes
2answers
113 views

Only display posts with comments

I would like to query out only posts that have comments. So posts with comment_count = 0 won't show but anything above that will. This is what i query but it still picks out posts that doesen't have ...
0
votes
1answer
126 views

wp_query by last month + sort posts

I'm using the WordPress plugin 'I recommend this', it allows people to 'like' posts. The value is stored as a meta key, which we can query to generate a 'most recommended' page. Plugin -> ...
0
votes
1answer
116 views

get_posts and wp_autop (remove filter)

I just transformed my query_posts function in a get_posts function. Here is my old function: <?php // The Query query_posts( 'cat=170&showposts=4' ); remove_filter('the_excerpt', 'wpautop'); ...
0
votes
1answer
75 views

get_posts output always same post

I'm trying to output the last (chronologically) 4 posts having the tag (slug) "pp". <ul> <?php $args = array( 'posts_per_page' => 4, 'taxonomy' => 'tag', 'field' => 'slug', 'terms' ...
0
votes
2answers
557 views

How to limit the number of results for all query_posts on mysite

I have a huge number of posts and the pagination with no limits eats my server CPU and ram so I need a function to limit the number of posts for all query_posts on my site and I need this function to ...
0
votes
2answers
117 views

query_posts result differs from wp_query request result

I have a multisite Wordpress setup (3.5.1, I cannot risk updating) on which I am querying some posts after having switched to the correct blog. I have a query_posts function with the following ...
0
votes
2answers
412 views

Wordpress query_posts by tag doesn't work anymore(?)

I had this code running fine forever. Some days ago it just started outputting nothing (just the <ul></ul>). No errors in logs: <ul style="margin-left:0"> <?php ...
0
votes
1answer
80 views

How to show only the most recent post on my custom post type archive?

I have registered a custom post type and inside my archive-myCPT.php I want to retrieve just the current published post. Here is a relevant snippet from my archive-myCPT.php: <?php if( ...
1
vote
1answer
7k views

How to get current post id of a custom post type in a loop using template singel-{custom type}.php?

I have a custom post type template where am looping through all post. what i am trying is when i go to my custom post page i want to get the current post id in the loop. So i tried to check if the ...
0
votes
1answer
66 views

How to query post ids liked by the Author

I'm using wti_like plugin and this is how i get the number(count) of post liked by the author // Get the author object $author = get_user_by( 'slug', get_query_var( 'author_name' ) ); // Get the ...
0
votes
2answers
184 views

Set colors depending on category

I have this function which outputs the last 6 posts of categories 1 and 2. <ul> <?php query_posts('cat=1,2&showposts=6'); ?> <?php if ( have_posts() ) while ( have_posts() ) : ...
2
votes
1answer
544 views

post_name empty after wp_insert_post

I'm writing an external tool that inserts post in wordpress (I'm using the wordpress functions). I read also this discussion: wp_insert_post does not write my post_name But my problem is a little ...
0
votes
1answer
282 views

3 random images from custom post type, each in a div with a diffrent class

I'm trying to build a loop using query posts to display 3 featured images from the custom post type 'portfolio'. My problem is that each picture has to be in a div with a diffrent class, so i was ...
0
votes
1answer
557 views

How do I query_posts in cat=1 AND not in cat=2

Let's say I have 3 categories, College (cat=1), Corporate (cat=2), and Idea of the Week (cat=3) There is a home page for College and a home page for Corporate. On the College home page, in one ...
0
votes
0answers
34 views

Array in POST request -> is 404

I send array in post request <form action='<?php echo get_permalink(); ?>' method='POST'> <input type="hidden" name="question[]" value="<?php echo $question->ID ?>"> ...
0
votes
1answer
164 views

query_posts not working after wordpress 3.7 update

I recently updated to wordpress 3.7 and all of a sudden my posts page stopped working . it shows nothing and opens up a blank page . there is small code on that page and it stopped working . It was ...
0
votes
0answers
132 views

Join two wp_query

So, i have custom posts with this settings: Example 1: have meta_key "price" Example 2: have meta_key "no_price" So, i want to list this posts ordered by "price". I just want to join these two wp ...
0
votes
1answer
31 views

Return only custom post types for the page, not all

I'm currently working my way through some custom posts (for the first time). I'm managing to return the bits I need using this <div class="pagered"> <h1 ...
0
votes
0answers
49 views

Joining column from table to query_posts

This is more of a question to be sure that I am on the right track with how I want to do this. I am using a custom template that uses elements of theme to display products based on filter results. I ...
0
votes
1answer
51 views

query_posts ignores the argument

The query_posts totally ignores the day argument. I'm trying this: $day = date('j'); query_posts('day='.$day); if (have_posts()): while (have_posts()): the_post(); //show posts endwhile; ...
0
votes
1answer
244 views

If meta_key has value = 6 | Change the wp_posts.post_date to current date

I have three sections: 1-New posts 2-Trending posts 3-Hot Posts I'm using a Vote plugin and i sort every section like this: New Posts: $args = array( 'meta_query'=> array( array( ...
0
votes
0answers
232 views

Converting an existing query_posts to WP_Query

I am having trouble trying to convert my query_posts loop that is bugging out to a WP_Query, was hoping someone may have some luck looking at it: This is my old loop: <article ...
0
votes
1answer
37 views

Why are some of my custom posts not showing up on my page?

I have 6 posts with a custom post type in my Wordpress theme. I want to show them all on a page but I can only get a maximum of 3 to show up, regardless of how many there are. I have this code in the ...
1
vote
1answer
465 views

How do I create my own nested meta_query using posts_where / posts_join?

Some of my posts (not all) have a price as a meta key/value. Today I use the pre_get_posts action so that my users can search for prices that are between a certain value. This is the code that I'm ...
0
votes
2answers
162 views

HM CMB: Post Select Field for CPT ID

'm using human made's custom meta boxes framework (https://github.com/humanmade/Custom-Meta-Boxes). Using the post select: array( 'id' => 'example-field-post-select', 'name' ...
0
votes
0answers
54 views

Show post when both categories are present but not one of them

I'm having issue filtering posts by category. There is the A category for posts (which is the default and also applies when no category has been set explicitly) and B category with subcategories for ...
0
votes
1answer
54 views

Wordpress Query showing multiple titles

I have written a query to display in a jquery slider (nivo) however it appears that it is showing all the posts and not just one at a time This is my code: <div class="slider-wrapper ...
0
votes
4answers
489 views

Query Posts by date range with fixed beginning and end

I need to get posts from a certain timeframe. I am using the posts_where filter. I want to specify a beginning date and an end date. This is the function I use: function filter_where( $where = '' ) ...
1
vote
0answers
107 views

BBPress Search results in Wordpress search

I want to display in Wordpress search results page - 10 or less found results from BBPress (plugin) forums. I know that BBPress use custom post types (forum, topic, reply) but I don't know how to do ...
0
votes
1answer
189 views

Query_posts works when appending via AJAX call wp_query doesn't?

I'm appending some posts on a click event to a twentyeleven child theme. For some reason though it only works when I use the query_posts loop and not a wp_query loop. For instance here's my wp_query ...
0
votes
2answers
278 views

Insert custom div between posts

I'm using twenty twelve and I need to insert a div between the posts. I'm not sure how to stop the loop, insert the div, and then restart the loop. Can anyone shed some light on this? Thanks.
0
votes
0answers
36 views

Limit posts displayed to 2 specific posts

I'm using the Twenty Twelve theme. I have created a basic page. What I want to do is keep 2 only posts (that I select) on the page at all times. In looking at the code I think this is the section that ...
0
votes
1answer
531 views

WordPress displays post on subcategory only

I'm using WordPress on developing a site and a self-made template. I got 1 page to display all categories with its post. This is what I want to do: Main Category subcategory1 post 1 subcategory1.2 ...
0
votes
0answers
38 views

Posts from current category on custom page

I have a problem - I want display posts from current category on page with custom template. I write something like this: <?php include 'header.php' ?> <div class='content'> ...
0
votes
1answer
106 views

custom query to get posts

I want to create custom links like mydomain.com/custom_page/cat=ABC&tag=XYZ So that when a user clicks on the link s/he can see all posts in the category 'ABC' having tag 'XYZ' For this I've ...
0
votes
1answer
483 views

Why doesn't my WP Meta Query return any results?

Is it not OK to accept a value from $_GET as the key in a WP Meta Query? I'm not sure why this code doesn't return any results... BOTH the queries for Price as well as bedrooms do not return any ...
0
votes
2answers
690 views

Filter archive.php by custom meta

I"m trying to filter an archive page by custom meta query. I've tried using query_posts($args) prior to the loop, but it returns nothing. Any ideas? Here's what I have so far: <?php ...
0
votes
1answer
433 views

Can I use WP_Query one time and then filter the results multiple times

I am using the following code 20 times in one page template to query specific data for each section. All of the pages data comes from the same post type, just I need it divided up by a specific custom ...
0
votes
1answer
117 views

Read more doesnt work with query posts

The tite says it all. If I comment out the query_posts it works, if I don't it doesn't. <?php // retrieve one post with an ID of 1 query_posts('p=27'); global $more; $more = 1; ?> <?php ...
0
votes
2answers
608 views

Two posts in same div - WP loop

I would need the following in Wordpress: <div class="posts-wrapped"> <div id="post-1" class="post"> <h1>Title 1</h1> </div> <div id="post-2" ...
0
votes
1answer
3k views

Advanced Custom Fields: query posts filtered by multiple field values

I have the following: custom post type: q-and-a custom taxonomy: q_and_a_category taxonomy terms: design, engineering, project-management I'm creating three separate pages that filter the custom ...
0
votes
2answers
67 views

The Loop isn't working

I can't get the loop to work as it's supposed to, without using the not-so-recommended: <?php query_posts('post_type=post&post_status=publish&paged='. get_query_var('paged')); ?> I'm ...
0
votes
1answer
211 views

Multiple Query_Posts

I am trying to put a query_posts inside a WP_query. Anything after my query_posts doesn't work properly. Here is my code. What am I doing wrong? <?php $args = array( 'post_type' => ...
0
votes
3answers
55 views

How can I access specific posts brought back by query_posts?

Specifically, I am bringing back the 7 most recent posts in Category A, but then I want to put the first posts thumbnail in <div id=A> and the second post's thumbnail in <div id=B> and so ...
0
votes
1answer
177 views

Custom post type archive page for multiple post types

Hi I am working on a archive page which I can use for multiple custom post types. I need to make a variable in the $args array which can change to the post_type name on the basis of <?php ...
0
votes
2answers
529 views

get contents and permalink from a specified page

below is a query where it supposed to get a contents from a page by a specified page title <?php $page = get_page_by_title( 'About Us' ); $content = apply_filters('the_content', ...
0
votes
1answer
103 views

How to get posts ordered by using their categories?

I have a page where I've got all the products on a single page. -- Link to the test site. What I'd like to do is to get the products ordered using their categories. Juices, nectars, concentrates, ...
-1
votes
2answers
2k views

Achieving pagination with `query_posts`

I'm using query_posts to build a list of posts from a single category, and I'm trying to add pagination to this setup. Here's my code: <ul> <h1><?php the_title(); ?></h1> ...