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)

3
votes
1answer
92 views

Wordpress “Loop” with large set of results

I'm not sure the appropriate terminology but I have a wordpress "loop" for a custom post type that has roughly 300 results that all get displayed on a single page (no paging). The causes an enormous ...
3
votes
2answers
197 views

How do I prevent one of two multiple loops from repeating on a second page?

I have a page with multiple loops, but the first loop repeats on the second (or Older) page. I want to keep the formatting but stop the post from repeating. You can see the problem here: ...
3
votes
1answer
78 views

How can I create a loop to build slides based on multiple categories using Coda Slider

I'm using a loop to generate the slides I need for a Coda Slider slideshow. The slides should be pulling the most recent post from 5 different categories. The problem I'm having is that it's pulling ...
3
votes
1answer
2k views

how to display full post with pagination on home page

I am using the 'Hatch' theme. I'm familiar with HTML/CSS but not with WordPress, first time working with this. I have my homepage showing recent posts and that's good. However, I want to make a ...
3
votes
1answer
158 views

How should I intercept the main query and inject custom join / order by / group by criteria

I have a CPT that is a member of two separate taxonomies. On the taxonomy archive page for one of the taxonomies, I need to further group and sort on the second taxonomy like so: ...
3
votes
1answer
287 views

Installing wp3.2.1 on IIS; getting empty sessions

i have to install wordpress 3.2.1 on IIS 5.0 (yeah, i know...) here. Brand new default wordpress installation, no plugins ore previous versions installed. So, i downloaded the 3.2.1.zip and the ...
3
votes
1answer
138 views

Search widget breaks when using multiple loops?

I have created wordpress template that uses two loops via WP_Query object. Everything works fine except Search widget. I've been pulling my hairs out for three days now Googling like a madman,but ...
3
votes
1answer
496 views

Creating nested forum loops in bbPress

I'm creating a customised forums front page for bbPress, by listing forums in a different way to the bbPress default. Essentially what I'm trying to do is replace the use of bbp_list_forums() with a ...
2
votes
2answers
3k views

WP_Query and next_posts_link

I cannot figure out how to make next_posts_link() work within my custom WP_Query. Here is the function: function artists() { echo '<div id="artists">'; $args = array( 'post_type' => ...
2
votes
5answers
821 views

Get date of last update outside of loop

I'm trying to figure out how to display the date that a post was last updated outside of the loop. I'm able to display the published date using get_the_time() but there doesn't seem to be a "loopless" ...
2
votes
1answer
918 views

Is it necessary to reset the query after using get_posts()?

Is it necessary to reset the query after using get_posts() ? I have been looking at this page and I don't see any reference to get_posts() ... I can't make it out for sure from this page either. I ...
2
votes
2answers
1k views

“pre_get_posts” firing on every query

How can I change arguments for the main query only, and not affect other queries? add_filter('pre_get_posts', 'custom_post_count'); function custom_post_count($query){ ...
2
votes
4answers
13k views

Get excerpt using get_the_excerpt outside a loop

I have a code that call get_the_title() and it works, but get_the_excerpt() return empty. How can i make it work? This code is inside a plugin called "WP Facebook Open Graph protocol". Here's the ...
2
votes
2answers
2k views

Using a custom WP_Query with get_template_part loop

I have a query for a custom post type: <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $books = new WP_Query(array( 'post_type' => 'wiki', 'posts_per_page' => ...
2
votes
1answer
1k views

WP_Query vs get_posts

I have read a number of questions on SE regarding these but I still can't figure the exact difference wrt usage. Would it be true to say that I would probably use WP_Query for the majority of ...
2
votes
3answers
750 views

How would I go about listing only unattached media in say a sidebar?

I have a client who uses PDF files for their newsletter, I don't think that this is a good idea personally, but it's not negotiable. They have a news page where they put real time news and they'd like ...
2
votes
3answers
3k views

How to use a custom post type as front page?

I would like to set a site's front page to be a single post from a custom post type. I have been able to alter the request for my front page to a Custom Post Type archive with the following code ...
2
votes
4answers
3k views

Print Current Post Index number within Loop

I'm working on WordPress where I have following code to get posts within loop. <?php $posts = $woo_options['woo_latest_entries']; ...
2
votes
1answer
3k views

Sort pages in loop by admin's page attributes order field?

Is it possible to sort pages in the loop using the admin's order field (under page attributes)?
2
votes
1answer
9k views

wp_pagenavi() with custom wp_query()?

<?php /* Template Name: Projects */ ?> <?php get_header();?> <section id="content"> <section id="main"> <?php $loop = new ...
2
votes
2answers
212 views

Query for posts in 2 taxonomies

I am currently using the following code to display a list with links to posts in a specific CPT and taxonomy: <?php $custom_terms = get_terms('videoscategory'); foreach(array($custom_terms as ...
2
votes
2answers
68 views

Why does this loop only work on the homepage?

I've been trying to figure this out all day now. Consider the following code below: <div class="slider"> <div class="slides"><?php wp_reset_query(); ...
2
votes
1answer
1k views

Pagination with custom post types results in 404 issues

I've a very simple index.php: <div id="content"> <? get_template_part('content', get_post_format()) ?> </div> <div id="pagination"> <? previous_posts_link() ?> ...
2
votes
1answer
437 views

Multiple Loops Homepage?

I have been pretty impressed with the recent redesign at WebDesignerDepot and I am curious about the mechanics of their homepage. I like how they have featured post sections that break up the monotony ...
2
votes
1answer
330 views

Find most recent authors

What I'm looking to do it get the 16 latest posts from 16 different authors. In other words there would be the 16 latest posts, but no one single author would have more that 1 post on the page. The ...
2
votes
1answer
2k views

Using the Loop to show all levels of subpages under a parent page? Halfway there

I have a need to make the Loop run through all of the children of a parent, all of the children of each child, etc. The reason I need the Loop instead of a listing tag like wp_list_pages is so that I ...
2
votes
2answers
803 views

Fastest way to loop through all posts?

I need to run a background process in a plugin that does some work on ALL the posts in a person's database once the plugin is installed. I'm very new at working with wordpress so my research has shown ...
2
votes
2answers
2k views

Ajax loop refresh on click

I display a random post loop on a page. I'd like to put a "refresh" link to refresh the content of the loop via ajax. Is this possible? This is my loop if it helps: <ul ...
2
votes
1answer
202 views

Can't show comments count per post outside loop

How can I show the amount of a comment per post outside the loop? I tried this in a function already: ' . get_comments_number . ' , but that outputted the text "array" on the screen... What do I have ...
2
votes
2answers
238 views

How to show a category post to a specific registered user

I'm working a private blog and I'd like to know if this can be done with any other plugin or any other way: Lets say we have 3 categories: CA, CB and CC, and 3 users, UA, UB and UC, all of them can ...
2
votes
2answers
246 views

Splitting the main query in multiple loops with query_posts and/or pre_get_posts?

I have a custom post type 'events', to which I have associated a custom taxonomy 'calendar'. The calendar has 12 fixed terms, for each month of the year ( 'august', 'october', 'november, etc.). I'm ...
2
votes
2answers
1k views

How do you split multiple-column loop on category archive page?

I am creating a custom page template with multiple loop like this http://demos.gabfirethemes.com/advanced/category/football/ You can see there are posts split up into multiple columns: One featured ...
2
votes
1answer
389 views

Multiple Queries and Excluding Repeating Posts?

I'm trying to work out how to exclude posts used in the first four custom queries in the last typical query.. haven't been able to find anything that will explain how to do this clearly. My First ...
2
votes
1answer
482 views

add_filter() doesn't work in loop

I'm trying to order the posts in the home page by modified date, and I put this code in the functions.php of my active child theme: function orderby_last_modified() { return 'post_modified DESC'; } ...
2
votes
1answer
999 views

save_post + insert_post = infinite loop

I'm trying to automatically create a new post when a post containing a certain custom field is saved - hooking an insert_post function into save_post. This generates an infinite loop. I found some ...
2
votes
2answers
1k views

Manually set global $post vars with an ID, in order to use template tags

I have a function retrieving ID's of posts by very specific means. I need to be able to set the global $post in order to use functions like the_content(), which does not allow an ID as a parameter. ...
2
votes
2answers
796 views

The main Loop is not starting in a custom blog template page

I made a custom template for the blog section of my page. I even set post page to Blog. I created a custom post type called Page Content and the posts are retrieved in the #feature div. But the main ...
2
votes
3answers
6k views

How to Change Loop to Order Posts by Views (using wp-postviews plugin)

I hope somebody would be kind enough to help. I currently have a page that orders all of the posts by comment count, but I want to change the loop to order the posts by view count. I have installed ...
2
votes
1answer
224 views

Endless loop with wp_insert_post and wp_update_post

I have an array $unqiues which contains URL's, I loop over the array with the code below to get the URL titles, insert a new post, update the post meta. Then I change the the posts title and name to ...
2
votes
1answer
131 views

Why execute the_post()?

When I'm getting custom post types with WP_Query->query(), it isn't really necessary to execute the the_post() function, because you can iterate over the query result array. Is it considered good ...
2
votes
1answer
337 views

Display Latest Post from all Categories

I am trying to loop all the latest post from all the categories but it is displaying only a post from single category. Below is the code that I am using. <?php while (have_posts()) : the_post(); ...
2
votes
1answer
1k views

Is it possible to define a template for a custom post type within a plugin independent of the active theme?

I'm writing a plugin to manage data about open-source projects. I developed an object model and have successfully created all custom post types and taxonomies, as well as implemented the correct ...
2
votes
2answers
534 views

Modify this loop to fit my jQuery slider (slides)

I´m trying to make a slider which takes thumbnails from a certain custom post type and displays for of them for each "slide". I get the slider and thumbnails to work like they should, but I´m unsure ...
2
votes
2answers
866 views

Broken pagination

Well I'm here again with almost the same problem as I had in this post three weeks ago, but let me explain what has happened since then: I was originally using one loop to display the most recent ...
2
votes
1answer
217 views

Paging on a future post loop?

I am trying to get paging to work on my future post loop, but to no avail. I am getting no links, when I expect them at the bottom, for pagination despite there being several valid posts in the ...
2
votes
1answer
97 views

How can I let users to access plugin functions based on roles?

I use a plugin called "Live Edit" to let authors and editors edit the content front-end. But the issue is that the plugin lets any logged in users to edit the content. I want the edit(specified by ...
2
votes
1answer
199 views

the_title(); works in a page template, outside the loop. Why?

Trying to wrap my head around the loop concept... Given a template page (page-work.php) with just this code: <?php the_title(); ?> WP correctly shows the title of that page. As I understand ...
2
votes
2answers
214 views

Auto Refresh Post List after X seconds

i'm new in wordpress, and i really need a help here. My main site, list the resume (excrept) of all posts, with pagination. But when a user publish a new post, the only way to see it on the main page ...
2
votes
1answer
20 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 ...
2
votes
3answers
147 views

wordpress loop and template files

I am curious how WordPress know that if I have a category.php and do the basic loop inside there that when I click on category A I get all of A's posts. The reason I ask, is because I have seen themes ...