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)

2
votes
1answer
350 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
868 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
44 views

Show posts without term

I am working on a product page where I show reviews from my post type 'reviews', if the product page title matches with my term from the taxonomy 'review-product'. Example. Product page title: ...
2
votes
1answer
353 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
296 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
307 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
423 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
597 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
1k 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
3answers
655 views

Why am I getting an infinite loop with have_posts?

I have the following code, which causes an infinite loop for some reason. Can anybody explain what's going on please? Thanks! <?php $flagged_stores = new WP_Query( array ( 'post_type' => ...
2
votes
2answers
2k 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
843 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
8k 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
248 views

Wordpress Custom Query to show posts from last x years

I have found a way to show all posts from the current year with this code: <?php $today = getdate(); $lastyear = $today[ 'year' ]; $args = array( //'nopaging' => true, 'paged' => ...
2
votes
1answer
127 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
139 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
2answers
424 views

Wordpress Loop - Style rows of posts differently

I am trying to adapt the Wordpress loop to style posts differently in rows that get infinitely smaller until all posts are displayed The concept here is to display posts in rows first row 1 post ...
2
votes
1answer
473 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
2answers
745 views

posts page - different lengths of excerpt

is it possible to get wordpress on the posts page to do the following example. the first three posts need to have a large image spanning the width of the title box and a longer excerpt. the rest of ...
2
votes
2answers
664 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
1k 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
237 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
638 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
336 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
22 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
169 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 ...
2
votes
3answers
303 views

Exclude category from loop not working

I have this code in my index.php file. I have a different template for a static home page, this is the blog page. I'm trying to exclude all posts with the category "new" which is tag_id "13" <?php ...
2
votes
2answers
803 views

The correct way to call posts with ajax

I'm trying to write an image gallery plugin with jQuery. I'm using jQuerys $.post AJAX method to send and receive info from the relevant post page. Basically I'll be looping through the attachments ...
2
votes
1answer
822 views

Generating dynamic Tabs with multiple query post loop

I am trying to generate a dynamic tab based navigating with query post my code is like this <div class="tabbable"> <ul class="nav nav-tabs"> <?php ...
2
votes
2answers
502 views

How do I override part of the main loop in my child theme?

I have a child theme based on the twenty ten theme which I am happy with except for one thing. My gallery posts (I am a photographer so the goal of my blog is pictures) do not show any images from ...
2
votes
2answers
746 views

How to order posts tag by tag?

I want to order my posts by tags with only one WP_Query() In my WP_Query I would like to display 2 posts with tags portrait 2 posts with tags paysage 2 posts with tags portrait 2 posts with tags ...
2
votes
3answers
769 views

Wordpress query by category, sorted by custom field

I have three custom fields set for each of the posts in the events category — year, month, and day. I am already querying for the events category, and now I'd like to sort the posts by the custom ...
2
votes
2answers
391 views

How to order results by date and meta key?

I'm using wp-postratings to rate posts which stores the rating as a custom meta value ratings_score. It gives you the option to use r_sortby to order the loop by highest rated but I want to give it a ...
2
votes
2answers
455 views

How WordPress converts URL to $query_string

My home.php shows a list of (N) posts and << Previous & Next >> links. When clicked, I want to fetch previous/next list of (N) posts using Ajax. This is: I do NOT want to load the entire ...
2
votes
1answer
733 views

Why do themes have `while( have_posts() )` in templates like single.php?

Example: https://github.com/markjaquith/WordPress/blob/master/wp-content/themes/twentyeleven/single.php Isn't single.php's purpose to show single posts?
2
votes
2answers
6k views

get custom post type by tag

Is it possible to retrieve post entry for a custom post type by tag, I have been trying with the following code, however it just locks me into a infinte loop. <aside class="supporting_images"> ...
2
votes
1answer
599 views

Editing the loop for Author pages

I was wondering if anyone can help me out. I am looking to remove the_content part of the loop on my author pages only. So basically, I just want a list of the author posts with only the title and ...
2
votes
1answer
984 views

the_excerpt(), get_the_excerpt() and the_content() all killing “the Loop”

Before I call the_excerpt(), the_permalink() displays the correct thing. Afterwards, it does not... <?php global $query_string; //strip out the ...
2
votes
2answers
639 views

How to list custom post types?

Here's what I'd like to do: a) Create a custom post type and write panel for a menu item called "My Stuff." b) "My Stuff" will behave like a category -- but the content will not appear in the main ...
2
votes
1answer
726 views

How to dynamically build a multiple taxonomy query loop within a post type's single loop?

This question is a little different then the others floating around here. The most similar one is "How to get the parent's taxonomy ?". I have a music cms setup that utilizes two post types: album ...
2
votes
1answer
552 views

Listing Parent, Child and GrandChild Categories and then the PostTitles on Page Template !

What I want to do is a loop like this is something like this I'm really sorry but its hard to format here! I going to put this short url http://pastebin.com/dEdKzgJz so you can see it better... Can ...
2
votes
0answers
109 views

Chopping up a large ajax request of around 200 posts [closed]

I've put myself into an uneasy situation, where I have roughly 200 posts I need to load in with jQuery .load(). Nothing shows up until the whole .load() has executed, of course. Takes roughly 3 to 4 ...
2
votes
1answer
136 views

Impossible to get Attachments Outside Wordpress?

My page (outside the wordpress install) begins something like this: global $wpdb, $wp_query; define('WP_USE_THEMES', false); include_once 'word/wp-blog-header.php'; $args = array( ...
2
votes
0answers
3k views

AJAX with loop filtering categories

I've been researching on how to make my loop with AJAX. I found some codes online and modified some parts but I can't seem to get it to work. This is my code for the loop: <article id="main" ...
2
votes
1answer
501 views

Enable infinite scroll on single.php [closed]

I have a problem similar to the author of this thread: Possible to paginate on single.php? I am trying to enable infinite scrolling on single.php. So far I successfully load an additional 1 post when ...
2
votes
1answer
1k views

get_template_part from plugin

This is default get_template_part function inside WordPress: function get_template_part( $slug, $name = null ) { do_action( "get_template_part_{$slug}", $slug, $name ); $templates = array(); ...
2
votes
2answers
331 views

single page site with subpages

i want to make a single page site which has subpages with following structure about us team -member1 -member2 contact and i want the output to be like <div class="about-us"> team content ...