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

Display products from specific category in shop page

I know many people asked for this question but I didn't find a proper way to do it. How to add a simple meta_query (product_cat) before the execution of the shop page's query. Maybe by using a filter ...
0
votes
2answers
36 views

Escape current post from loop

I'm creating a search widget and for that I use a secondary loop via new WP_Query(); $query = new WP_Query('s=searchTerm'); if ($query->have_posts()){ while ($query->have_posts()){ ...
1
vote
3answers
215 views

Previous and Next Post link doesn't work

In single.php I tried to add inside the loop the previous_post_link and next_post_link. But nothing is rendered when a view the source of the site. I added the previous_post_link inside an h4 tag to ...
2
votes
1answer
416 views

Enable infinite scroll on single.php [closed]

I have a problem similar to the author of this thread: Possible to paginate on single.php? I am trying to enable infinite scrolling on single.php. So far I successfully load an additional 1 post when ...
0
votes
0answers
31 views

How to get rid of extra Untitled Article in html5 document outline when using new WP_Query?

Here is a simplified version of the code I'm using on a static homepage template made for a child theme of TwentyTwelve. I simplified some of the divs used for styling and just focused on the problem ...
0
votes
1answer
29 views

An archive page without post format (just standard post)

I'm trying to get posts with not marked with any type of post types (aside, audio etc). But I didn't find any solution to do this. I thought doing this with custom fields but site has a lot of ...
0
votes
1answer
87 views

WP_Query on custom post type not displaying, multiple loops & get_template_part

I'm having problems getting my testimonials to display. On page.php I have a testimonials section. So I have a loop that grabs the content for page.php, and then a get_template_part('content', ...
0
votes
1answer
51 views

Redirection loop error after login from a custom post type post

I have created a custom post type called portfolio so such posts have an url like this: mydomain.com/portfolio/post-name/ This is fine so far, however i just found I am having a problem with my ...
2
votes
1answer
31 views

Show posts without term

I am working on a product page where I show reviews from my post type 'reviews', if the product page title matches with my term from the taxonomy 'review-product'. Example. Product page title: ...
2
votes
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 > ...
3
votes
1answer
292 views

Endless loop with wp_insert_post and wp_update_post

I have an array $unqiues which contains URL's, I loop over the array with the code below to get the URL titles, insert a new post, update the post meta. Then I change the the posts title and name to ...
0
votes
1answer
81 views

Structure and Display Content from Multiple Pages on Single Page

I am trying to display the content from multiple pages on a single page. However, for each page I need the title, excerpt, content and featured image. The display of each page's content has a ...
1
vote
2answers
497 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
2answers
40 views

All posts are still shown when adding category argument to query

I've got the following code in my team-type.php file which I'm using to create a custom taxonomy for a member information: function create_team_taxonomies() { $labels = array( 'name' ...
0
votes
2answers
53 views

How do I style the first two posts of a loop

I'm trying to style a single loop to look like so --------------------------------------------- || | || || || | ||--------------|| || ...
0
votes
1answer
36 views

Creating a archive for taxonomy terms, not the term results

So I am attempting to build the first page in my navigation hierarchy to choose product categories. I have a custom taxonomy called collections. I would like to create a page that loops through all ...
1
vote
2answers
106 views

Single Page Wordpress Theme - Using page templates

Well I am lost, its late and I have been searching google all night. Heres the problem I am running into. I am trying to create a singe page website using wordpress "pages". How I have initially setup ...
4
votes
1answer
59 views

How to place a loop within another loop?

I have two loops setup using WP_Query: $latest and $popular that I'm working to setup in this example layout: Latest                        ...
1
vote
0answers
42 views

Multiple Loops Meta Data

I am now trying to figure out how to create the functions/ loops to pull my data from custom post types. I have two post types(keys): And I need to pull the data from both to run my functions. ...
3
votes
1answer
37 views

Query Custom Meta Value with Increment

I have a Query searching for a meta value I have added to my posts (meta-select). I have it feeding out in a loop with 4 results. Let's say I want this loop to start with the meta value "2" and work ...
0
votes
2answers
17 views

If Specific Post, Link Elsewhere

I would like to create a conditional statement that checks the loop for a specific post ID, then if true, it outputs a link elsewhere. This is what I have so far: <?php ...
0
votes
1answer
39 views

Problem with Front-Page.php loading recent posts

Hi I this weird problem where i have my custom front-page.php with set page (in Reading Settings) static page. What I want to have is a static page with welcoming message and later 1 recent posts ...
0
votes
1answer
26 views

I want my wordpress loop to only display posts of the standard format

I currently have the following php code for the content loop on my homepage. <?php if ( have_posts() ) : // Start the Loop. while ( have_posts() ) : the_post(); ...
0
votes
0answers
31 views

How do I get is_single() to return true when called internally from the_content()?

I have a custom page, e.g. blog.php?post=42 that shows a GET-specified post like so: <?php require('wordpress/wp-blog-header.php'); ?> <!-- my non-wordpress site's html goes here --> ...
6
votes
1answer
149 views

Inject post (from specific category) between posts in Loop

I would like to add a post (from specific category) between posts in the WordPress Loop (such as 'Sponsors'). Example: P P P S P P S P P S P P How can I achieve this? I am a beginner with coding, so ...
0
votes
1answer
74 views

Custom post type archive organized by category

I'm trying to display a custom post type archive page which displays all the articles of a a custom post type in columns. The columns organize them in their assigned category. On the main page, I do ...
1
vote
2answers
55 views

Ways to have multiple front-page.php templates that can be swapped out?

I essentially want to create several different front-page.php templates with different loops and layouts and then present an option in the admin panel to select one template on one day and a different ...
0
votes
1answer
39 views

foreach loop inside the loop creating duplicates in output

I have a foreach loop inside the loop that is getting info from a separate table. The table has a column that has an id that reflects the id of the post type so it should always be unique. When I ...
0
votes
2answers
23 views

Syntax error when I try to insert my loop into an unordered list? [closed]

I am very new in PHP and WordPress development and I have the following problem trying to insert some HTML code into the posts loop. I tried something like it: <?php if (have_posts()) : ...
0
votes
1answer
600 views

How do I get my loop.php to properly paginate?

I am using the Starkers theme as a foundation to build my theme and I am having difficulty getting my loop.php to paginate posts properly. When I click the "Next" or "Previous" post pagination button, ...
0
votes
1answer
21 views

Why isn't my multiple loops working?

I would like a multiple look to display the_content from the current page, & from another page. My multiple loo doesn't seem to be working. Can anyone advise, please? while( have_posts() ): ...
0
votes
0answers
27 views

How to show the posts list into a static page? Problems to use the loop into a static page

I have the following problem: I have to create a posts archive into a static page. So I have created this page template containing the loop to interate on my posts: <?php /** * Template Name: ...
1
vote
4answers
68 views

Create static front-page with 3-5 recent posts

I am struggling with front/landing page customization for my custom designed theme. I have designed custom theme and pretty much coded it using the Underscore boilerplate. As I understands, the ...
0
votes
1answer
26 views

Altering “posts_per_page” for defaut loop

I am trying to alter posts_per_page value in default wordpress loop on-the-fly, not for a custom loop. global $wp_query ; // $wp_query->query_vars['posts_per_page'] = 1000 ; ...
0
votes
1answer
719 views

A two column loop with one lead post

I got a loop from internet (I forgot the site) for two column post view. It has a nice CSS for it too. But skipping that for the question now. <?php $counter = 1; ?> <?php ...
0
votes
1answer
40 views

Have posts that belong to multiple categories, exclude some categories from homepage

So I have categories A, B, C and D. And also categories 1, 2, 3 and 4. I have posts that can belong to any four of these categories. But I want to exclude anything in categories B, 4 and D from the ...
0
votes
1answer
31 views

Category nicename inside loop in wordpress

How can I echo the current post's category nicename inside main loop. <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> echo <div class="btn category-nicename"> ...
0
votes
2answers
70 views

How to get all unique categories for posts in loop?

I'm looking to get a plain list of the unique categories in a custom loop (only categories for the posts in the loop). I've been fumbling with some code for a bit and here's what I've got: <?php ...
0
votes
0answers
17 views

Multiple loop to display specific post at start of a list

I'm currently querying the following posts: <?php $args=(array( 'post_type'=>array( 'premium_content', 'post'), 'posts_per_page' => 3, 'orderby' => 'PREMIUM_CONTENT_FIRST!', ...
0
votes
2answers
53 views

Custom taxonomy template loop

I know that this question is asked numerous but i din't find an answer that suits to me. Well i'm made some custom post types and some custom taxonomies. I have the custom post type Products and ...
0
votes
0answers
13 views

How can I put a custom field value that needs to be inside the loop, in a custom menu via functions.php?

How can I put a custom field value that needs to be inside the loop, in a custom menu via functions.php?? I'm working on a bilingual website and I'm using the Bilingual Linker plugin. I was able to ...
0
votes
1answer
39 views

Some doubts about how the loop work (trying debugging it)

I am very new in WordPress development (and also in PHP development, I came from Java and C#). Today I have installed Aptana and configured XDebug to inspect what happens into the TwentyTwelve theme. ...
0
votes
0answers
21 views

Order by post_type within loop

Envision the following: <?php $args=(array( 'post_type'=>array( 'premium_content', 'post'), 'posts_per_page' => 3, 'orderby' => 'PREMIUM_CONTENT_FIRST!', 'meta_query' => array( ...
0
votes
1answer
19 views

Return only content in excerpt field in loop

I am sure this has been asked before, but I can't seem to find the answer, although it seems simple enough. I have built a custom theme based on another person's design. He uses both the excerpt and ...
0
votes
0answers
55 views

Displaying image from a repeatable group

I am having trouble displaying my image in a repeatable group. I am able to display all fields except the image. Here is the code to display a repeatable group $meta_boxes['project_metaboxpress'] ...
-1
votes
1answer
871 views

Adding vkontakte social “like” button to posts results in multiple buttons on first post only

I'm trying to add a VKontakte (pretty much the russian version of Facebook) "like" button to wordpress posts by placing it within the loop along with Twitter/Facebook "like/share" buttons. While this ...
0
votes
0answers
28 views

Title outside of the loop in page template

I have a page template, with a very simple default query. The problem is that the title is outside of the loop, because of the layout. What do you think, is it problem? Or do you know an other way? ...
1
vote
1answer
27 views

Modify main loop in taxonomy archive page

Is there a way that I can modify the main loop in a single taxonomy template, but leave it untouched in every other template? In this case, I have a custom post type called "Events" which in turn has ...
0
votes
1answer
16 views

How can have a conditional template tag based on the main loop within a secondary loop with new WP_Query(), using get_template_part()

What is the best practice methodology for referencing the main loop from within the context of a secondary loop within a partial called via get_template_part()? For example, say my homepage contains ...
0
votes
2answers
161 views

Pagination/infinite scroll with WP_Query and multiple loops

I need that the main page of my site have 3 columns: - The first having the 5 most viewed posts; - The second with the next 5 most viewed posts; - The third with the most recent posts. I don't want ...