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

How to create content automatically when a post is published?

Goal: Ability to automatically create content in WordPress posts/pages. Goal Details: When a post is created/published, it will automatically create or configure content based on the base data inputs ...
1
vote
3answers
101 views

The Loop in Static Page

I have some questions about the loop. I'm using "twentyfourteen" theme as an example. I'm creating 2 php files with basic loop. One is home.php, and one is a template page called sample-page.php . ...
0
votes
1answer
33 views

Add Class according to the order of appearance

My loop returns five posts and the HTML should look like this.. <ul> <li class="topfive"> ... </li> <li class="topfive"> ... </li> <li class="topfive"> ...
0
votes
1answer
88 views

Custom Sidebar in Editor (not Widget) for Custom Post Type in Genesis

I've created a custom post type for employee Profiles. The one thing I can't (yet) figure out is how to make custom sidebars for each of the employee's profiles. I have figured out 2 ways to get ...
0
votes
0answers
37 views

Unable to login + Redirect loop on mobile

When I try to login to my wordpress page, I'm stuck in the loginpage without any CSS. Filling in the correct logins doesn't get me logged in. I just get redirected to that same page: ...
2
votes
0answers
93 views

Chopping up a large ajax request of around 200 posts [closed]

I've put myself into an uneasy situation, where I have roughly 200 posts I need to load in with jQuery .load(). Nothing shows up until the whole .load() has executed, of course. Takes roughly 3 to 4 ...
0
votes
2answers
50 views

Get List of all the Authors

How could i get List of all the Authors? author.php file shows the Information about Individual Author. for example: http://domain.com/author/bj that returns the Bj's Profile. if i enter ...
0
votes
0answers
18 views

Connections plugin pagination

I am currently using the Connections plugin for WP. It supports no pagination for the directory results though. I've tried putting efforts on the code to make pagination work but I found no success ...
3
votes
3answers
4k 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 ...
3
votes
1answer
58 views

Add Incrementing ID to each paragraph in the_content

I need to loop through each paragraph in the_content and add an ID to each paragraph with an incremental value. function incrementparagraphs( $content ) { for ($i = 0; $i <count($content); ...
0
votes
1answer
79 views

Can't grab author info outside of the loop

I have an author box outside of the loop that is supposed to grab the name of the author, but the correct author isn't being displayed most likely because these tags only work inside the loop. What ...
0
votes
0answers
23 views

Conditional loop based on current page

I'm trying to get the loop below to display only the post with the category that reflects the given condition but it doesn't seem to work. Any Ideas on how this can be achieved? <?php if ...
0
votes
0answers
85 views

Posts are being displayed from old to new, in ascending order

I developed a site for a client using a premade theme called "Adapt". When I was developing on my own server, the blog posts were posting as they should in descending order (i.e. new to old with new ...
6
votes
3answers
5k views

Getting Post Comments for post ID using WP_Query() and a Custom Loop?

(Moderator's note: The original title was "Is there a way to get post comments by post ID on a custom loop using WP-Query()?") Hi! I'm running a custom loop using WP_Query, that only displays one ...
0
votes
2answers
63 views

Foreach displays from last to first

I created the foreach loop to display post images, but It displays them from last to first, how can I make It to displays from first to last ;) ? <?php $args = array( 'post_type' => ...
0
votes
1answer
21 views

Grab next post title in archive page

I am using a custom query on a page to display single posts from a specific category, one post per page. Here is my current query: $results = new WP_Query( array( 'post_type' => 'post', ...
0
votes
1answer
156 views

Home page loop with pagination problem

I used a loop to display posts from specific categories, then add the code for WP_Paginate plugin under that loop ... below my posts I see pagination links from 1 --> 5 , however when I press page 2 ...
0
votes
0answers
58 views

Wordpress Custom Post Type and sort by Tags

I am currently making a custom Wordpress theme, but so far I am stuck at this little problem. I have created this custom post type. And in that page (media.php) I want to be able to click on the tags, ...
1
vote
2answers
83 views

Guidance with The Loop for CMS

Maybe I'm going about this the wrong way but this is my scenario... I would like to use WordPress as a CMS rather than a blogging platform. I have a website that will have somewhere between 25-50 ...
0
votes
3answers
84 views

Sort Posts By Category?

Googled this for hours, cannot find a solution. On my theme you have a Browse page which pulls all the videos from the Custom Post Type I am working with. If a user makes 30 categories then id like ...
0
votes
1answer
73 views

Optimize CPT-function with a loop

I want to optimize my functions of a Custom Post Type (CPT). Now I have 10 meta boxes. For each box I have an extra function. The aim is to produce the 10 boxes in one function. I already tried the ...
1
vote
0answers
37 views

WordPress Rewriting the DOM?

WordPress 3.9.1, Bones Theme. I'm setting up an archive page for regular 'ol blog posts. The theory is to wrap each post's information in a permalink. Such as: <?php if (have_posts()) : while ...
0
votes
1answer
242 views

Add File Attachment Name and URL into Javascript

I'm working on incorporating the jPlayer into our WordPress site. I don't particularly care for the two plugins that are available as our client is a bit on the technically deficient side. What we are ...
0
votes
0answers
36 views

Using Facebook Og Meta Tags in loop

On my index page, I have added a facebook share link to the individual posts. I want the sharer to uses the data from the post with the og meta tags. Can I add the OG Meta Tag into the post loop, ...
0
votes
1answer
94 views

Wordpress - thumbnail image from youtube (function and loop)

Hi :D i need show thumbnails from youtube in homepage, i have a code for wordpress in function and the loop but not working thumbnail from youtube. What can be wrong with the code? Function Code: ...
0
votes
1answer
67 views

How to make post content from each post display within the same div

Basically what I am trying to do is have the featured image of each of my posts display in rows of 3 showing only the featured image. When you click on one of the featured images, a div above the row ...
0
votes
1answer
17 views

Loop Post Types with Name and Links

I'm trying to create a menu which loops through the registered custom post types and links to their archive pages. I've been able to get the list of post type names but it is not generating the ...
0
votes
1answer
32 views

Check to see if more than one post

I am new to php. I want to use a certain div "case" in the below code if there is one post here . If there is more than one I want to use another div "case2" <php> $connected = new WP_Query( ...
0
votes
0answers
83 views

Comments_template doesn't work

If I use comments_template(); it does not work at all. But if I change it to global $withcomments; $withcomments = 1; comments_template( 'comments.php', true ); it displays the comments ...
1
vote
1answer
2k views

Use WP_Query with have_posts()?

Is it possible to use $items = new WP_Query( $query_args ); with <?php if(have_posts()): ?> <?php while (have_posts()) : the_post(); ?> without changing the loop to be <?php ...
0
votes
1answer
58 views

get_posts() forcing ignore sticky posts on main loop

I have a custom query using get_posts() that besides ignoring sticky on its main query, ignores sticky posts on main loop. Reading around I've found that get_posts() have some trouble with sticky but ...
0
votes
1answer
36 views

what is the maximum number of post a wordpress loop can work with?

what is the maximum number of post a wordpress loop can work with? how many post can i display with 'posts_per_page' => -1? ive got 50,000+ pages and I want to sort through them, but I just get ...
0
votes
1answer
61 views

Wordpress loop is not working

Can anyone tell me why this wordpress blog is looping the header and banner over and over? It seems like instead of just looping the post it is looping the whole page. This code is inside of my ...
0
votes
1answer
836 views

Loop through Custom Post Type, and then show children within each iteration

I am currently using WP_Query to loop through a custom post type, and only showing the parent posts like so: <?php $loop = new WP_Query( array( 'post_type' => 'programs', ...
0
votes
2answers
40 views

Loop in taxonomy for terms and post

I'm having trouble getting this to work. I've created a custom taxonomy named article_subjects and am looping thru, displaying each term; but am trying to get the newest post for each term ...
0
votes
3answers
76 views

WP_Query fails despite having 1 post

I'm doing a typical custom post type query with args like this: array (size=4) 'post_type' => string 'custom_post_type' (length=15) 'post_status' => string 'publish' (length=7) ...
0
votes
2answers
13 views

Get markup for post without loading into the template

I am writing a shortcode plugin that displays posts according to some parameters passed into the shortcode. I have the wp_query to get the posts and now I am trying to get the markup for the posts ...
0
votes
1answer
26 views

Why doesn't 'continue' work in page?

OK, so I'm working with a template (I have contacted the developer and they were of no help, so I'm modifying the template page as needed). The template displays portfolio items, using the following ...
0
votes
1answer
47 views

Random loop with code to prevent duplicate output returns no output at all from time to time

I have a custom taxonomy with several quotes assigned to each term. Two terms (general and yoga) share the same pool of three quotes. On my front-page.php i randomly draw one quote from each term and ...
0
votes
2answers
1k views

Sort posts by custom taxonomy name

Is it possible to sort posts (custom post type) by category / taxonomy (name, desc)? For example my categories would be Season 2012 some post some post some post Season 2011 some post some ...
0
votes
2answers
333 views

Paginate pages with dynamic query

I have a wordpress page that has a series of listings and a searchbox at the top. The search allows the user to filter posts by creating a custom WP_Query object based on what they selected. I am ...
1
vote
1answer
34 views

How to use current_post to open a new unordered list every five posts

How can I add a break dynamically after 5 posts have been display to create a list of post titles? <div class="col-sm-2"> <ul> <?php $args = ...
0
votes
0answers
116 views

Filter Wordpress post Dynamically on dropdown selection?

Want to filter Wordpress post Dynamically on dropdown selection? But am not able to find out any solution how it can be done.Any help appreciated. Thanks On Clicking On Latest to Old the post ...
1
vote
1answer
4k views

Multiple WP_Query loops with Pagination

There are a few other questions about this (and WP_Query pagination seems to be a huge question for a lot of people) so I'm trying to narrow down exactly how to make it function. I'm able to create a ...
0
votes
1answer
107 views

How can I include sub-forum topics in a bbpress topic loop?

Out of the box, bbpress shows topics from a particular forum when you are on that forum's archive page. Makes sense. If that forum has a sub-forum, it will link to those sub-forums, but it won't show ...
0
votes
0answers
40 views

Calling Custom Fields within a category loop?

What I'm trying to do is to display a specific category post listing within a page template, showing only each post's custom fields, which must be pulled and included within the following html. What I ...
1
vote
1answer
146 views

Loop - how to get previous/next post for first/last post?

I have a simple loop for a JS slider, I want to display previous and next posts titles on my slide, but I can't get previous post title on the first slide (because apparently first post have no ...
1
vote
2answers
46 views

Get_post_meta() won't return value

Ok guys... I'm sure this is going to be a really easy answer. I'm a complete noob at this. I have a custom field that is supposed to return a link. For some reason, it just redirects me back to my ...
0
votes
1answer
102 views

wp_insert_posts Fatal error: Maximum function nesting level of '100' reached, aborting!

I'm having a weird problem I have written the code as below: add_action('save_post', 'save_post_func'); function save_post_func(){ include_once(ABSPATH . WPINC . '/feed.php'); $rss = ...
0
votes
2answers
43 views

Display all images from specific CPT

I have a CPT for "Band Members", and I want to list all of them at the top of a template, above all the posts (which will just be featured images) - a sort-of Navigation for all members. I can't think ...