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
716 views

Multiple custom post type queries causing wrong post types to be grabbed in taxonomy + single templates?

Ok, this may be a bit confusing but here goes... Im working with several custom queries on the same page throughout my site. Some queries are grabbing regular post data, others are fetching CPTs ...
1
vote
2answers
1k views

Get a list of commas separated categories inside a loop

I want to get the list of categories of a post inside the loop. Normally, I would use the_category(', '); But this does output a link, and I only want the category name. Any ideas?
0
votes
1answer
426 views

How can I increase the post count for custom post types only?

I have the page count set to the default 10 in my reading settings menu. However, I use my template archive.php file for all post types, including posts and books How can I change the loop so that ...
5
votes
6answers
19k views

Display all posts in a custom post type, grouped by a custom taxonomy

I’m working on a member page where I use a custom post type with a custom taxonomy. My custom post type is called “member” and my custom taxonomy is called “member_groups”. I want to list all the ...
0
votes
2answers
2k views

While loop inside another while loop

OK, so I've read like 20 different articles about using a while loop inside another while loop, but still can't get this to work, and I'm about to burst from frustration. My scenario: using the ...
0
votes
1answer
1k views

how to json_encode(); the Loop content so that the encoded array is [“0”:content, “1”:content]

<?php $dVC=array(); query_posts('meta_key=featuredt&posts_per_page=5'); if (have_posts()) : while (have_posts()) : the_post(); $dVC []= $post->post_content;?> <div ...
1
vote
1answer
251 views

Adding general page content to page templates

If I'm creating a page template, let's say for example one for a testimonials custom post type I've created, I think I have it figured out that if I do the following in page-testimonials.php: ...
0
votes
1answer
239 views

The Pagination doesn't work

i have made a new WordPress Theme and ive done .. but i have one problem. I can't get the pagination work. I use the "wp-paginate" plugin and i have put the folloing code on my index.php <?php ...
1
vote
1answer
1k views

Custom post type multiple loop by taxonomy term

I would like to create one loop that lists the custom posts for each taxonomy term: Term A: Item Item Item Term B: Item Item Item I would like this to be totally dynamic so if I add a new term it ...
0
votes
2answers
578 views

Add class to last 3 posts in loop

I have this code so far, which adds the classes first, second, and third to every first, second and third post in the loop. It also adds a class to the first 3 posts in the loop. But how can I make it ...
0
votes
1answer
131 views

use custom field value as post category in loop

I have a page template and at the bottom, I want a loop of posts based on a custom field value - store_name This is what I have: <?php global $wp_query; $paged = (get_query_var('paged')) ...
0
votes
1answer
585 views

WP Query get only 1 post (sticky, not sticky etc)

I'm using WP Query & want to only return 1 post in a category. Either the most recent sticky else the latest post. Is this possible? Thanks, George <?php $category1 = new ...
0
votes
2answers
918 views

How to make the first post in the loop be styled like a “new / featured” post?

I hope i can explain this right , what im trying to do is use the default word press loop to show all my posts etc.. but for the first post I would like it to be styled completely different depending ...
1
vote
1answer
189 views

Sidebar loop - Thematic Framework

I'm trying to add a sidebar loop to list 3 news post. I'm using thematic framework and since I don't find any hook to use I first write this function in functions.php function sideloop(){ ...
0
votes
1answer
733 views

How to make multiple Column in archive Page?

I want to create multiple column on archive page but dont want duplicate posts please have look examples http://www.firstpost.com/category/business ...
1
vote
2answers
2k views

wp_list_categories: get latest featured_image of category

I was thinking about a nicer way to display the categories in my sidebar. Instead of a plain list style, I'd like to have images / thumbnails show up as well. Currently I'm using the following: ...
-1
votes
1answer
170 views

Implement “No related posts for this entry” into the loop?

For my related posts I have set up a scrollable container. I need the HTML to be outside of the loop or otherwise the layout will be a mess if there are no related posts to display (missing divs that ...
1
vote
2answers
1k views

How to determine if an admin is logged in outside the loop

I need to be able to tell if an admin is logged in ouside of the loop. This is needed for some php files that are part of a WP site but do not use require( '../wp-load.php ); What I need to do is ...
0
votes
1answer
289 views

Display content from “About Us” page on the Home Page

I have a page called "About Us" with some static content. I want to display that static content on the home page. Would I need to do a custom query that returns the about page, or is there a better ...
0
votes
2answers
507 views

Custom post type pagination error

Another one of these paging errors you see here so often. I searched high and low for a fix but have come up with nada so far. I am paging CPT results using my archive-{$post_type}.php template and ...
0
votes
2answers
953 views

How to create multiple loop in archive page?

This is my archive page codes i want to avoid duplicate posts in 4th loop & i want to count post in 3rd loop there are 4 loops 1 first loop count : 1 post <?php $count = 1; if ...
3
votes
2answers
29k views

Get post count of current loop when using multiple queries on one page

I'm trying to get a count of the current posts inside of a loop. I'm using multiple loops on one page in my theme. So far I have: $my_post_count = $wp_query->post_count; But when I print ...
0
votes
2answers
642 views

Related Posts loop - offset

I've been working on this for many, many, many weeks already. I've already asked similar questions here and elsewhere, but nobody seems to be able to sovle this problem. Maybe it's not possible ...
0
votes
3answers
1k views

Custom Loop, Match Category with Page

I want to set up my template so that Pages show a list of posts where the category slug matches the page slug. So on the Page "About Us" ('about'), posts tagged with the category-slug 'about'. The ...
0
votes
1answer
99 views

Category sticky latest

I've been trying to write a script that shows the latest (single) post (in a particular category), however, if the user has chosen to have a post be sticky then the sticky post shows. When the sticky ...
0
votes
1answer
428 views

Offset for Loop

I want to have an offset of 4 posts for my related posts. I'm using Flowplayer's jQuery Tools Scrollable, so I want people to be able to scroll through the 4 latest posts, then the next 4 posts etc. ...
5
votes
3answers
7k 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 ...
0
votes
1answer
438 views

Offset a post in the loop, with using PageNavi Plug-in

I am trying to offset 1 post in my main loop, I have tried a few things Like query_posts() etc etc, and i can get the offset to work but my pagination ends up not working , I am using the PagNavi ...
1
vote
1answer
120 views

How can I make the loop not count special post formats towards the post count?

I have WordPress set to display 5 posts per page, which is what I want. However, I'm now starting to use the new post formats (link, status, quote etc.) but I would these to not be counted towards the ...
5
votes
2answers
4k 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. ...
0
votes
1answer
387 views

Thumbnail Image Rounded Corners w CSS (or any other good method)

I've been researching how to display thumbnails with rounded images, but every solution ends up running out of gas. One trick I tried was wrapping the thumbnail in a division with the same size and ...
0
votes
2answers
3k views

Loop custom post type by taxonomy (Category)

I created a custom post type in my function.php of the theme and some a taxonomy for them. I added 2 categories in my taxonomy (first, second) and added some post in my new custom post. I want to ...
0
votes
2answers
2k views

Wordpress Query Posts From Category Post on Static Page

So I'm trying to query some posts from 1 category only and it does seem to be working. I tried get_post() also but no luck and after awhile I just caved and used query_posts (which is apparently bad ...
1
vote
3answers
6k views

Problems excluding a custom post-type from the loop

Morning all, I'm having some issues with excluding my custom post-type 'events' from my index.php loop for my Blog page. I simply want to display the posts from my actual Blog, which I assume come ...
0
votes
2answers
722 views

the_content() returning null in one category only, even though there is content

A friend's heavily customized blog has a category with a specific categoryname-single.php file to display posts. Apparently for no special reason, since yesterday, the_content() is not returning any ...
0
votes
1answer
3k views

Filter Loop by Custom Field Value

I'm trying to filter a loop by a custom field value. I've tried all of the suggestions on the site, but it just won't filter. This loop is being used for a custom template of an rss feed. It pulls ...
0
votes
2answers
306 views

difference between querying database and using the loop

I know this is a very general question, but I have been reading tuts on both wp Query, and The Loop, and it seems that you can go either way. Am I misunderstanding this? What I think I am reading is ...
1
vote
0answers
173 views

In Loop, if a Gallery, Only Pull First Image [closed]

I'm trying to create a loop that only displays the post types: "photo" and "gallery". If it's a gallery I would like to display only one of the images, preferably the first. I'm a little confused ...
0
votes
1answer
199 views

Loop Offset for tag based “Related Posts”

As I'm using the jQuery Tool "Scrollable" for my Related Posts section (see example here), I was wondering how I can implement an offset so that in the first loop it'll show the first 4 posts, then ...
0
votes
1answer
117 views

Most Effective Method? Exclude Category and Number of Posts Per Page

I want to create a loop that excludes a category and only displays a certain number of posts per page. I have tried both have_posts and query_posts to do this, but I'm a bit stuck on the most ...
1
vote
1answer
213 views

Combining action and filter?

I tried to set up different video oembed size for content and sidebar. I can set up video size with embed_defaults filter. But this filter works for the whole site and I need to have smaller video ...
0
votes
1answer
65 views

Query for specific taxonomy that executes a particular loop depending on volume of posts?

Is it possible to create a special wp query that looks to see how many posts exist in a specific taxonomy, or taxonomy term, and executes a particular loop depending on the volume of posts? My idea ...
-1
votes
1answer
322 views

Alternative loop syntax error [closed]

I'm trying to minimize my code and have put together this little snippet, it doesn't seem to work however. What am I missing? query_posts( 'year=2011' ); if ( have_posts() ); while ( have_posts() ); ...
0
votes
1answer
131 views

In a loop, do not display content that does not have a thumbnail

In a multisite installation, I have a loop set up on my main blog that displays all posts from sub blogs, along with a thumbnail image. The image is important and without one will break the grid. Is ...
0
votes
1answer
178 views

How to show multiple attachements together with Scribu's Posts 2 Posts connector?

I am using Scribu's Posts 2 Posts plugin to connect posts with small galleries attached to an album post type. Everything works great, except that I cannot figure out how to merge the attachments to ...
0
votes
1answer
2k views

Simplest Way to Build Custom Archives Page?

I am looking to create a page in Wordpress to output links to all of our posts from every month since we launched the blog. I have seen the archive.php template file in Wordpress, but this seems to ...
0
votes
1answer
175 views

How do I query based on the modified date?

I would like to list posts by the "modified" date not the published date. Is there a way to do this? $documents = array('posts_per_page' => 10, 'post_type' => 'documents',); ...
1
vote
1answer
2k views

How to sort posts based on the value (number) of a post's metadata?

I'm using the GD Star Rating plugin and the bbPress plugin. The first plugin do have a argument to sort posts by number of votes. But unfortunately, It doesn't work with WP_Query (and apparently the ...
4
votes
2answers
683 views

Loop.php vs looping inside template file

What is best practice for WP with regard to using loop.php (loop-single.php, etc) versus looping inside the template file? Does it matter with regard to efficiency or ?
0
votes
2answers
1k views

Change or update WordPress loop based on dropdown selection

I have a Contact Us page which is showing 9 locations on the sidebar by querying the custom post type "Distributors." I want the user to be able to use a drop down that is populated by the taxonomy ...