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
7 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
17 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
9 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
22 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
37 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
25 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
11 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
21 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
21 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
18 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
65 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
66 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
9 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
35 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
17 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
23 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 = ...
0
votes
2answers
24 views

How to display first post

I want to display in the front page of my theme the first most recent post in the header and then continuing the loop in the main content section starting from the second to post and so on, how can i ...
2
votes
1answer
29 views

Can't show comments count per post outside loop

How can I show the amount of a comment per post outside the loop? I tried this in a function already: ' . get_comments_number . ' , but that outputted the text "array" on the screen... What do I have ...
0
votes
1answer
25 views

Looping taxonomy in taxonomy?

So I have a CPT of references (like a dictionary kind of format for music). In it there are two taxonomies: medium_reference and reference_letter. The reference_letter lists letters A-Z, while ...
0
votes
0answers
30 views

Advise on Templates for Custom Queries

I'm trying to figure out the best way to solve this problem. I have a couple of archive type pages that display content from multiple post types at once. For example, I've overridden the default ...
-3
votes
2answers
33 views

How can you make it so the comment box shows on some pages or posts but not all?

Pseudo code might look like: if it's this type of post display comments and comment box otherwise forget it This same type of code should also allow someone to have HTTP requests if it's ...
0
votes
1answer
33 views

WooCommerce checkout gateway creating redirect loop

I have set up PayPal as my payment gateway for WooCommerce, do not have an SSL certificate, and am not forcing SSL. Checkout and payment are set to go to the checkout page. When I try to test the ...
0
votes
1answer
19 views

Category archive is displaying all posts rather than the specific category

Here is my loop code for index.php . I do not have an archive or category.php right now. This is very basic. $temp = $wp_query; global $wp_query; $wp_query = new WP_Query(); ...
0
votes
1answer
25 views

For Each +1 Wordpress Loop

Im using a loop to make a slider. My code is <?php query_posts( array( 'post_type' => 'my_gallery', 'author'=>$author->ID ) ); while( have_posts() ) : the_post(); $imagethum = ...
0
votes
1answer
32 views

Custom search form to display users only

I'm trying to build a custom search form for one of my pages. I need the search form to be able to search for users. Not only will it need to search for users, but by first name, last name etc.. ...
0
votes
2answers
35 views

“Right Way” to make custom Loop respect reading settings inside admin panel?

I have created custom Wordpress loop using WP_Query, loop is working fine and I can customize it nicely, however i have a problem using "Blog pages show at most" settings, for example inside my loop ...
-1
votes
2answers
28 views

Why don't some template tags work when querying information on single.php?

I'm trying to fetch content about the current post into the header.php of my theme (to dynamically insert Facebook OpenGraph Metadata). Since I'm on a single post page, shouldn't it be able to run ...
0
votes
1answer
33 views

the_content not working on one of two Multisite sites

I have a multisite with two subsites (sub-domain setup) both sites have the same theme, same plugins but the first one is in Hebrew and the Second in English. On certain templates (not all) in the ...
0
votes
2answers
47 views

Interrogate a page within a loop to check template type or custom meta data (Pages vs Posts)

I've spent a few days researching working with WP static pages - as separate from posts. Although I've found useful guidance, I can't seem to find any good tutorials or worked examples that show me ...
0
votes
0answers
19 views

Run a query when in last category

Can anyone help? ive searched google but with no luck. currently Accounts has sub categories but no posts /accounts/ = /billing1/ + /finance/ Billing and finance have posts but don't want ...
1
vote
1answer
24 views

Reverse chronology of post listing

I"m working on modifying a theme that is based on 2010. I want to make the posts on this blog display earliest to oldest, but I don't see how to do this in the theme: I understand I need to add . ...
-4
votes
2answers
51 views

How can I display sticky posts at first in wp_query?

I'm looking for a long time, but I could not find a solution. I'm not a coder. Please help me. Here is my wp_query code; $my_query = new WP_Query('category_name=animals&showposts=10'); while ...
1
vote
2answers
65 views

Output 2 items within the Loop

I have a query that loops through <li>'s and displays the number of <li>'s I have. Is there a way I can make the loop pull 2 <li>'s at a time rather than one? // 5 list items ...
0
votes
2answers
43 views

Strip <p> from <blockquote> or something better?

Looking for some help on something that has me really contemplating not using blockquotes for the moment! I have this code: <?php $show_after_p = 1; $content = apply_filters( 'the_content', ...
0
votes
1answer
39 views

Get User_id outside wordpress,

i am trying to get the User_ID outside of wordpress. I have a rating plugin and it needs the current user id, to cast votes. However it seems that something is going wrong. This is the part of the ...
-1
votes
0answers
31 views

Display Child Pages, title and excerpt on to homepage

I would like to do something like shown below, but don't know the proper code. I basically want to pull the title and excerpt of child pages and display it on the homepage. I want to be able to list ...
0
votes
1answer
31 views

Why is my category post repeating twice

Im trying to output category with its post on a single page, but for some reason the post from all category are repeating in each category, what am i doing wrong here Here the code: <?php ...
0
votes
0answers
20 views

Get posts by subcategory 'name' not the slug?

For each category I have 2 sub categories with same name. For example, Category1 has two subcategories: Sub1, Sub2. On the category archive page, I want to display the posts from Sub1 and Sub2. So ...
0
votes
1answer
58 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
61 views

How to style first post differently with 'get_template_part'?

I need help in styling the first post differently than the rest. What makes this differently is that I'm using this get_template_part in order for infinite scroll to work on my site. This is what I ...
1
vote
1answer
103 views

Multiple Loops On Custom Post Type Template?

I'm having some issues adding multiple loops. I have a custom post type (locations) that uses a single page template (single-locations.php). I'm trying to add additional loops to this template that ...
0
votes
1answer
33 views

next_posts_link returns same content of 1st page

Pagination seems to work fine... I have 21 posts... and it will go to 3 pages... however... every page shows 10 posts and the same content as the first page.... <?php $temp = $wp_query; $wp_query= ...
0
votes
1answer
58 views

add <div> to end of post in the loop with plugin

I'm looking to add a <div> with some more html content to the bottom of specific posts in the loop. The the_post action can be used to add the <div> to the beginning of the post in the ...
0
votes
1answer
85 views

Pagination not working on home page

I've a page named "share" with a complex loop that's working perfectly. This page is located at domain.com/share. Now I need to use this page as the home page, so I went to "Settings -> Reading" and ...
0
votes
1answer
51 views

Why is the output of a call to the_excerpt different when the call seems to be identical?

Ok I've been asked to fix a problem on a website that is a bit weird. The index page (template-magazine.php) here, Has this bit of code: <?php get_template_part('loop'); ?> to produce a ...
0
votes
1answer
36 views

get_the_ID not returning correct ID value

I have a loop (the_loop) to echo featured images on my slider but I need to filter it to specific post ID only. But get_the_ID is not working. Here's my code ...
0
votes
1answer
14 views

Custom Loop and Standard Blog Loop Issue

I am working on a theme with a front page that will have two loop sections. The first will loop three posts from a Custom Post Type (ill-portfolio), the second will loop three blog posts. In both ...
0
votes
1answer
70 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 > ...
0
votes
0answers
19 views

Listing custom post type items from a couple of custom taxonomies

I know I have asked a similar question in the recent past (Listing all custom post types using a specific term on the said term's template page, in groups), but in this case, the template is more ...
0
votes
1answer
27 views

Put multiple custom loops on same page

I want multiple loops on my homepage, however only the first loop shows up. My homepage looks like this: <?php /* Template Name: Home */ get_header(); ?> <!--Four Columns--> ...

1 2 3 4 5 20