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)

1
vote
1answer
1k views

Post Format single-loop.php using get_template_part

I have set up to use post formats gallery and video in addition to the standard. I am editing the loop-single.php to give it different layouts for each post format, but I'm to include ...
0
votes
1answer
327 views

Loop doesn't work in single-product.php page but works at normal page

I'm outputting a list of categories with the posts inside the ul. This works fine on a normal pages but not on the single-product.php page. It breaks on the single-product.php page with the line ...
0
votes
3answers
3k views

Building a form with WordPress, and also pulling that data for a user page

I am going to give the most basic example of what I want to achieve. I have a page for booking a pickup service, and a form needs to be created to take information of the following. (Date, # of ...
0
votes
1answer
78 views

Last class on last headline?

I have the following code which should add a last class to the fourth post but doesn't appear to be, what is wrong with this coding? It show's 4 posts fine but the fourth one doesn't have the class ...
0
votes
1answer
909 views

Loop info in jquery Tabs - loop into a variable?

I've got three loops set up via jQuery UI tabs as seen in my code below. All works good but i'd like to be able to display the "count" of each loop in the tab label. I obviously can't just echo it ...
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 ...
0
votes
1answer
111 views

What PHP Needed to Make One Loop with Multiple Styling?

I understand that there is a way to have the loop display multiple ways on one page without using multiple loops... Or in other words something like: <?php if (have_posts()) : while (have_posts()) ...
0
votes
1answer
744 views

Blog pagination WITHOUT using max_num_pages

WP 3.2.1 I'm in a bit of a bind. I have to create some pagination for the blog, but I believe I'm running into the bug described here, and I don't have authorization to fiddle with the server's php....
0
votes
1answer
1k views

Page with Multiple Loops Breaking Pagination

I made a customized index.php so that I have multiple loops on the same page so that the content can be displayed differently. I got this to work, however the pagination is broken. Despite several ...
1
vote
1answer
335 views

Custom loop with conditional statement to separate each terms

Let's say for example: I have a custom taxonomy called "fruit", which has 3 terms "apple", "orange", and "grape". So in order to get all the posts within all these three terms, I would : $args = ...
1
vote
1answer
829 views

Loop through child images of a parent for a Nivo Slider

I want to use a Nivo slider to cycle through the children of a parent page one by one, how can I do that? I have the following piece of code that grabs ALL the children of a parent page and displays ...
1
vote
2answers
760 views

Pagination on 2nd loop

OK, I am creating a business listing site that is using a custom taxonomy for the listing "type". I need to display two loops on the taxonomy archive page, one for "sponsored" listings and one for ...
1
vote
2answers
2k views

Single page site (Wordpress) including posts

I'm creating a single page site and obviously want to include the blog posts. I'm currently looping through the pages and using the_content() and the_title() to display them. However, the_content ...
2
votes
2answers
506 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 ...
0
votes
1answer
85 views

Post variables not displaying correctly in custom function

There seems to be something wrong with the simple function below, but I can't figure out what it is. It is displaying as the following and I can't figure out why. I know it has something to do with ...
1
vote
1answer
553 views

Paginated HTML Sitemap

I've got to the point where I needed to break down my HTML Sitemap into several pages. It contained 2000+ links. The big layout was showing all post titles under category names on one page. I decided ...
0
votes
1answer
93 views

How do I hide posts in a category from all listings but still allow the posts to be viewed?

Let's say I have a category named "Hidden". I'd like to prevent all posts in "Hidden" from appearing within The Loop on the main blog listing page. Also, I'd like to prevent those posts from ...
2
votes
1answer
903 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?
0
votes
2answers
373 views

Related terms - Terms that feature in post of current term

Not sure how hard this is but i'll try and explain it as simply as possible. I have a custom post type called: "Movies" with an taxonomy term called "Actor" For example purposes suppose were on the ...
0
votes
1answer
47 views

Calling Posts from Specified Cat

The following is not working to call posts from a specific category and only grab the number of posts selected. I'm using more than one loop on a page as I am using this to create a "featured content"...
-1
votes
1answer
170 views

new line after the_content

Trying to properly indent a theme I wondered if it would be possible to create a new line "\n" directly after <?php the_content(__('Continue reading <span class="meta-nav">&rarr;</span&...
0
votes
1answer
92 views

Use Author Ids or Names to echo different output inside loop

Is there a way to use the author ids (or names) to echo different output for different authors (in this case author id 7 and author admin? I tried the following but it didn't work. ?php if (...
0
votes
2answers
593 views

Please help me to win the battle with 2 column loop by category

I need help with this code. How can I change the code so that the posts from one category to be arranged like the this scheme. scheme picture <?php query_posts('cat=3&amp;...
0
votes
1answer
444 views

If/Else child list for Custom Post Type single template within loop?

I'm trying to add a feature to my 'Services' custom post type single template that displays one thing if the post type has one or more child post types and another thing if it doesn't. So far I've ...
0
votes
1answer
630 views

Using PHP Increment and Conditional Statement to Alternate Loop Background

I'm trying to alternate the background on a theme page that is displaying a custom loop: $args = array( 'post-type' => 'portfolio', 'posts_per_page' => 10 ); $loop = new ...
1
vote
1answer
797 views

How to hide all child pages with post_query?

i have a page template as start page(home.php). i use a 2 columns grid to display all pages on that home.php with title and excerpt. unfortunately also my child pages are shown and i can't figure out ...
0
votes
2answers
1k views

Page not found yet the posts are listed?

OK, seriously. I have a really modified index.php. The result: after the second paginated page, the page returns Not found and 404, while the posts are shown already. Can anybody tell me, what it ...
0
votes
1answer
128 views

Broken pagination, need help figuring out why!

I just tried slapping together a poor-man's "featured post" section with this exact code out of my index.php: <div id="post-wrapper"> <?php if (is_home() && !is_paged()) : ?> ...
0
votes
2answers
612 views

Simple foreach loop help needed in wordpress “the loop”

I need a foreach loop inside "the loop" This is my current code (index.php) : <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div><a href="<?php the_permalink(); ?...
0
votes
2answers
402 views

wordpress showing all posts instead of date range

When going to http://craigmdennis.com/articles/ Wordpress uses the index.php template. When you go to http://craigmdennis.com/2010/05/ Wordpress uses the same template (markup below) but shows the ...
0
votes
1answer
59 views

Wrapping x posts in html without leaving empty html

So I'm trying to spit out unlimited numbers of posts for this wp_query, 6 at a time, each one being wrapped in <dd> so that it functions with my jQuery slider. The problem is, if I have exactly ...
0
votes
1answer
139 views

An action that runs after each post in the loop on index/archive page?

Is there an Action/a Filter that runs just after each post/post excerpt is displayed on these 2 pages? I use the_content and get_the_excerpt currently, but the_content causes a conflict with some ...
0
votes
1answer
86 views

Enabling users to control custom loop's query

Let's say we started a custom loop: <?php $custom_posts = new WP_Query(); ?> <?php $custom_posts->query('post_type=post&category=Uncategorized&orderby=epo_custom'); ?> <?php ...
0
votes
1answer
2k views

get_the_title and get_permalink outside of the Loop

I'm trying to list the parent to a page in the sidebar. I can get the parent-page ID. I can get it to print with a print_r function, but no matter what I try I can't get get_permalink and ...
1
vote
1answer
41 views

replacing the_autor or make callback

I'm looking a way tho change the the_author(); function in the loop, I have post meta data with the name of the user who posted. I need to do this: If the user is registered, show the_author();, ...
-1
votes
2answers
2k views

Custom post type and have_posts() return empty result

I'm very confused regarding the have_posts(). It returns an empty result even though I have one post that match the query. The below code is used in a widget which should display exactly one post, if ...
1
vote
2answers
1k views

Very Slow Page - How to Optimize # of Queries?

EDIT 12/19/2011 Thank you again Ijaas. Everything is working except for the order of the days. It is ordering the groups of days by the publish order. If an older post has a newer date in its ...
0
votes
1answer
2k views

Display metabox title for custom fields with values

I'm using multiple metabox panels in my write posts. IN my functions I'm registering multiple metaboxes: $prefix = 'dbt_'; $meta_boxes = array(); $meta_boxes[] = array( 'id' => '...
0
votes
1answer
701 views

Magazine style frontpage with multiple categories/loops and no duplicate posts

I am migrating a static magazine site to wordpress. I would like to have a frontpage displaying multiple categories with a few posts in each, e.g "politics", "environment", "health" and "technology". ...
0
votes
1answer
713 views

How to sort posts by the average of comment meta values

Here's the situation- I've customized the comment submission whereby users can provide a rating, and this gets stored as a meta value in the commentmeta table. I can query to return the average ...
0
votes
1answer
1k views

Custom Post Type Query W/Category Dropdown

I'm having a bit of trouble getting a custom post type query working coming from two drop downs. Let me show you what I'm using: The Form: <?php require($_SERVER['DOCUMENT_ROOT'] . '/wp-load.php')...
0
votes
1answer
61 views

Custom fields in post later used in loop

How i can add custom fields to custom post templates, and later print them in The Loop? Better explanation: I want to have a custom field in "Add New" window, which will be added as some meta data to ...
0
votes
1answer
484 views

Retrieve IDs from custom field, count and display results differently according to count

The function below is inside a single post loop. I have an array of IDs in a custom field. Such IDs represent related posts. I'm using Advanced Custom Fields (ACV) plugin and I manage the custom ...
0
votes
1answer
3k views

When to use Wordpress loop or Foreach loop?

Under what circumstances would you, (should you?) use a foreach loop, instead of the wordpress loop. I have no real coding need, but I'm curious. What's good practice here? Should I: $args=...
0
votes
1answer
959 views

$wpdb->flush(); breaks the loop

I am using $wpdb->flush(); at the base of my page in an attempt to prevent the query executing multiple times due to caching however it seems that it isn't flushing the most recent query but the ...
0
votes
1answer
533 views

MySQL query performed 4 times inside loop

I have enabled custom php in my pages through the use of the exec-php plugin so I can run more complex pages than the standard WordPress page. I have had no problems with this plugin so far. I have ...
2
votes
1answer
88 views

Different Queries Return Same Results [closed]

EDIT: After fiddling with the loop a bit, it somehow corrected itself. At the end of the day the code remains the same, only now it's working. http://sct.io/tt95p4 - development site. Scroll down ...
1
vote
1answer
136 views

Rating system and changing the loop

Alright, so I want to see who can help me implement this idea I have. I just want one single Icon next to a post. If you click it, then you "Heart" it or "Love it". The post has a counter to see how ...
0
votes
1answer
1k views

Changing WordPress sort order for returned child pages

I have a custom WP_Query that looks like this: $this_page_id=$wp_query->post->ID; $images = new WP_Query( array( 'post_type' => 'menu-item', 'post_parent' => $this_page_id ) ); My ...
-1
votes
1answer
267 views

Custom Page Template and Category Exclusion

I have a blog (bernsteinbear.com) that uses the TwentyEleven theme. I'm trying to make a custom page template for the front page (a blog page) that gets all the posts except in the "Comic" category. I ...