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

WooCommerce - Checkout suddenly stops working

From one day to the next apparently the checkout, specifically selecting a payment option stopped working. I can't figure out why, but when selecting an option, the page keeps jQuery reloading. this ...
0
votes
1answer
28 views

Ajax loop and history.js for SEO

For a project, I have to ajaxify the main loop with a "load more" button to show more posts (basically as well as Canva Design School). To make this work I used the method described in the tuts+ ...
0
votes
1answer
7 views

<?php the_content(); ?> to get a little more content after 'read more' inside loop

I want the to give a little more content after <!--more--> tag inside Loop. I saw this on wordpress codex This script gives the content before the <!--more--> tag: <?php global ...
0
votes
1answer
17 views

How to add div blocks after certain set of post

Ok I broke my post down into different style settings. Like shown below. The first post is a large block. the next four post are small and aligned next to the larger post. I used the loop below to ...
0
votes
0answers
19 views

How to solve this script problem in theme directory?

I have a jQuery Ajax call that calls a php script. This call works if the file is in the root of the site but does not work if this php script is in the theme folder . Additionally, I have a 500 error ...
0
votes
0answers
16 views

Query posts by switch

I need your help to add a case to a switch in my theme to order posts. My theme uses a query_post: query_posts( $query_string . $orderby ); In the loop to order generated posts. The query uses ...
1
vote
1answer
32 views

How to pass many ids in post__in?

I need to pass many ids to the parameter post__in in args. This not work !!! Help me please. foreach ($rows as $obj) { $todos .= $obj->ID . ","; } $ids = trim(trim($todos), ","); # echo ...
1
vote
1answer
43 views

How to use WP_Query to display many posts?

This is my WP_Query instruction but this not work. This display just first post. Help me please? // WP_Query arguments $args = array ( 'post_type' => 'teachers', 'p' => ...
0
votes
0answers
12 views

Custom Taxonomy Link Text Echo Name Not Slug

I'm a little lost about where I can place a simple php echo within a loop. I have a "program" taxonomy where each program is echoed onto buttons. Right now I'm only echoing the slugs for the link ...
0
votes
2answers
39 views

Most elegant way to enqueue scripts in function.php with foreach loop

I wonder is there a way of running wp_register_script and enqueue with the help of foreach loop to manage label and dir? For example, function wbs_app_components(){ $scripts_list=array( ...
0
votes
1answer
17 views

add bootstrap post slider with tabs

I'm trying to add a carousel with my post. UNder the carousel, some tabs with the post title. On click of the post title, it should change it the slide to display the related post. In " Static" in ...
0
votes
0answers
27 views

Display featured products through custom loop in woocommerce on template page

I was wondering if someone could help me out. I would like to display 6 featured products from my woocommerce store on my home-page.php template. After some researched I found that the right way to do ...
1
vote
1answer
25 views

add most viewed post by google analytic in loop [closed]

I'm trying to find a solution to display the 5 post most viewed ( from google analytics) in my loop. The only way I find at the moment is to use this plugin 'Google Analytics Top Content Widget ' ...
0
votes
0answers
23 views

Pagination not working Search posts

if ( have_posts() ) { while ( have_posts() ) { the_post(); global $post; //loop here } if(function_exists('wp_pagenavi')) { wp_pagenavi(); } } I have the following code in function ...
0
votes
1answer
18 views

Multiple loops without repeating content

I have a second loop on a page where I want to display posts from the same category as the present post but excluding the present post. I have a loop that displays all the posts from the same ...
0
votes
1answer
42 views

How to check if there are posts with the same tag

I have this code but I can't get to delete the div with the class otrasObras <?php $test = ""; $posttags = get_the_tags(); if ($posttags) { foreach($posttags as $tag) { $test .= ',' . ...
0
votes
2answers
54 views

Pagination for custom loop on custom page template is not displaying anything

I have created a page where user can see his favourite post which has been bookmarked by him get_user_favorites($user_id); This function is responsible for returning me all the favourite posts ...
2
votes
2answers
39 views

Query sticky posts with thumbnails

I need to display max 5 latest sticky posts that have a thumbnail. And I need to have accurate counting of the displayed posts. I've tried to exclude sticky posts without a thumbnail with meta_query, ...
0
votes
0answers
24 views

Wordpress loop not working only on home page, works on all other pages

I'm currently working on a new WP theme. I was working on my theme locally and it was working perfectly without any issues. Since I moved the theme to my dev server, everything has worked except ...
0
votes
0answers
15 views

Get link in loop after redirect to page contact

i have loop in archive: <?php if (have_posts()) { while (have_posts()) { the_post(); ?> <div class="list"><a href="<?php the_permalink() ?>" title="<?php the_title(); ...
1
vote
1answer
25 views

Show Sticky Post at the top but do not show again in the loop?

Regarding wordpress.org - sticky posts are displayed at the top but they also appear again in the loop. For the main loop on my homepage I want to display the sticky posts at the top BUT I don't ...
0
votes
2answers
35 views

Make loop alphabetical

I have a simple loop but it returns it in any order. What I'm looking for is to alphabetize the loop. I've tried a few different things but Can't seem to get it to work. <?php // Start the loop. ...
0
votes
2answers
77 views

Only display post if published in last 24 hours?

All I'm trying to do here is a simple custom loop using WP_Query to display posts if they are published in the last 24 hours; otherwise, a message appears telling the user to check back soon for fresh ...
0
votes
0answers
16 views

Add a banner image after first post, across the WordPress website [duplicate]

I am looking for a way to add a banner image after first post across the website. If it was about adding a banner on one page only, homepage or category page, then I could have done this in WordPress ...
-1
votes
2answers
65 views

WooCommerce - Show orders for a specific product ? [on hold]

How to view orders for a specific product in WooCommerce using sku or product name? What I have so far is that, but it does not work.. Does anyone know how to do? <?php $args = array( ...
0
votes
0answers
10 views

how to manually change the loop to just show images and their attributes?

I want to change the behavior and styles of the Wordpress default image gallery. I mean, I don't want to just call the loop to show all images in a post/page gallery with default attributes and ...
0
votes
1answer
30 views

Does putting queries within loops cause an issue on Wordpress?

If I include a new wp_query within another query's loop (e.g. putting even a very simple query, like the ones from the codex example on a single page template) the page loads as expected, but the ...
0
votes
1answer
22 views

Trying to list out child pages with WP_Query

I'm trying to list out all the child pages of a custom page I've made. In my custom page, I'm doing this to list out the pages: <?php get_header(); ?> <?php $subpages = new WP_Query( ...
0
votes
1answer
19 views

Display Taxonomies in loop with template args

I want to display the taxonomies within the loop but with customized template. Here is my code: if ( have_posts() ) { while ( have_posts() ) { the_post(); $args = array( ...
-1
votes
0answers
19 views

Why is my foreach loop preventing other subsequent loops working in php document?

I'm trying to create a section on my wordpress site for latest posts to be displayed with date title and an excerpt. I don't know what is causing this, but the loop I am using stops all subsequent ...
0
votes
0answers
33 views

Multiple Loop resulting in duplicate Posts

This code results in a display of a category title and one post below, it loops through every category in a custom taxonomy, works but the posts are duplicated on page/2/ if I type in that URL, I ...
0
votes
1answer
38 views

Echo a shortcode div after every 3 posts

In my wordpress home.php file, I have placed an increment loop with the help of a few stackexchange threads: <?php if (have_posts()) : ?> <?php $count = 0; ?> <?php while ...
0
votes
1answer
28 views

Loop posts in a table ordered by a custom field value

I'm trying to generate a table for a custom post type events, in which I have a few custom fields, one of these is the date. I want to display the posts in the table and order them by the Date value. ...
0
votes
1answer
28 views

WP_Post is not from correct array

A bit of a complicated problem here, but I figured I'd see if I could get any help. My logic is this: WordPress custom post query > for each of the results, factor in distance (calculated ...
0
votes
1answer
46 views

How to make post button to a random post

As you can see on my website http://www.kieshetsnel.nl/emma-watson-natalie-portman/ I currently have an Arrow left and right on the screen. But when i click next post (volgende keuze in Dutch) I ...
1
vote
1answer
39 views

How to connect two custom post types with nested loops

I have 2 custom post types created: "classes" and "teachers". I have created using Advanced Custom Fields plugin a field for "classes" custom post type, a multiselect that helps me add certain ...
0
votes
1answer
60 views

How to check if a product is purchased within the last 365 days before displaying something

I have a WP site using WooCommerce. Our products are made up of physical stock, a download and some links to pages on our site. I had set this up by placing the links to the specific product pages ...
0
votes
0answers
16 views

Query custom post in tag archive

I created a custom post and added the standard Wordpress tag functionality: function btp_work_register_post_type() { $args = array( 'label' => __('Works', 'btp_theme'),'labels' ...
-1
votes
2answers
38 views

Woocommerce linking variations

So I have this array (just taking an example, it's dynamically built up): $v_values = array( array("C1","C2"), array("F1","F2") ); $v_name = ...
0
votes
1answer
21 views

Show all child categories associated to post ID within loop

I'm looping through all posts and I'm trying to output the category nicename related to each post. So if there are categories A,B and C with post X only associated with categories A and C then I only ...
0
votes
0answers
29 views

Creating search.php for Wordpress with custom fields feature

I have seen a Wordpress site which has below features in its search.php section. http://www.example.com/category/film/?directors=Brad%20Anderson ...
0
votes
2answers
62 views

Wordpress get post thumbnail url

Its simple and answered quite often: I want to get the post thumbnail variable. Even if there is a lot of input, I could not make it work for me. Here is my current code I use somewhere inside my ...
0
votes
1answer
28 views

Custom loop - Isolating post meta output depending on current query taxonomy terms

I have started constructing is a page to display a series of products based on certain criteria. Each product is part of two separate taxonomies, one for brand and one for product size (each product ...
1
vote
0answers
22 views

Sharing post from archive page (loop) doesn't work

On my archive page, I have for each post( I have include in the loop) the possibiity to share the post via facebook via this code: <a href="http://www.facebook.com/sharer.php?u=<?php ...
1
vote
1answer
56 views

Display the_content on click jquery

I'm trying to display the_content of a post on click. the problem I'm having is that it display always display the same content. I mean by on click on read for post A, it display the_content of post ...
0
votes
1answer
47 views

Wordpress call post-ID in jquery

I explain the situation I'm having here: On my home page, I have a list of post being display. I've code to have like a modal box to share this post. Basically, on each post you have a button share. ...
0
votes
1answer
42 views

How to display 3 post per slide

I need to create a sliders contain 3 post title for each slide. I can create it by one title for each slide but not 3 posts Could you please help me This is My code <ul class="overview"> ...
1
vote
2answers
69 views

How to split a loop into two columns

I am running a dwfocus news website, I would like to split my li loop catagory in two section, can some let me know how can i proceed forward, thanks. <div class="headlines" ...
0
votes
1answer
26 views

Post formating on Home page

I've simple question regarding WordPress post looping. I want to achieve something like this on my site: ~ I am running Real estate portal site and I want to display featured property on my home ...
0
votes
0answers
13 views

WordPress Homepage - display set of posts from two categories and a set of products in date order

I'm in the planning process of a WordPress/Woocommerce site. The client wants to have the posts from two categories and her woocommerce products to show together on the home page in date order. This ...