Questions tagged [loop]

The core of the WordPress query, the loop offers an easy way to access post information and display it on your website.

Filter by
Sorted by
Tagged with
0
votes
0answers
16 views

Display specific posts based on an ID of another post

I'm trying to display specific posts based on an ID of a post. I got it working with 2 posts and I will get it working for the 10 posts that I need it for, but it's going to be a lot of code and I ...
0
votes
1answer
18 views

Loop with custom posts, to include information from different custom post type

I currently have a loop to display custom posts for courses. Now I also have a custom post type for universities. Both have a certain 'schoolID', so I can link the courses to the university. Now I ...
0
votes
0answers
15 views

how to add 4 post in one carousel slide

I want to display 8 posts in twoeach carousel slides, that mean 4 post in each slide. i'm using a loop to display post but the problem is, it is showing one post in one slide and hence displaying 8 ...
0
votes
1answer
33 views

Avoid removing duplicate posts

I have an arrays of IDs which may contain duplicate values. Array ( [0] => 24 [1] => 11 [2] => 60 [3] => 11 ) I'd like to loop through those IDs using WP Query and the ...
0
votes
0answers
11 views

woocommerce product listing issue with owl-slider

I am using WooCommerce shortcode : [product_category category="course"] for listing my products. I wanted the list to be inside a slider (owl carousel - https://owlcarousel2.github.io/OwlCarousel2/) . ...
-1
votes
0answers
13 views

Loop - Adding a variable that keeps accounting for every purchase

I'm aiming to create a variable in the following code, so that every time a purchase is made, it keeps adding a certain value to the given variable. Here's the code: <?php $osszegyultpenz=0; $i=0;...
0
votes
0answers
14 views

SEARCH QUERIES - REVERSE OUTPUT

When I perform a search on the WP admin side for my custom post query I am returned with the most relevant queries first. Great However, performing the same search on the front end of the site and I ...
0
votes
2answers
25 views

How to show only specific tag in wordpress loop

I am trying to get the loop to show only two tag that have the ID 53 and 52. the code without the "if is_tag( array( 53, 52 ) ){" works. I tried different thing but I can't get it to work. Thank you ...
0
votes
1answer
34 views

Avoid showing the same phrase in the loops

I use this multiple loops to show the sold of some wears, so if there are the sold (meta_value=yes) the txt or presentation must be showing one time in top, and others products in bottom, and if the (...
0
votes
1answer
12 views

Display page content in different sections - based on page break block?

Is there a way to loop through page content, and display the content that is above page break in one section, and everything that is below the page break in another? Or additionally, a way to generate ...
0
votes
1answer
23 views

Display name of taxonomy once

What's the best way to only show the name of a taxonomy once? I use a taxonomy called show_category that has three categories: News, Reviews and Uncategorized. I have six posts: three in News, one in ...
0
votes
1answer
33 views

Import Instagram post to Wordpress blog post

I'm looking for a way how I can import an Instagram post to a Wordpress post. So to make it clear: I'm NOT looking for a Instagram Feed plugin. I need to import an Instagram post to a Wordpress blog ...
0
votes
1answer
19 views

Accessing download link from the loop with WP Download Manager Pro

I'm new to Wordpress, so apologies if this is a silly question. I am using the WP Download Manager Pro plugin to upload PDF's to wpdmpro post types. A user has to enter an email address in order to ...
0
votes
1answer
16 views

Filtering custom posts by using checkboxes for taxonomy in an ajax loop always gives server 500 error

I have been working on this for hours and can find no solution. I have a website that uses a custom post type named 'Brands', which has a taxonomy named 'brand-categories'. At my client's request, I ...
0
votes
1answer
35 views

Custom product loop avoiding duplicates

I am trying to create a product loop based on an attribute value from (pa_product-series). many products can have the same value, but I only want to return one from each...avoiding multiple products ...
0
votes
1answer
33 views

Meta query compare for ID's greater than specific ID

I just want to grab all posts that have a greater value than a supplied post ID 'meta_query' => array( 'relation' => 'AND', array( 'key' => 'rid', 'value' => $rid, ...
0
votes
1answer
27 views

Custom Wordpress theme not displaying posts from category

I am creating a custom Wordpress theme and as far as I can remember Wordpress is supposed to do the heavy lifting for filtering of post types by their category, author, etc. on it's own. This is just ...
0
votes
1answer
18 views

Loop through array of pages

I am trying to recursively get all children of a page (infinite depth) and I am using function below, from this solution: function get_all_subpages($page, $args = '', $output = OBJECT) { if (! ...
0
votes
1answer
24 views

error in specific category loop

I want to show my specific category's last 3 post. I created this loop but it is showing only one post. What to do?
0
votes
2answers
28 views

How to display the parent category if only the child category has been chosen

I want the user to tick the child cat only, but I'd like to be able to display the parent cat based on the child cat. This is within the loop.
0
votes
0answers
22 views

Display products with unique attribute value on product archive page woocommerce

We have 40000+ products on our site and have a custom product archive page for manufacturers. Each product per manufacturer has an attribute 'pa_series' that they belong to. Some series have 100's of ...
0
votes
1answer
27 views

get_users(); Is an Undefined Function When Used in Cron Job

I am Using a Wordpress cron to update some usermeta of each user every 24 hours. For which i created a cronjob using the interface provided by my hosting provider. The Cron runs, but the code cannot ...
0
votes
1answer
29 views

Numbered Pagination Showing The Same Posts After Altering WP_Query

I think the title sums the problem up, but I'll explain more with the code below. As you can see, I'm trying to start the loop from the second latest post for some theme reasons which forced me to ...
0
votes
1answer
23 views

How to add “NEW” badge on latest posts or published 3 days interval

i make a news blog and i need your help for adding a "new" icon on the automatically inside all loops ( home page - Archive & Latest posts page ) like the photo. Thanks in advance here the loop ...
0
votes
0answers
30 views

odd/even posts pagination doesn't work

I have this loop code //I will use WP_Query class instance $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'posts_per_page' => 2, 'cat' => '863', 'paged' => $...
1
vote
1answer
12 views

Can't get custom posts of taxonomy to show

I have a custom post type called 'brand', with a taxonomy of 'brand-categories'. try as I might, I cannot find a way to display a list of posts in the current taxonomy. can anyone help? <?php ...
0
votes
0answers
25 views

BLOG LOOPS Not WORKING CORRECTLY -

I am having issues with my blog loops. I had someone customize by site but they made a mistake with the blog posts. ISSUE: I have three different pages that feature blog categories (events, news, ...
0
votes
1answer
19 views

Custom Post Type has wrong label and is not found when called by a loop

I'm new to WordPress (and to code), having just started my classes. I am working on a project with a few students and can't find a way to call my Custom Post Type. I tried several solutions from ...
0
votes
2answers
16 views

How do you output an unknown number of images in a custom post type with desired markup?

I'm working on a theme that will have an image gallery within a custom post type. I'm able to insert them into the post (using Advanced Custom Fields and embedding them in a WYSIWYG box) but I was ...
0
votes
0answers
42 views

Submit form for loop of products of the term with AJAX

I am developing a group shopping cart that allows group user to order from the group page. I have a product term page where user can buy all products at one time. In fact, they must have to buy all ...
0
votes
1answer
15 views

How to show specify category template for both parent and child category

I tried to create a category template apply for parent and child specify category. I has create a file name 'category-1.php , in this file I used the loop for get the list of post: <?php if (...
0
votes
2answers
18 views

How to get current page id and compare it to looped pages inside the same page?

I have a page template named overview.php which inside shows all the pages that are of the same category. As a result all the pages with the same category are printed but so is the current main page,...
1
vote
1answer
15 views

Get a list of posts with associated meta_value

Recently I began to use the Custom Fields. I would like to display a listing of posts which contains the meta_key "oldtimer" and also get the corresponding meta_value. Here is the expected result: &...
0
votes
1answer
27 views

Change front-page layout after x amount of posts ( while in the same loop)

I'm trying to change the layout of my front-page after x amount of posts, then returning to the original layout as shown in the image below. <?php $paged = ( get_query_var( 'paged' ) ) ? ...
0
votes
1answer
20 views

Some posts not displaying by taxonomy term

I've run into something very odd that I don't think I've ever seen before. I'm trying to query a custom-post-type and organize the results into groups by a custom taxonomy term. The post is Project ...
0
votes
0answers
20 views

how to select posts in the loop published before x date?

I'm trying to select posts in the loop published before O4/2007 so I can target an html element, I had a way of doing this through a varblock in movable type - I'm kind of imagining this is pretty ...
0
votes
0answers
15 views

Can´t update BDD in time

Mi expertise with WP coding is basic, almost reach intermediate level. I know there must be a way to achieve this. I am using 2 loops one inside the other, to find matching values and save in DB. ...
0
votes
1answer
72 views

ACF Repeater loops and resets - where is the reset_rows() documentation? [closed]

I love ACF, its great for developers and it seems to have so much support. BUT... Why is reset_rows() not in the documentation? I created a function that can delete repeater rows at different times in ...
0
votes
0answers
13 views

Function to DRY up several ACF relational loops

Like the title says, I am using ACF to display data from 3 relational fields. The problem is that I have to repeat the loop 3 times, one for each of the lists I want to render, I feel like there has ...
0
votes
1answer
23 views

“read more” redirects to the wrong page

I would appreciate it if someone can help me out. I am having issues with my blog posts. I had someone customize by site but they made a mistake with the blog posts. I am no longer working with them. ...
0
votes
0answers
16 views

Diffrent layout for posts [duplicate]

I have two rows to display posts in first row i have two posts image + content , image + content And in second row the post layout change means content + image , content + image can you solve this my ...
0
votes
0answers
15 views

Listing only matched result line if specific tag and category is matched

For my Campus Project, I am developing a Travel based website where Touring Spots will be achieved and nearby Hospital, Shopping Mall and Hotel names will be listed on the following touring spots post....
0
votes
2answers
30 views

Get data from PHP to JavaScript to set position of each post on front page

I've created a custom post type called project for my Wordpress theme, which works fine. Each project has several custom fields, including a set of x and y values that indicate where the project ...
0
votes
1answer
61 views

Display current post position in Elementor Posts widget

I'm using Elementor 2.6.8 + Elementor Pro 2.6.2 I'm designing an Archive template to display a list of Custom Post Types filtered by custom taxonomy terms. I'm using Posts Widget from Elementor Pro ...
0
votes
1answer
39 views

Why my loop isn't working? [closed]

I am using this loop and instead of getting my posts(blogs) i am getting pagetitle in my case Home and Homepage content <?php while(have_posts()) { the_post(); ?> <h2><?php ...
0
votes
1answer
46 views

How can I group posts by months and years?

I have posts under a custom post type which I like to display in a page grouped by Year and Month. In the page template that I create, I managed to separate them by month, but still without grouping ...
0
votes
0answers
28 views

Woocommerce - show all product variations on shop and category [closed]

I found the code below to display variable products in the shop. After a small modification it works fine. But it also displays the variations in all categories, instead of only showing the variations ...
0
votes
0answers
19 views

How to show post views shortcode data for each post on Posts List Page?

Example: [shortcode id=""]. I just want to how to dynamically fetch each post ID on Posts Lists page over archive page or normal posts page inside the shortcode placed in excerpt. Currently I'm using ...
0
votes
1answer
21 views

Multiple loops on same category with different design

I am having a problem regarding the showing the multiple loops on the category posts i want a posts from a category=social where 3 design is located the structure is as follows Note: I want a ...
0
votes
0answers
15 views

Nested tax query arguments returning function is returning wrong arguments

I'm outputting the skus of products that satisfy my tax query condition where multiple tax queries are nested by "AND". here is my code $args = my_brands_loop(['brand_name'=>'mytag','shapes'=>...