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

Problems with loop

I have this loop in my index.php: <?php if (have_posts()) : while (have_posts()) : get_template_part( 'post' ); endwhile; endif; ?> which calls ...
1
vote
1answer
898 views

Multiple Loops On Custom Post Type Template?

I'm having some issues adding multiple loops. I have a custom post type (locations) that uses a single page template (single-locations.php). I'm trying to add additional loops to this template that ...
1
vote
2answers
1k views

Specific Loop For 2 <div> Within Each <li>

I need to create a loop that can logically be described as the following for a carousel: Requirements: 3 Loops 2 Posts Per Loop No Duplicates Order by Post Date Visual: < Start Loop #1 > ...
1
vote
1answer
751 views

Using loop pagination on single.php

I want the main front-page loop to show in a section on both index.php AND single.php templates, with pagination. Pagination works fine on the homepage, but not on single posts. This is the code ...
1
vote
1answer
318 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 ...
1
vote
1answer
118 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 ...
1
vote
2answers
334 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 ...
1
vote
2answers
174 views

Query reset problem or flawed code to enable custom post type query

After reading through here and trying various options, I am finally able to get my custom post types 'testimonial' (created with product 'Toolset') to show along with my standard cat/tag queries ...
1
vote
3answers
4k views

Recent posts on a static home page

I want a static home page on my wordpress website, I have already set this up and have a bit of content on it, the next step is I want to have 5 recent posts underneath the content. As a normal page ...
1
vote
1answer
695 views

How to filter posts that belong to a specific category only if that is the only category

I need to filter posts that belong to a category only if that is the only category. For example if my post A belongs to cat1 and I don't want to display posts that belong to cat1, post A won't be ...
1
vote
1answer
282 views

Custom loop with multiple taxonomy queries

Apologies -- new to the stackexchange and actually posted this over in Stack Overflow because I didn't know there was a WP specific joint. My issue-- What I Have: I've got the code for a working ...
1
vote
2answers
350 views

Query Posts Exclude Entire Category

I am using the standard wordpress loop that looks like: <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <h2><?php the_title(); ?></h2> ...
1
vote
2answers
171 views

Multiple loops are not reset

My lovely colleagues have once again designed something that gives me a hard time getting it in Wordpress. Surprisingly it's something that I have done multiple times before; having recent posts and ...
1
vote
1answer
125 views

Posts in loop displaying all taxonomies

I have a loop set up to display projects with two types of taxonomies attached to each. My issue is that within the loop I have set up a function to select specific posts to attach different ...
1
vote
2answers
117 views

I would like to have different styles for my posts based on the content of each post

Here is my wordpress theme to check out(its not completely finished): http://benlevywebdesign.com/wordpress/ This is my first time working with php/wordpress and making themes so keep that in mind. I ...
1
vote
2answers
251 views

Having a Function Inside of the Loop

I am trying to make a frontend product editor for WooCommerce, and have a loop that returns all of the products for the current user. I am trying to use gravity forms as the editor, so a single ...
1
vote
1answer
413 views

Most recent post from another database

I am trying to add the most recent post from another Wordpress database (on the same server in all actuality), but am getting the following error: Fatal error: Call to undefined method ...
1
vote
1answer
1k views

Show a list of recently viewed posts to a user

I have a lot of video posts on my site and I'm looking to show the user a list of posts they've recently viewed. I'm guessing the best route is to just add the post id to an array in their usermeta ...
1
vote
1answer
152 views

Checking if Post Title is Unique as Loop Criteria

I'm trying to make a seemingly simple bit of php (it output's to a Gravity Forms field, but that's basically irrelevant). I'm using Gravity Forms to create posts, which I can do easily, however I ...
1
vote
2answers
198 views

wp_tag_cloud() and the_taxonomies() work but not the_tag()

wp_tag_cloud() and the_taxonomies() work in a widget I built but I can not get the_tags() to work. I want to display the tags assigned to the current post. I built a widget to do this. the widget ...
1
vote
3answers
850 views

Custom post type not displaying content from single-{custom post type} page

I am trying to create a custom post type with taxonomy and a shortcode for my custom search in a plugin.When I activate my plugin I see my CPT and taxonomy on dashboard. But when I publish the post I ...
1
vote
1answer
111 views

Displaying Latest Posts on a Page

I am trying to create a loop to display the title and excerpt of each blog post onto a page that isn't my index page. The in-progress demo site is here: http://thewestharbour.com/mypakage/ On the ...
1
vote
2answers
521 views

sticky post in custom loop

I have a problem with showing sticky posts in a custom loop. This is the code I'm using to for the custom loop: <?php $post_from_cat_a = new WP_Query(array( 'category_name' => ...
1
vote
1answer
70 views

How to add “time” data this?

I am using this simple snippets to get post view count for a long time I was wondering if we can add a "time" data ? Because I would like to show the view of yesterday/ 2 days ago / 2 days ago etc... ...
1
vote
3answers
635 views

Loop with slider (slider not loading)

In my slider.php I have a loop that calls for a custom post type. That custom post type has a meta box for a slide url (link/title/etc). I can see the loop and everything else is working because in ...
1
vote
3answers
3k views

Calling custom fields for pages (not posts)

I'm trying to place a small code in my template header.php file. I want to get a custom field value. I'm trying to call custom fields from current page outside of loop, btw. I have no problem doing ...
1
vote
1answer
244 views

Displaying terms based on loop posts?

I have a shortcode that shows a loop for a custom post type: while ( $loop->have_posts() ) : $loop->the_post(); // do something endwhile; Some of the posts are in categories ...
1
vote
1answer
97 views

Sort posts by most recently modified

Is there a way to list posts in the order in which they were modified? For example; A user posts 5 posts (#1 being the oldest and #5 being the newest), by default they would be listed with #5 being ...
1
vote
1answer
565 views

how do i remove posts from a WP_Query so the pagination is right?

I'm using a custom post type and showing 20 of them per page on the homepage. I'm using QP_Query. One custom field for the custom post type (called mixtapes) is a checkbox called "unreleased" (set ...
1
vote
1answer
268 views

Display all posts that were published before full post on single.php

The way I would like my blog to work is a user clicks on a post that was published on 12th March 2012 (for example) they get taken to single.php where the content of that post is displayed as normal. ...
1
vote
1answer
745 views

Running a loop with a custom query string on a custom page template

I made a custom page with a template that is just a loop with custom query string for a list of posts from a specific category but when I view the page it only shows one post with the title being the ...
1
vote
1answer
675 views

posts_per_page & pagination conflict

I have a custom query to display my custom post type. posts_per_page set to '5'. In admin post per page set to '10' (settings => Reading => Blog pages show at most 10 posts) My template lists 5 posts ...
1
vote
1answer
693 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
1answer
404 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 ...
1
vote
1answer
594 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 ...
1
vote
1answer
38 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
vote
1answer
120 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 ...
1
vote
1answer
867 views

Check if date of post is yesterday

In a loop, I want to display "Yesterday" if the date of the post(s) are dated from yesterday... So here it goes: <?php if( date('Yz') == get_the_time('Yz') ) { echo 'Today'; } ...
1
vote
2answers
452 views

List posts AND custom post type by category

I found this question asked elsewhere, but it was unanswered, so I'm asking myself. I have a custom post type (Features) that shares my Categories and Tags with my standard posts. I'm listing my ...
1
vote
1answer
627 views

Is it possible to have pagination with an offset loop?

I am developing a blog page that requires 3 different post styles (Ie; one full page width with featured image and content, one full page width without featured image and the rest are half page width) ...
1
vote
1answer
230 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: ...
1
vote
1answer
896 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 ...
1
vote
1answer
181 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(){ ...
1
vote
1answer
111 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 ...
1
vote
1answer
188 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 ...
1
vote
2answers
5k views

WP_Query to get posts in a specific category and post format

I've been trying to utilize either WP_Query or get_posts to pull out the most recent post that's both in a specific category and of a specific post format. <?php $singargs = array( 'numberposts' ...
1
vote
2answers
719 views

Why do next pages load the same content rather then older articles?

For some reason, the 'previous posts' and 'next posts' on the homepage do not load previous posts, but rather the same posts that were on the main page. Why is that? I don't even know where to start ...
1
vote
1answer
407 views

How to pass the current content of $wp_query to a new page?

I am developing a Wordpress theme that uses a lot of AJAX. It is composed of two main pages: the index, which displays a list of posts, and a viewer (similar to single.php). When a post is clicked in ...
1
vote
2answers
578 views

Easiest way to show total number of subpages

I am making a portfolio site where each portfolio entry is a subpage of "Work". In my template, I am trying to say something like: worked on 15 projects and counting, where 15 is the total number of ...
1
vote
1answer
287 views

using the loop with a custom table

I have a table in my WordPress db called wp_featuredposts. How can I make a query to output the posts in that table into the loop on a custom wordpress page template?