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

loop query exclude meta_key with meta_value

Hi I use a loop like this: // show all active coupons for this store and setup pagination $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts( array( 'post_type' => ...
0
votes
0answers
11 views

Call grand-children of page outside a loop?

I am knocking my head to a wall since couple of days, Here is the situation ( I attach a graphic to explain more clearly what I want): I have one main page-template. Who is the parent of three ...
0
votes
0answers
11 views

Loop Wordpress Next and Previous Post

I have a next and previous post link in Wordpress but if you're viewing the very last post or the very first post you get a blank space where no other posts meet the condition. How do I edit my code ...
0
votes
0answers
13 views

Comment form on page redirects back to frontpage

I have a page template with a single WP_Query what displays only one posts (Depends from the value of the $_GET. Example: domain.com/custom/?id=2). I would like to add a comments form I used ...
0
votes
0answers
22 views

Loop only displaying one post

After a WordPress update the following code started only displaying one post on the page. I thought something was deprecated so I updated the parts I was sure about. But I'm still getting pretty much ...
0
votes
1answer
9 views

Use BuddyPress data in loop (mkdir)

I am trying to create a folder per user based on BuddyPress fields, using the following: bp_member_profile_data( 'field=ID Number' ); If I use the above code with mkdir, it doesn't work (ie, the ...
0
votes
0answers
13 views

creating one page theme but templates are not being applied to page content on the “one”page.

I am creating a one page theme. I have a loop that puts the content from each page on a single page but it does not apply the temple for each individual page. Here is the loop I am using. <?php ...
0
votes
2answers
55 views

Custom taxonomy page template

I'm working on my own wordpress theme for the first time. I registered a new post type with custom taxonomy, but I can't display the posts by terms. I duplicated the archive.php and renamed it to ...
0
votes
0answers
11 views

Exclude current post from custom loop using Infinite Scroll

I'm turning to you for help with a custom loop which uses Infinite Scroll. What I'm trying to do is have a list of all posts at the bottom of a single post (in single.php). With very basic PHP ...
0
votes
2answers
21 views

Multiple loops for custom post type to spread data across rows

How do I split the values within a custom post type loop so that the title is in the first loop which outputs in the first DIV and the content is in the second loop outputting in the second DIV? Two ...
0
votes
0answers
11 views

Building URLs with Custom Post Type

Here is my current dilemna. I have created two custom post types, Verticals and Products. The Products information is fed into the Verticals and there is an interior nav with anchor links that ...
0
votes
2answers
41 views

Getting Permalink within the loop

I have a (Roots/Sage-based) theme with a home.php template override and on that page am displaying excerpts and featured image for each post. <?php while (have_posts()) : the_post(); ?> ...
0
votes
1answer
10 views

Changing layout with wp_customise

So I'm trying to build a conditional statement to display different layouts depending on the option selected. Having a bit of trouble. $wp_customize->add_setting('layout', array( 'default' ...
0
votes
1answer
14 views

In Custom page - next_posts_link Not working while previous_posts_link is working

I have a custom template which has a custom query. I am using this template to create a page (Not a front page) from wordpress. Since the page has multiple posts, I want to put a navigation..... I did ...
0
votes
0answers
8 views

multiscroll confusion in wordpress

I'm using multiscroll jquery plugin for multiscroll. here is the code from documentation of plugin.. <div id="multiscroll"> <div class="ms-left"> <div ...
-2
votes
0answers
17 views

Automatically add attribute in woocommere [closed]

I search a code snippet to automatically add attributes like color or size to woo commerce products and auto publish them, if those attributes aren't empty any more. I've read a lot on those sites to ...
0
votes
1answer
27 views

Create Customization Controls from Array

Coming from a Javascript background and humbly jumping into WP dev I'm having some trouble with PHP (especially in a WordPress context). Here's what I'm trying to do: Create controls for the ...
0
votes
1answer
17 views

How to loop through a custom field for each post, & display?

I'm working on a category page. I want to show all the posts that belong to that category on one page. Each post makes use of a custom field that I have added. I want to loop through the posts to ...
0
votes
0answers
42 views

Ajax Button to load more Posts into a timeline

I am setting up a timeline page for a customer and so far i have designed the timeline and i am using 2 loops to place the posts in 2 columns (left and right) where the first post is located at the ...
0
votes
2answers
34 views

Custom Post Loop in Archive returns same the_permalink

I've got the following code that is meant to grab the latest post from each of the provided custom post types ($customTypes), it works on the majority of pages of my site, eg here: ...
0
votes
0answers
6 views

How to avoid the product's limit for taxonomy in WooCommerce?

Recently I'm faced with an interesting effect which seems to go with default settings. When you just display products in mixed order it's ok, but when you're trying to create custom category for them ...
1
vote
0answers
14 views

Show top level comments ordered by number of replies

I am trying to modify the comment loop initiated by wp_list_comments to change the order they are returned. Specifically I have 2 levels enabled on my comments (top level and replies), and I want to ...
0
votes
1answer
22 views

Navigation for custom loop

I have a website I'm working on with 3 custom loops next to each other: Station LV I need separate navigation for older posts for each loop. But I'm having problems seting it up: <?php ...
2
votes
2answers
103 views

Exclude first 5 posts of specific categories in the main loop

I read this article about how to set an offset for one specific category in the loop. I was wondering about if this was possible for more than just one category. My problem with the code suggested in ...
0
votes
0answers
11 views

Pagination in a custom loop on a non-static (i.e. blog) page

All of the documentation I've read refers to paginating custom loops on a static page (home or otherwise), and whether you should be using 'page' or 'paged' for the pagination parameters. I'm not ...
0
votes
1answer
50 views

Wrap every four posts within a div [duplicate]

am trying to wrap every row of wordpress posts with a div with a class of row. Have been trying to follow the answers from another question linked below But seem to be having trouble as my loop is a ...
1
vote
2answers
31 views

wp-admin redirecting to https, denying login

I use cloudflare via the cloudflare plugin, have SSL enabled. Enabled ssl within the wp-config.php file: define('WP_HOME','https://example.org'); define('WP_SITEURL','https://example.org'); ...
0
votes
0answers
22 views

Using an actual page for 404 instead of a template

How would I override the 404 template and fetch a whole page instead? Currently I have achieved this by doing a http request from 404.php(the 404 template) to http://example.org/error404, which in ...
0
votes
0answers
26 views

Publish specific category posts to specific pages

I'd like to have many different categories of posts. And many "blog template" pages. And when i create a new post of a specific category and see it posted only on specific pages. Is the only way by ...
0
votes
0answers
27 views

Repeating a loop after x amount of time

I'm new to Wordpress and PHP and would really appreciate a little pointer regarding a problem I can't solve: I have a Wordpress site and in my Homepage I have a section that when the page loads ...
0
votes
1answer
22 views

show category name before first posts in each category

I want sort posts in the loop by category and before first post in each category display category name. For example: Category 1 Post Post Post Category 2 Post Post Post Post ...
0
votes
1answer
81 views

While loop with bootstrap [closed]

Is it possible to do a while loop with Accordion from bootstrap ? I am trying to make a FAQ section with the repeater add pro add on from advanced custom fields. All the questions show up but they ...
0
votes
2answers
45 views

WP_Query a custom field value bringing back 0 results

I am trying to do a query to grab all the pages that have the tickbox checked "feature_on_front_page" which has the value "featured" with label "Featured". I added this checkbox with ACF. My query ...
0
votes
0answers
15 views

How to move posts in featured category on top and keep pagination

I want to move every post from category_id = 11 and 10 on top of the list and then query every other post which is only in 10th. I thought that making two loops will do the trick but there is a ...
0
votes
1answer
12 views

How to sort posts in archive loop

I need to sort posts using this loop, is an archive page (pc-archive.php) for a CTP named "PC". Tried with <?php while ( have_posts('order=desc') ) : the_post(); ?> but no luck... ...
1
vote
2answers
56 views

Exclude category by slug for for each loop

I am trying to exclude some categories from a for-loop. <?php $categories = get_categories(array('exclude' => 'apps, windows')); ?> <?php foreach ($categories as $category) : ?> ...
1
vote
2answers
60 views

Looping through posts per category gives same posts for each category

For a specific section on my website I loop through some categories and get the three latest posts in that categorie and list them. Like so: <?php $categories = get_categories(array('exclude' ...
-2
votes
0answers
27 views

How to add pagination to custom Woocommerce loop?

I am using woocommerce and need to make a new loop. This loop is working, however, some key information is left out, I need the number of products per page, and more importantly the pagination is ...
0
votes
0answers
20 views

Bootstrap tabs inside forloop

I'm using bootstrap tabs with custom icon for each tab, I used wp_terms() to get taxonomies and with for loop print the title of them for each tab. but how can I add the specific class for each icon ? ...
0
votes
1answer
30 views

Get most recent post for every term in a given taxonomy type

I'm looking for an efficient way to retrieve the most recent post from every term for a given taxonomy type. I found this question, which provides the same solution I came to on my own: $terms = ...
2
votes
1answer
11 views

How to check for specific content in comments in the loop

I'm using the following conditional code to check if any comments on a given post contains a certain string. -The word 'CHANGES' in this case. I have it working if I specify the comment_ID directly, ...
3
votes
1answer
113 views

the_content and wp_link_pages

Many plugins seem to be adding a filter/action hook to the_content to display related posts, advertisements and such. The problem is I these appear before the post pagination so it the pagination is ...
0
votes
1answer
30 views

Pass the_post() as a parameter

I would like to take the following code sample <?php while ( have_posts() ) : the_post(); ?> <h2><?php the_field('title'); ?></h2> <p><?php the_field('desc'); ...
0
votes
0answers
22 views

Get posts of specific post format, extract youtube link and use ID for image thumbnail

I am looking to query four posts of which I'll display the title and the video thumbnail. Something like this maybe? $args = array( 'tax_query' => array( array( 'taxonomy' ...
0
votes
3answers
38 views

Cant insert wrapper div into index.php

I'm having an issue inserting a wrapper div into my php index file that we're using for the front page of the site. Right now it looks like this: And it needs to look like this: I'm aware this ...
0
votes
0answers
33 views

Pagination on custom post types

Pagination works in the front page but in custom post type page it doesn't appear. Post type: add_action('init', 'portfolio_register'); function portfolio_register() { $args = array( ...
1
vote
1answer
33 views

<!--nextpage--> as a shortcode within the loop?

Anyone implemented this successfully? I want to include the <!--nextpage--> within a single post loop as a shortcode. I tried to echo it, the tag shows up but the post doesn't get divided into ...
0
votes
0answers
34 views

the_title() Returns the page title instead of the post

I'm using a custom page for listing my posts, now using the loop and the_title() returns the page title instead of the posts. My loop is a simple: <?php if (have_posts()) : ?> <?php while ...
0
votes
1answer
37 views

get_the_title() is returning results from previous loop

I'm attempting to loop thought a custom post type (artists), then each category, then another custom post type (story) which has a relationship with the artist. The issue is, the function ID ); ?> in ...
-1
votes
1answer
53 views

tax_query not working properly with get_posts

Here are my args: $args_home = array( 'post_type' => array('news', 'jobs'), 'posts_per_page' => 12, 'meta_query' => array( array( 'key' => '_thumbnail_id' ...