The core of the WordPress query, the loop offers an easy way to access post information and display it on your website.

learn more… | top users | synonyms (3)

0
votes
1answer
9 views

Collect Data from NEXT item while in loop

I am trying to get the value of a custom field. The trick? I'm in the loop, currently printing out 2 of 5 for this example. I would like to get some info from 3 of 5 (or even 1 of 5) while printing ...
4
votes
1answer
112 views

How can I save an array from a random post sequence for later use?

I'm building a random workout generator on Wordpress to help with my fitness, and am stuck at saving random post arrays for later reference. I'll explain. The generator should work in two main ...
0
votes
2answers
42 views

show posts from one category with comments only

Would anybody have a good idea for getting the WP to spit out all posts from a category with (approved) comments only? I have an ecommerce site set up, and treat comments on product posts as ...
0
votes
1answer
29 views

Pulling in a particular post into a single page based on the post id passed into the code

I currently have a page on a site that I am developing and that contains a loop which loops through 4 posts contained in a custom post type called Treatments. ...
0
votes
1answer
135 views

Upcoming Event: How do I sort database by custom date field, but ignore past dates?

I am using an events plugin and struggling to get my database query to be perfect. The query is on the event-single.php template. What I need the query to do: Query the "events" custom post type ...
0
votes
0answers
84 views

Foreach displaying all posts and not the value set in WP back end

Pagination just isn't working correctly with my foreach code. I have to manually set the post per page count for it to work but I'd like it to use the WP back end value (Set in settings > reading) ...
0
votes
1answer
77 views

2 loops in blog homepage

I would like to have to query loops running on my blog homepage: Featured posts on top displaying 3 posts from the category : "Featured" Underneath it just the basic loop of wordpress which display ...
0
votes
0answers
6 views

Displaying featured posts along with regular posts [duplicate]

in my homepage blog, I am trying to display 3 "Featured" posts on top and the rest of the posts at the bottom which means: The 3 "Featured posts" are taken from a "Featured" category underneath it ...
0
votes
1answer
123 views

post__not_in not working for custom post type [closed]

I cannot get the 'post__not_in' parameter to work properly in my theme. I have a custom post type 'event'. I'm in this theme file: single-event.php <?php $args = array( 'post__not_in' => ...
0
votes
0answers
16 views

How to sort through and display several CPTs on a single page

I built this site http://sparkfitnessbootcamp.com/ However, everything has been hard coded and is very difficult for the users to manage. So I want to create CPTs to make everybody's life easier. ...
1
vote
1answer
76 views

Pagination go to first page if i'm on last post

I have a custom post type and used get_next_post() and get_previous_post() to create a simple pagination. However i need to create a pagination loop (if that is the correct term). If i'm on the first ...
0
votes
1answer
38 views

Order custom posts by taxonomy?

I have the following custom post types: books, documents, examples, guidebooks, onlineaids. They were generated by the following code: ...
0
votes
1answer
82 views

wordpress change the loop order by dynamic value

At the moment i have a custom field named "price" to order my posts correctly. The following already works: $query_args['meta_key'] = 'price'; $query_args['orderby'] = 'meta_value_num'; ...
0
votes
2answers
249 views

Custom Post Type on Homepage - Studiopress Genesis Framework

I have used to below function to register a new 'guide' content type: add_action( 'init', 'guide_post_type' ); function guide_post_type() { register_post_type('guides', array( 'label' ...
0
votes
0answers
70 views

How to display custom post types by custom taxonomy in while loop?

I am using Posts 2 Posts to display a custom post type on a page. Document status, document author and feedback due date are custom fields. Package is a custom taxonomy. I want to display my custom ...
0
votes
1answer
62 views

Adding a featured image to a foreach Wordpress loop

I just found a clever piece of code on line which allows Wordpress posts to be displayed in side by side columns and works great with the title and post excerpt that I want to display. However I ...
0
votes
1answer
17 views

using the loop on a page

I'm trying to display the excerpt of the most recent post and just the titles of the 4 previous posts before that at the top of a page and display the content of the page below. I have a solution ...
0
votes
0answers
25 views

Including author posts and custom post types in the same loop

I have an author page with a special template I built for my purposes it's of course called: author.php it basically display some details about the author and his (or hers) latest posts. the problem ...
0
votes
2answers
107 views

the_title() shows title of the first post instead of the page title?

I'm occasionally facing this problem and not sure what causes it, any ideas? <?php get_header(); ?> <div class="content" role="main"> <h1><?php the_title(); ...
0
votes
0answers
51 views

Archive page - display specific post first

This is something I haven't heard of before but must be fairly easy to do? In the archive.php file, Given the id of a certain post (probably passed as a variable through the url) I want to know how I ...
0
votes
1answer
183 views

Permalinks for single-[custom-post-types] not working

I've been reading a lot about my simple issue, but wasn't able to find the simple answer, so, please excuse my noobieness. I have a custom post type registered in functions.php, like so: <?php ...
0
votes
1answer
94 views

How to use WP_Query() on single.php?

I'm using WP_Query() to pull out a few posts under a specific category "Featured" to display at the bottom of any post. So I added <?php if (function_exists('getEditorPicks')) ...
0
votes
0answers
39 views

WP_Query returns 100 results on homepage

Bit of a strange one this... I've recently migrated a site from wordpress.com to my own server. In the new location, however, wp_query always returns 100 posts on the homepage, regardless of which ...
0
votes
1answer
89 views

Loop through Custom Post Type, and then show children within each iteration

I am currently using WP_Query to loop through a custom post type, and only showing the parent posts like so: <?php $loop = new WP_Query( array( 'post_type' => 'programs', 'posts_per_page' => ...
0
votes
0answers
33 views

Price list, query/loop within query/loop

Price list, query/loop within query/loop. Hi all I'm developing a theme for a cafe. The page structure is something similar to Home | Menu | Starters - starter_1 - ...
0
votes
2answers
80 views

Contact information footer

I am new to Wordpress but forced to create a website as a Wordpress template for my current employee (I am a front end developer, mostly build new systems/apps etc from scratch). Creating the template ...
0
votes
1answer
81 views

If Loop has odd number of posts on last page Custom style for last post in it

My loop displays posts in two columns using this php <?php if (have_posts()): while (have_posts()) : the_post(); $count++; ?> <?php if ($count == 1) : ?> <div ...
0
votes
1answer
32 views

Noob Loop Question

I come with a basic question but I can not solve, I think that will be easy for you. I would like, if I have 2 or more post on loop, show the entire loop. I tried the following: <?php $paged = ...
0
votes
0answers
33 views

Retrieving Categories of posts which have a custom Taxonomy

I am working on an event management WordPress site which has multiple taxonomies (Photographer, Event Manager, Decor, etc). I want to create Taxonomy pages for each of these taxonomy (this is the ...
0
votes
1answer
83 views

Categories and page filtering with pre_get_posts

I have 3 pages, "Page 1" shows custom post-type "articles", "Page 2" shows custom post-type "tips", and "Page 3" shows both custom post-types. This is done conditionally with a custom loop in ...
0
votes
1answer
32 views

Loop not showing up on page template

I have a page template and on the page I have a loop such as: query_posts('post_type=post&posts_per_page=5&paged='.get_query_var('paged')); if(have_posts()){ while(have_posts()){ ...
0
votes
1answer
24 views

new custom theme - posts displaying on top of one another

live blog I've just implemented a new, custom theme. I've noticed that my posts are now displaying all on top of one another and I can't figure out why. To test my code, I swapped out my custom loop ...
0
votes
2answers
51 views

older blog posts not showing in new theme

I have a new, custom theme that I've uploaded on a pre-existing site/blog. Everything seems to be working ok, with the exception of the older blog posts not showing up. Any ideas what I can do to fix? ...
6
votes
1answer
111 views

Why am I being limited to ten posts on a custom loop?

For example, I have a link on my site like /tag/green and select content from all posts tagged green are shown using a file loop-tag.php which is about as simple as <?php if ( have_posts() ) : ...
1
vote
1answer
61 views

Get search.php results in header.php?

I want one image in header.php to change for different pages. The function in header.php looks like that: if(is_archive()): //change image to "Archives" endif; if(is_404()): //change image to ...
0
votes
1answer
44 views

Filter Category Loop Dynamically

I'm trying to display a custom loop with a dynamic category filter. As a setup I have categories of all usernames which are created once a user creates an account. So I am trying to echo the user's ...
0
votes
1answer
38 views

How to order posts in an arbitrary order?

I need to list posts in a very specific order that has nothing to do with the date of the posts or the title, or anything WordPress can figure out for me. I need this order to be used when I list ...
0
votes
1answer
37 views

Remove the_content From Loop

I'm trying to display a custom loop with only certain elements in it. My loop currently contains the title, creation date, author & content. However I am trying to remove the content for each ...
0
votes
1answer
249 views

WPML wp_query not working properly in one language

I have a wp_query for a custom post type and the custom taxonomy, the idea is top display the term name and below each term the associated posts. I have two languages Dutch & French. Query is ...
1
vote
2answers
79 views

Child_of not displaying all children posts.. via get_posts

I have put together this loop to display all children posts of the desired cat, but i am not getting any of the posts from one of the children cats.. Not sure if i am using the best method to ...
5
votes
3answers
274 views

Get 'page' number with infinite scroll

I added infinite scroll support of the Jetpack plugin to my own theme using this tutorial: add_theme_support( 'infinite-scroll', array( 'container' => 'content', 'footer' => false, ...
-1
votes
1answer
37 views

Get Posts From A Certain Post Type In An ID Array

I have some post ids in an ID array, like: $ids = array(20,34,65,126) ; There is many custom post types in my project, these ids are related to different post types, but I dont know which id is ...
0
votes
1answer
65 views

Display multiple custom post type lists on homepage - multiple loops

I've got to display 6 boxes on the homepage of a site I'm working on and struggling with the code. I've managed to get this far: <?php $term = get_term( hotelCategoryID, 'accommodation-category' ...
0
votes
1answer
22 views

Custom Post type showing up in loop, regular posts are not showing up

Every one knows the basic WordPress loop, every one knows that if you want just posts in a loop you put query_posts("post_type=post"); BEFORE the loop. which I have done. The problem is I have a ...
0
votes
1answer
29 views

New loop vs widget

So, I have a sidebar that I'm going to list all posts in, I could just use a widget. But is it proper to use a new loop instead of a widget, or preferential?
2
votes
1answer
17 views

Output shows a page instead of a list of blog postings

I have the below code in front-page.php (with that page set in Settings > Reading); however, something is wrong because the posts aren't showing. The output is shown below. Can someone identify what ...
1
vote
1answer
220 views

query_posts() vs get_posts() multiple loops [duplicate]

I have a template which initially had one single loop and it was using query_posts, I added 2 more loops using the same method, However after reading allot about these it was concluded that I shall ...
0
votes
1answer
43 views

WP_Query: query posts by ids from array?

I did quite a bit of research but can't figure why this wouldn't work for me? echo print_r($rel); // Array ( [0] => 63 [1] => 87 ) $args = array( 'post_type' => array( 'post' ), ...
1
vote
1answer
36 views

Create a loop that gets pages with their template

I am trying to make a template that will be an html5/ vertical scrolling base. I have created an amount of page templates that each would represent a <section> on index.php which mainly all it ...
0
votes
1answer
57 views

Modifying a Loop to Show More

This loop shows one featured post above 4 post titles from a certain category that is specified in the theme options. What I would like to do is show all 4 posts from the 4 titles, above the 4 ...

1 2 3 4 5 20