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
1answer
233 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
214 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
426 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
151 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
53 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
416 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
99 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
161 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
233 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
503 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
105 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
446 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
544 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
350 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
106 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
526 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
2k 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
200 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
168 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
462 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
100 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
1k 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> ...
0
votes
1answer
260 views

'category__and' for custom taxonomy?

I've a custom post type 'post-type-x' and three custom taxonomies attached with it 'taxonomy-1', 'taxonomy-2' and 'taxonomy-3'. I want to retrieve all the posts that have custom taxonomies ...
0
votes
1answer
244 views

Getting images from media library and get_the_date() not working

I've got a function to display all images in the media library on a page. I would like to display the date of each image, but using get_the_date() only returns today's date. Here is the code I'm ...
1
vote
1answer
120 views

Adding conditional content to single post-type template

I have a new custom post type set up that will be where an online copy of our email newsletter lives, like any web-based archive of newsletters. I am trying to create a conditional statement to add ...
1
vote
1answer
83 views

Multi row post list

I'm trying to create a 'two posts per row grid'. Here is the template i made: <div class="row"> <div class="span2"> <?php get_sidebar(); ?> </div> <div ...
0
votes
0answers
42 views

Custom Fields & Posts

I've got one template, which I use on many different pages. The problem is that I want to show different posts according to their "pagename" category. Ex. "About" is going to show "About category" ...
1
vote
1answer
440 views

Checking for two categories in query_posts

How can I check two category_name values in the following query_post? <?php query_posts('category_name=recent-work&posts_per_page=1'); if (have_posts()) : while (have_posts()) : ...
0
votes
0answers
153 views

Post Filter clearing on pagination $_post

I have a form, in which users can select what taxonomy they want the posts filtered by. It works fine except that it doesn't paginate. When I click on the next page of results, it clears the query. ...
1
vote
1answer
94 views

Get posts between custom dates

I created an event CPT and a meta box with a date. I saved the date as post_meta in the form dd.mm.yyyy. Now I want to create a shortcode that queries all posts which's dates meet the condition ...
0
votes
1answer
338 views

Multiple instances of query_posts

I need to have 8 of these on a single page. Each post list will be in its own numbered switch tab. Is there a better, more efficient way of doing it? <div id="tab1"> <div ...
0
votes
1answer
317 views

Order posts alphabetically: how to set order=asc in mysql query?

I have this function: global $wpdb; // adjust the query to fit your needs $posts = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE post_type = 'post' ...
0
votes
1answer
230 views

Alter post order on taxonomy template

I have a taxonomy template that is returning the correct posts (actually a custom post type) but I want to alter the order in which the posts are displayed. However, nothing I've tried will change the ...
0
votes
1answer
1k views

Custom category search box for WordPress

I've seen plugins that add an additional drop down list of categories to the standard WordPress search bar, however this doesn't really help me at all. My site has a lot of posts in a lot of ...
0
votes
1answer
100 views

Pagination broken on is_front_page()

I'm trying to display the first image attachment from each post on the front page of the site. This code below works on other pages, however pagination does not work on is_front_page(). First page ...
0
votes
2answers
80 views

4 posts per page from single category

I've been trying to display posts that I've categorized as "news-categories". My goal is to only display 4 posts on sidebar of "cbs-news" slug underneath "news-categories" category. By below mention ...
0
votes
1answer
3k views

Twitter bootstrap carousel multiple items in carousel

I'm pulling in posts from a specific category using twitter bootstrap carousel rotator. I've looking into double loops but I can't figure out how to implement it. Here is my loop: $query = array( ...
1
vote
2answers
361 views

Error sending array of inputs

Hello I am getting a Error of the Wordpress includes, this error appears when I post the multiple values of a taxonomy <form role="search" method="post" id="searchform" action="<?php echo ...
0
votes
2answers
74 views

WP_Query articles order by offset in collumns

The code below wants to show a list of articles in two collumns. <?php $i = 0; $the_query = new WP_Query( 'showposts=35&offset=0' ); while ($the_query -> have_posts()) : ...
0
votes
2answers
76 views

While loop articles - if statement order

I want to show a list of articles, but I want to show in the 1st place my second article and after it the last. Eg: Article 1 Article 2 Article 3 Article 4 to be: Article 2 Article 1 Article 3 ...
0
votes
2answers
294 views

Use WP_Query or query_posts() or get_posts() for optimizing a site?

I have read other answers, but I don't understand which is more fast (the best and simple for slow server running)? I have a website with over 1 000 000 hits /day and a slow server with limitations ...
0
votes
1answer
179 views

Return category slug / title from category ID

I have a custom field set up that returns the category ID of a chosen category, I'm looking to use this category ID to show, in one instance: category slug, and another instance: category title. The ...
1
vote
1answer
48 views

How can I sort homepage by a meta value?

I am trying to sort my home page posts by a custom meta value. I've been told I should use pre_get_posts but I seem to not be implementing it correctly. This is what I am doing: ...
0
votes
1answer
132 views

Advanced WP Query and/or

I'm trying to create an advanced, reusable query function. I need to query by category OR a category + a tag. I know how to do this with custom fields (meta queries) but how do I do it with simple ...