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

Child Pages Loop

If anyone can help that'd be great. I've found a snippet of code that I've used which is pretty much doing what I want it to do, which lists out subpages of the parent, adds a thumbnail if there is ...
0
votes
1answer
394 views

Custom post-type's pagination not working in category.php

I have this code to the file category.php : <?php get_header(); ?> <div id="content"> <div id="all"> <div id="todo"> <?php $my_query = null; $paged = ...
0
votes
2answers
56 views

I want my post to republish again after adding a custom field

I wanted a code in Wordpress that could allow me to republish the post every time I add a new custom field. For example, if I already have a post and wanted to add an update to it; I want it to appear ...
0
votes
1answer
103 views

Changing the loop w/o killing category links

OK. I am going to try to rewrite this. I am trying to use the Gridly theme as a mobile only theme for my site. The problem is the theme pulls all post categories into the main feed when it is ...
0
votes
2answers
33 views

Checking conditionals

We all know about the default WordPress post types, these being aside, gallery, status, chat and so on. any good theme should support all of them. In the case where a theme does support all of them, ...
0
votes
2answers
135 views

show posts from one category with comments only

Would anybody have a good idea for getting the WP to spit out all posts from a category with (approved) comments only? I have an ecommerce site set up, and treat comments on product posts as ...
0
votes
1answer
73 views

Pulling in a particular post into a single page based on the post id passed into the code

I currently have a page on a site that I am developing and that contains a loop which loops through 4 posts contained in a custom post type called Treatments. ...
0
votes
1answer
206 views

2 loops in blog homepage

I would like to have to query loops running on my blog homepage: Featured posts on top displaying 3 posts from the category : "Featured" Underneath it just the basic loop of wordpress which display ...
0
votes
1answer
177 views

Order custom posts by taxonomy?

I have the following custom post types: books, documents, examples, guidebooks, onlineaids. They were generated by the following code: ...
0
votes
1answer
18 views

using the loop on a page

I'm trying to display the excerpt of the most recent post and just the titles of the 4 previous posts before that at the top of a page and display the content of the page below. I have a solution ...
0
votes
1answer
356 views

If Loop has odd number of posts on last page Custom style for last post in it

My loop displays posts in two columns using this php <?php if (have_posts()): while (have_posts()) : the_post(); $count++; ?> <?php if ($count == 1) : ?> <div ...
0
votes
1answer
39 views

Noob Loop Question

I come with a basic question but I can not solve, I think that will be easy for you. I would like, if I have 2 or more post on loop, show the entire loop. I tried the following: <?php $paged = ...
0
votes
1answer
125 views

Categories and page filtering with pre_get_posts

I have 3 pages, "Page 1" shows custom post-type "articles", "Page 2" shows custom post-type "tips", and "Page 3" shows both custom post-types. This is done conditionally with a custom loop in ...
0
votes
1answer
44 views

Loop not showing up on page template

I have a page template and on the page I have a loop such as: query_posts('post_type=post&posts_per_page=5&paged='.get_query_var('paged')); if(have_posts()){ while(have_posts()){ ...
0
votes
1answer
89 views

Filter Category Loop Dynamically

I'm trying to display a custom loop with a dynamic category filter. As a setup I have categories of all usernames which are created once a user creates an account. So I am trying to echo the user's ...
0
votes
1answer
54 views

Remove the_content From Loop

I'm trying to display a custom loop with only certain elements in it. My loop currently contains the title, creation date, author & content. However I am trying to remove the content for each ...
0
votes
1answer
660 views

WPML wp_query not working properly in one language

I have a wp_query for a custom post type and the custom taxonomy, the idea is top display the term name and below each term the associated posts. I have two languages Dutch & French. Query is ...
0
votes
1answer
99 views

Display multiple custom post type lists on homepage - multiple loops

I've got to display 6 boxes on the homepage of a site I'm working on and struggling with the code. I've managed to get this far: <?php $term = get_term( hotelCategoryID, 'accommodation-category' ...
0
votes
1answer
866 views

Pagination on category.php and tag.php not working

i'm using a query-loop on my template pages like this: <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $wp_query = new WP_Query(); ...
0
votes
3answers
72 views

Trying to display ads on only a third of posts in a loop. Keep getting Error 500?

I'm thinking it's just a PHP code error, but for some reason the following code won't work, it just keeps giving me Internal Server Error 500 <?php $ajfl_adLuck = rand(1,3); if ($ajfl_adLuck ...
0
votes
1answer
3k views

Loop through multiple custom taxonomy terms and display posts for a custom post type

I am working with custom post types in the bones theme from themble. There, I want to create a link list and therefor i've created a custom post type, called links. This custom post type has a custom ...
0
votes
1answer
69 views

single.php fires more than once after clicking on any post to view with different post id each time

I am now experiencing a wired problem with my wordpress installation. I was surprised when I saw post view counter of another post also increased including the the post on which I clicked to try and ...
0
votes
1answer
213 views

Custom Meta Box If Else Statement

I have created a custom meta box for posts and I need to display said data. I have been using the below method to display the data, But I am in need of a slightly different solution. <a ...
0
votes
1answer
86 views

Custom loop page with post navigation

I created a custom loop for a particular category. Can I create a list of those posts -- kind of like a table of contents -- and have it link to that service in that loop? Pagination is not used. My ...
0
votes
1answer
54 views

Loop being strainge

So I hacked together a function that does the following: protected function _query_post($query){ $original = $this->_wp_query; $wp_query = new WP_Query($query); ...
0
votes
1answer
73 views

Pages with a loop (index, archive) are loading the first image as post_thumbnail

Using post thumbnails for custom header images -- works fine on straight pages. But custom templates that load a loop (including index) are pulling the first image instead of using the one set in the ...
0
votes
1answer
75 views

Using Query In Post Type Archives

I'm using the script below to call post from a certain category in the sidebar. It pulls from all post type on the homepage and on the single post page, but when it comes down to the post type archive ...
0
votes
2answers
433 views

WP Query - duplicated posts once including tags in search results

I running WordPress on IIS & SQL server. As some of the plugins do not work correctly with DB ABSTRACTION I am using a lot of functions.php filters as so on. To make my search results include ...
0
votes
1answer
642 views

Search.php - return number of results but cannot loop through

I have a following search.php page (this is just the code required for problem presentation). Why is my $total_results returning a number of posts found, but when I do a loop though it always print ...
0
votes
1answer
288 views

Loop and add Specific Categories and Products Images

Thanks to Rafael Marques I have a list of Products and Categories organized based on different created categories. I also have 5 different Custom Page Templates. Now I would like to display the ...
0
votes
1answer
176 views

Displaying child page content of a certain parent

What I would like to do is to create a WP loop that will display info from a child page of an adult page ID, so the Page ID is 2. I would like to pick a page ID to display what page. So that way I ...
0
votes
1answer
167 views

get all page templates

I am working on a one page WordPress site. It's the first time I have tried this. I am on the fifth version with various degrees of success. I am starting a new version and I deleted everything in the ...
0
votes
1answer
176 views

Custom Post Type Loop breaking php

My While loop is breaking the rest of my PHP on the site. Below I put my code that is working but again breaking the rest of the site. Any Suggestions $query = array( 'post_type' => 'slides', ...
0
votes
1answer
151 views

How do i add custom post types to this query?

I'm using the code below to display the latest post from a certain category but i am using Custom Post Types and I don't know how to insert the custom post type function into this code. I want to ...
0
votes
1answer
309 views

Why does apply_filters behave different inside and outside a loop?

What I want: the array of posts returned by creating $query = new WP_Query($args); Why: to return specific content as a sort of API request in json format, ready to display on another site What I ...
0
votes
1answer
157 views

Styling first post using Advanced Custom Fields

I'm working with a company's About page. I created a custom post type for "Employees", and am using the Advanced Custom Fields plugin to create simple meta boxes for name, title, image, and bio. The ...
0
votes
1answer
176 views

loop through custom post-type with two meta_keys

I have a custom-post-type named my_project. This post-type has two meta-boxes: is_featured is_featured_position So essentially in my backend of the post-type I can set a checkbox for is_featured ...
0
votes
2answers
292 views

Multiple loop for “featured” items returns wrong posts

I have a page template where I first am getting the contents of the page, as input in the admin tool, then a loop of posts of a custom post type. I need to split this loop up into the 2 newest posts ...
0
votes
1answer
735 views

Display posts where date field matches current month?

I have a loop which displays all the posts of the "events" post type on my site. Each of these posts has a custom date field "event_date", which I sort the display of the loop by. I would like to ...
0
votes
1answer
188 views

Post from one loop in different containers?

Is there a way to output posts from a single loop in multiple containers? Ideally I'd like to have the posts title/meta/content etc alternate between first-container and second-container, but I can't ...
0
votes
1answer
141 views

$query conflicting with other queries in the same page

This is my front page: <?php /** * Template Name: Front Page * * @package bbPress * @subpackage Theme */ get_header(); ?> <div id="primary"> <div id="content" ...
0
votes
1answer
139 views

the loop - how to control whether wp or plug-in runs it

I have a problem with the loop running on two instances with thecartpress plugin. Im not great with php by any standards but can usually get things done, however with wordpress im fairly new. Is ...
0
votes
2answers
107 views

Landing page with login

I would like to be able to force any un-registered users to the /welcome page - Currently I have set up the following: if ( trim( $_SERVER['REQUEST_URI'], '/' ) != 'welcome' && ! ...
0
votes
1answer
119 views

Divide loop into several columns based on post custom field and enable infinite scrolling

How can I divide WP loop into several columns based on post custom field and enable invinite scrolling? Below is the desired output markup based on Twitter Bootstrap framework. <div ...
0
votes
1answer
54 views

One loop for sticky, one for all the rest - how, without specifying category?

I have styled an archive page to display one sticky post at the top with special design, and then to display all the rest of the posts in that category (except the sticky post) listed in standard ...
0
votes
1answer
101 views

Loop posts without any taxonomy

I've grouped my pages by some custom taxonomy. But I need to care about those without any taxonomy set. My code is: $page_groups = get_terms('page_group'); //get all existing page groups foreach ...
0
votes
1answer
286 views

Displaying posts limit: can't get pagination to display [duplicate]

Possible Duplicate: Pagination not working with custom loop I'm creating a custom page for logged in current users to view their posts. I would like to limit the number of displayed post to ...
0
votes
1answer
358 views

WP_Query post at custom position

Lets say I have a custom query which based on two custom post types: $wp_query = new WP_Query(array( 'post_type' => array('post-type-1', 'post-type-2'), 'post_status' => ...
0
votes
1answer
781 views

issue displaying variations in custom template using WPeC 3.8.9.2

I’m having trouble displaying variations in a custom built template, each time i call the wpsc function have_variation_groups() within my loop i get the following php error ...
0
votes
2answers
2k views

Custom single.php files for different post formats

I have 3 custom post formats. One is for image, one for video, and, one for gallery besides the default post and they each have a view comments link on the bottom right corner at the end of the post. ...