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

Is there a reason I cannot get the current category in a loop?

I think I am doing this wrong but if I do: if(have_posts()){ $category_id = get_query_var('cat'); var_dump($category_id); while (have_posts()){ the_post(); } } the var dump ...
0
votes
1answer
10 views

Why is my pagination showing up?

I have the following code, Assume this code spits back one post. the page displaying that post will also display pagination. Why? It shouldn't. This code only queries for posts that belong to the post ...
0
votes
1answer
11 views

Query multiple custom post types in single loop

I'm aware there are several other posts that cover similar ground to what I'm about to ask. I have three custom post types running, in addition to 'posts'. I want to run a loop that pulls all posts ...
0
votes
2answers
39 views

Looping through tabular data

I am trying to create a table containing information that is a result of two different loops. The first loops through a list of custom post types to display team names. The other is to provide data ...
0
votes
2answers
18 views

Best Way to Grab Post ID from Plugin

I'm currently using loop_end to hook my plugin and get the post id from a page. This works great, except that it's also displaying my plugin in the recent posts widget which I don't want. Is there a ...
0
votes
1answer
26 views

make diffrent template on last six post published

I wanted to make last six posts different template from other posts but I can't get it work below are my loop code inserted on my index.php $last_no_of_posts = 6; $ctr = 0; while ( have_posts() ) { ...
0
votes
2answers
24 views

How to add excerpt in loop in Twenty Eleven theme?

Here is my loop code located in index.php file. I am using Twenty Eleven theme. <?php if ( have_posts() ) : ?> <?php /* Start the Loop */ ?> <?php while ( have_posts() ) : the_post(); ...
0
votes
1answer
13 views

How to exclude specific category from the get_the_category(); array

In my loop I've added: <?php $categories = get_the_category(); $separator = ' '; $output = ''; if($categories){ foreach($categories as $category) { $output .= '<span ...
0
votes
0answers
14 views

Wordpress show posts from children terms of a taxonomy term

I was a little hard for me to explain what I'm trying to achieve in the title so I will explain my setup much more detailed here. I tried to find an answer searching here and other sites but couldn't ...
0
votes
1answer
26 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 ...
0
votes
0answers
9 views

WP_Query Pagination 'Older Posts' link. No posts after click [duplicate]

I have two posts in 'news' and have instructed this wp_query to return posts one at a time from 'news'. The first (most recent) post gets displayed, and the pagination link displays below indicating ...
0
votes
1answer
20 views

How to inject a post within a loop

I'm trying to inject a post while the loop is running. This post will be injected on a condition, so if(x == j){ //inject post here } I see this would seem easy to do, but i have a posts_per_page ...
0
votes
1answer
11 views

Search page loop banner image issue

In Header file I have added while ( have_posts() ) : the_post(); ?> <img src='banner.jpg' /> <?php } ?> ` But in Search page the banner is loop equal to number of results. How ...
0
votes
1answer
36 views

WP_Query loop doen't work with my custom taxonomy

My loop don't display my all relevant posts, It's should display the all posts which started w/specific letter (if it " " then it's should display the all posts sorted by popularity) what's wrong ...
0
votes
1answer
24 views

Enable infinite scroll on single.php

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 ...
-1
votes
0answers
15 views

loop content unexpectedly swapped positions [closed]

live site I've been working on a custom theme wherein the blog excerpts will be presented with the the_post_thumbnail( 'custom-image' ); on the left and the the_excerpt on the right. Somehow, this ...
0
votes
1answer
23 views

Limit Loop to One Category

I am trying to limit my loop to one category. This is the loop: <?php $counter = 1; //start counter $grids = 3; //Grids per row global $query_string; //Need this to make pagination work ...
0
votes
1answer
28 views

How to filter posts by category INSIDE the loop

I'm trying to sort my posts like so: CATEGORY 1 - post title - post title CATEGORY 2 - post title - post title I have no problem achieving this with a custom query: <?php $args = array( ...
-1
votes
0answers
25 views

Problem with pagination on custom category template! [closed]

I am using this code for a custom category: Here is the link to the code And i am having problem with the pagination. What i am doing wrong into the code?
0
votes
1answer
27 views

Post loop count is not in order

I am using custom post type. But on landing page Count of post loop is not in order <?php $loop = new WP_Query( array( 'post_type' => 'focus-areas' ,'get' => 'all') ); ?> ...
1
vote
1answer
84 views

Woocommerce custom loop to show all the products

I'm currently working on an e-commerce website and I met an problem. My client want a page e-boutique with all the product categories displayed, followed by 3 promoted products and a button "show ...
1
vote
1answer
23 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 ...
0
votes
1answer
31 views

Multiple Loops Breaking Pages

I'm new to WordPress, and I'm having an issue with "The Loop." I have a sidebar on the left side of a page that's supposed to show recent posts from two categories. In the middle of the page, there ...
0
votes
0answers
20 views

Prevent posts fetched with “The Loop” code from terminating in a line of dashes

I pulled recent posts onto my website using a fetch X posts loop with some PHP for WP's "The Loop". At the end, it also returns a line of dashes as a sort of end of document delineator. Is there a ...
0
votes
1answer
63 views

Can't access login screen, wp-login.php 404's

When i navigate to /wp-admin/ i am redirected to wp-login.php with the wp-admin URL in the redirect_to parameter. Like this: http://www.domain.com/wp-admin ... goes to ... ...
0
votes
1answer
19 views

first excerpt fine, subsequent post excerpts shift to the right instead of displaying vertically [closed]

The front page of the blog is intended to show post excerpts and a cropped version of the post image. The first/most recent excerpt is perfect, however the older subsequent excerpts are showing up ...
0
votes
1answer
20 views

How to fetch posts that are stored in the different table than (default) wp_posts?

What I need is altering default Wordpress posts-pooling mechanism so I can get posts from other tables in database, not just default wp_posts and wp_postmeta. How is that possible? I'm ready to ...
0
votes
2answers
13 views

Show image if author meta (profile fields) exists outside loop

I am trying to show the profile fields (like AIM, Jibber) outside the loop. I managed to do that with <?php global $post; $author_id=$post->post_author; ?> <?php $field='aim'; ...
0
votes
1answer
35 views

Video post format, extra content breaks video embed

I am using the content-video.php include to show the latest video post on my homepage. The include only shows the video from the post and not the rest of the content, which works well. My problem is, ...
0
votes
0answers
30 views

Combine Query and Select Database to create directory loop

I have a query loop on my page that I am using which displays all users on the page with certain custom fields filled out. It's working fine however, I need to also query these users for their level ...
0
votes
1answer
36 views

Advanced Custom Fields: Post Object - Not returning data [closed]

I have a custom post type called "Training" with an archive page (archive-training.php). I have another custom post type called "Courses". I am using Advanced Custom Fields: Post Object to link ...
0
votes
0answers
39 views

Marginal pagination on home.php

I'm trying too make a custom wp-theme and use a few loops in home.php. But now I can't finish home.php because of pagination. How cant I realize any type of pagination with saving that kind of ...
0
votes
2answers
42 views

How do I automate multiple category loops?

I've asked this question already on the WordPress forum, but it sank like a stone, which isn't at all unusual. I've set up a general Articles page with multiple loops, in order to display the first ...
-2
votes
0answers
14 views

Pagination doesn’t work with page navigation [duplicate]

My pagination doesn't work with pagenavi. This my code: <div class="zilla-one-half"> <?php query_posts('showposts=3');?> <?php if (have_posts()) : while (have_posts()) : ...
-1
votes
0answers
29 views

get_terms wordpress

I created one PHP class that has a method which is using get_terms() function of word press. Then I am creating the object of that class in other PHP file and calling that method, the method is called ...
-1
votes
1answer
33 views

Eliminate duplicates in a foreach loop [closed]

I've created a filter for my search results that allows people to filter user searches based on their State from their profile. The problem I am having is that there are duplicate states showing in ...
-1
votes
1answer
18 views

Multiple loop with pagination in same page

In my home page i have two <section> in which i perform two different loops on different post categories. Here the code: <section> <ul class="loop-article"> ...
0
votes
0answers
27 views

I have a complicated loop query, that I want to output into grids

The code below loops taxonomies, then loops posts within each taxonomy. I would like each taxonomy group put into a CSS grid column. How do I get this into grid rows correctly? <?php ...
0
votes
1answer
50 views

Pagination and multiple loops

Right, so what I currently have is a page split into three using a css grid. The third column is the sidebar, The first two each have a query for posts to display, and create a nice grid of posts ...
-1
votes
1answer
27 views

query posts in wordpress

I want to filter my query results just before the_loop starts in word press. I only want the results having term_id or term_taxonomy_id equal to 1. ...
0
votes
1answer
27 views

display post thumbnail for specific category outside of loop

I'm building a theme that features a section wherein I'd like to have the single most recent post's thumbnail of a single category displayed between the header and blog sections. Something like ...
0
votes
1answer
24 views

wordpress taxonomy results

I am using taxonomy.php to fetch some rows from database. On taxonomy page the function get_queried_object() shows that I have got the right results from database but wordpress loop if ( have_posts() ...
0
votes
1answer
32 views

Control content before and after custom post type loop

I am trying to create a left nav menu that contains a couple of different taxonomy lists of a custom post type. For example, the left menu might look like this... <h2>New Stuff</h2> ...
0
votes
1answer
52 views

List post only under the category, exclude child category content

I wanted to list posts which are directly under a category and not inside the "sub category". In other words, I want to hide all the posts which are from "Sub Category" in the Parent category view. ...
0
votes
2answers
80 views

PHP if post is already displayed, then

I have created a new page with a jquery carousel which rotates between various different news topics. You can see here: However below the carousel is a static list of additional headlines. What I ...
0
votes
3answers
166 views

is_home, and is_front_page conditional problem

I have this snippet in a "portfolio-loop.php" file. I'm using get_template_part to display the loop on the front page and on other pages. I have this within the loop: <?php if( !is_home() || ...
0
votes
1answer
14 views

Pull Instagram images into an existing loop?

I am looking for a solution to pull Instagram images (from a single account) into a Wordpress loop and mix them chronologically with standard posts that will have been created within the Wordpress ...
0
votes
2answers
38 views

Identify the page being shown while in The Loop

In my loop, I'm trying to set it so that certain text is displayed on certain pages, if there are no posts to display. I thought this would be simple, using is_post(), but it seems that this function ...
0
votes
1answer
27 views

My custom query not detecting the correct category

For category.php my custom query code isn't displaying the posts from the correct category. I have a parent category called 'Blog' and it can have any number of unknown children. With that in mind ...
0
votes
2answers
32 views

Showing related posts (custom post type) outside of the loop

I'm trying the following (it's a sidebar widget in the Single New template): <ul class="featured-jobs"> <?php $postid = $post->ID; $categories = ...

1 2 3 4 5 20