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
0answers
17 views

The right loop for featured posts?

Which is the right loop to customize articles in this way? the last article, featured, with it's style followed by: the second-last and third-last articles, in the same style followed by: ...
0
votes
1answer
19 views

Get most recent post for every term in a given taxonomy type

I'm looking for an efficient way to retrieve the most recent post from every term for a given taxonomy type. I found this question, which provides the same solution I came to on my own: $terms = ...
1
vote
0answers
6 views

How to check for specific content in comments in the loop

I'm using the following conditional code to check if any comments on a given post contains a certain string. -The word 'CHANGES' in this case. I have it working if I specify the comment_ID directly, ...
3
votes
1answer
83 views

the_content and wp_link_pages

Many plugins seem to be adding a filter/action hook to the_content to display related posts, advertisements and such. The problem is I these appear before the post pagination so it the pagination is ...
0
votes
1answer
24 views

Pass the_post() as a parameter

I would like to take the following code sample <?php while ( have_posts() ) : the_post(); ?> <h2><?php the_field('title'); ?></h2> <p><?php the_field('desc'); ...
0
votes
0answers
9 views

Get posts of specific post format, extract youtube link and use ID for image thumbnail

I am looking to query four posts of which I'll display the title and the video thumbnail. Something like this maybe? $args = array( 'tax_query' => array( array( 'taxonomy' ...
0
votes
3answers
24 views

Cant insert wrapper div into index.php

I'm having an issue inserting a wrapper div into my php index file that we're using for the front page of the site. Right now it looks like this: And it needs to look like this: I'm aware this ...
0
votes
0answers
21 views

Pagination on custom post types

Pagination works in the front page but in custom post type page it doesn't appear. Post type: add_action('init', 'portfolio_register'); function portfolio_register() { $args = array( ...
1
vote
1answer
30 views

<!--nextpage--> as a shortcode within the loop?

Anyone implemented this successfully? I want to include the <!--nextpage--> within a single post loop as a shortcode. I tried to echo it, the tag shows up but the post doesn't get divided into ...
0
votes
0answers
28 views

the_title() Returns the page title instead of the post

I'm using a custom page for listing my posts, now using the loop and the_title() returns the page title instead of the posts. My loop is a simple: <?php if (have_posts()) : ?> <?php while ...
0
votes
0answers
19 views

Hide div on click from a custom post type archive [migrated]

I'm having some trouble to achieve this .. . here is my explanation: I have a custom post type archive, On click on on list, I have the postinformation displaying by fadein - which works perfectly. ...
0
votes
1answer
22 views

get_the_title() is returning results from previous loop

I'm attempting to loop thought a custom post type (artists), then each category, then another custom post type (story) which has a relationship with the artist. The issue is, the function ID ); ?> in ...
0
votes
1answer
24 views

tax_query not working properly with get_posts

Here are my args: $args_home = array( 'post_type' => array('news', 'jobs'), 'posts_per_page' => 12, 'meta_query' => array( array( 'key' => '_thumbnail_id' ...
0
votes
1answer
19 views

How can I modify this code to iterate over an array of categories?

I'm setting up a query for a series of 12 classes that will last a week each. There will be a morning session and an evening session. I'll have two different loops in the template to break those ...
1
vote
1answer
15 views

Sanitize Custom Field Value in Meta Query

I'm using the pre_get_posts hook with meta_query args to filter an archive loop by dates. Basically, there is a custom post type of "events", and my users type in a date as a custom field for the ...
0
votes
1answer
26 views

How to exclude or filter password protected posts when using next_post_link() previous_post_link

I'm using next_post_link() and previous_post_link() in my theme. I excluded my password protected posts from the loop. They only appear if you enter the URL of this specific post. But, the problem is ...
0
votes
0answers
16 views

Shortcodes for Row and column layouts of post boxes and overlay text [closed]

I'm looking for a layout that most closely resembles this - http://i.imgur.com/Ej4SaFP.png?1 note that there are two horizontal rows and then three columns. I'm thinking of using a plugin like ...
0
votes
0answers
13 views

Using last-child to style last post in a loop [migrated]

I'm using border-bottom to add a line between posts in search results, but that leaves an extra line at the bottom of the page. I'm trying to use last-child in my style sheet to remove that extra ...
0
votes
2answers
38 views

Skip posts, but keep posts per page

I'm running through a normal loop on one of my templates, and it displays a list of upcoming events with dates. I'd like the events that have passed to stay active, but not appear in my list of posts. ...
0
votes
1answer
20 views

Give each posts in a loop a number in sequence

In my homepage, I have 10 latest posts. I want to display numbers starting from 0-9 in each post. 0 1 2 3 4 5 6 7 8 9
0
votes
0answers
10 views

problem in the loop with wp-PostViews

I'm trying to loop using the wp-PostViews plugin, my intention is that it lists the first that has larger view. The problem that is happening is that it is not listing all the posts, just those that ...
0
votes
0answers
18 views

Custom loop layout. How can I do that?

This is the structure of the loop that I want to do. There are 2 thumbs sizes: 1. thumb-square 2. thumb-tall HTML structure: <div class="main-wrap"> <div class="col-left"> ...
0
votes
0answers
8 views

Loop the index plug-in jeckpack post view

I'm trying to get my index of the loop in order list for viewing. I'm using Jetpack Post Views for this Ex: the most viewed post is first and so on. I use a custom post with namo movies , only ...
0
votes
1answer
16 views

Set Transient on CPT

When I add set_transient code to my cpt query, I get a Fatal error: Call to a member function have_posts() on string ... on line 30 Line 30 is basically: if($graduate_student_query->have_posts()) ...
0
votes
1answer
25 views

Wordpress loop not working on static front page

I have a static wordpress front page. I want the code that works on my regular blog template to work on the homepage too. Currently, it only shows one post. The code in the main index.php is this... ...
0
votes
0answers
15 views

Strange problem with wp_get_attachment_image_src database (db) query count

I have a purchased theme that has a custom WordPress loop in it that looks for image attachments via wp_get_attachment_image_src. It does this by doing the following: $image = ...
1
vote
2answers
58 views

Get next and previous 3 posts in a term in single post page

I have a the following Custom post type: episode Custom taxonomy: series sub terms real deal -> season 1, season 2, season 3, etc. The terms are hierarchical, and the entire thing is ...
0
votes
0answers
14 views

How to include posts from one category, into a separate category of posts?

How would I insert one category of featured posts into another category of posts? So, the second, fifth and eleventh are posts from a completely different category. Hope the below illustration makes ...
0
votes
0answers
12 views

Loop within category's posts

I'm trying to figure this out since a couple of days, and even though it should be a quick and easy thing, I couldn't find any workaround. I've 4 categories, and each of it has between 10 and 40 ...
0
votes
0answers
19 views

Get link to another taxonomy from a taxonomy list

I'm currently working on a site for an artists directory. I have two custom taxonomies; Artists and Artist Genre which will be tied into a custom post type of artwork. I can get a loop to list out ...
0
votes
2answers
24 views

how do i make this loop work

Apologies I am a PHp beginner and I have no idea why this loop is not working on my tag.php page any help would be welcome. <?php get_header(); ?> <div class="posts"><!-- BLOG --> ...
-1
votes
1answer
16 views

How to do query_posts on tags pages

So I am using the tags.php on my WordPress site to create special featured pages; what I would like to do is create a featured area on the index of every page that contains the first five posts. I ...
0
votes
1answer
16 views

Multiple Loops on a Page Without Duplicates

I have tried many different versions of this and nothing seems to be working for me. I want to display single posts of a custom post type (portfolio) each in its own div. I don't want any duplicate ...
0
votes
0answers
16 views

How do I filter out certain posts from the loop while keeping total number of posts displayed the same?

I'm building a theme where a number of posts would be featured above the cut, while the rest of them would be displayed below. It's fairly easy to filter out the featured posts from the loop - I ...
0
votes
1answer
15 views

Modify loop output for a specific list of categories

I'm trying to modify the output of a loop on an archive page for a specific list of categories. Normally this loop outputs the Title, Author, Date and does so for every post in that given category. I ...
0
votes
0answers
26 views

How to make search for posts using get method?

So I am building a WordPress theme for myself to meet my needs, so what I am looking for now is make a search using a get method in PHP. If my URL is something like this : ...
-2
votes
0answers
38 views

Can the_archive_title and the_archive_description be used outside of the loop?

Can the following new 4.1 functions be used outside of the loop? the_archive_title the_archive_description I'm working off _s so the above are being used with: the_archive_title which can be ...
4
votes
2answers
65 views

Display several random posts, but make sure a condition is met

I have a custom post type for a group of people (employees). At first, I needed to display 7 random employees. That was easy <?php $args = array( 'post_type' => 'employees', ...
0
votes
1answer
43 views

group search results by post type?

My site has 3 unique post types: Default Blog posts ("post") custom type "lesson" custom type "series" When the user searches the site, I would like pertinent results from all 3 post types to show ...
0
votes
1answer
23 views

sort Posts by custom user filed

So I'm trying to sort the posts by custom user filed, I'll explain... So I have added users filed to the registration page, The fields are checkboxes, they allow the user to choose what topic he is ...
0
votes
0answers
55 views

Integrate WP Tiles into existing loop (index.php) and theme

I want to integrate WP Tiles directly into our Wordpress theme and into our existing loop but their documentation is pretty thin and I can't find much in the way of examples so not really sure how to ...
0
votes
2answers
111 views

Active class for my flexslider in WordPress

I'm calling images with a wordpress loop to display in a flexslider on the home page. However, the active class for the thumbnails of the slider aren't working in tandem with the slideshow -- I can't ...
0
votes
1answer
31 views

Issue in If else condition [closed]

I'm calling my all pages on one pages as a section. Here is my code: <?php $args = array( 'post_type' => 'page', 'orderby' => 'ASC', ...
0
votes
1answer
18 views

How to Generate a list of Most Commented post?

I'm trying to call a list of most commented post. But the call to the DB returns always the same post (the first one in the loop) This is my code in functions.php function ...
0
votes
1answer
42 views

Archive page…limiting posts per page

So what I have done is created a custom post type 'testimonials' and set the "has archive" option to "true" and have a PHP template file named "archive-testimonials.php". What I wan't to do is limit ...
0
votes
1answer
38 views

Foundation modal in wordpress php loop

I'm using Foundation V4 framework within a child theme for a website. I currently have the wordpress post loop outputting all the content as per normal, for images I plan to do something a little ...
1
vote
1answer
60 views

Better way to display posts from specific categories, in a grid layout

I'm using the following code to display posts from a specific category, in a grid layout, on my home page. It works exactly how I want it to, but I keep reading that I shouldn't ever use query_posts. ...
0
votes
1answer
64 views

Custom Post Type + Category archive

I have created a WP stack with 3 post types: 1. Post (default) 2. Event 3. Place These 3 post types share the same taxonomy, that being the default WP category, here are some example categories: ...
0
votes
1answer
20 views

Calling Specific Pages with wp query Part II

I'm making one page website and I added a custom field on "Page" post type that asks "Use this page as a section:" Yes or No(with dropdown). I called all pages on template-onepage.php(custom template) ...
0
votes
1answer
36 views

Why do I get `Call to a member function have_posts() on a non-object `? [closed]

add_action( 'genesis_loop', 'be_home_loop' ); define('PER_PAGE_DEFAULT', 2); function be_home_loop(array $query = array()) { global $wp_query; wp_reset_query(); $paged = ...