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
2answers
14 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
2answers
504 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
3answers
3k 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
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
1answer
513 views

Add Infinite Scroll to Ajax Loaded Category Query

Update: This has been resolved. See update below. Following a few different online tutorials, I've managed to create a function to modify my post display via Ajax based on a category selected from a ...
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
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

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
1answer
2k views

Conditional two level dropdown filter for custom post type

I have set up a custom post type and taxonomy. The post type is called Local Services and the hierarchical taxonomy is called Regions. The Regions have child categories called Areas. I have set up a ...
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
1answer
498 views

Only display sticky post or latest post in custom loop

I'm new to Wordpress and PHP and I've been battling with this for a while now. What I have for the moment is 2 loops. I want to first loop to only ever show 1 post: either a sticky post, or the ...
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
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 ...
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 ...
2
votes
1answer
2k views

Display products for a category, sorted by post_excerpt

I'd like to display a list of products for a certain category, sorted by the post_excerpt. The original code I used was this: $args = array( 'tax_query' => array( array( ...
0
votes
2answers
379 views

How do I exclude posts by custom field value?

I need to exclude posts that have a custom field 'city' value of 'Melbourne'. After much searching I think the solution might consist of 2 parts. In functions.php : A function to get the post IDs ...
-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
313 views

Multisite redirect loop for a single www domain

I have been using WordPress multisite for several years without a problem. At some point in the last few days one of my many multisite domains is stuck in a redirection loop. The domain is ...
0
votes
1answer
381 views

Insert/sticky specific post into Loop at specific location

I'm having a hard time determining the first direction to take with this. I'm trying to write a plugin that allows users to pick a location for a post to be inserted into the homepage. For example a ...
0
votes
1answer
565 views

Offset WP_Query by negative 1

I have an event loop and I'm wondering if it's possible to offset the loop by -1, so the prev and next posts of the current post are shown. EDIT - Thanks for your comments, I think I can clarify. ...
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
2answers
330 views

Pagination/infinite scroll with WP_Query and multiple loops

I need that the main page of my site have 3 columns: - The first having the 5 most viewed posts; - The second with the next 5 most viewed posts; - The third with the most recent posts. I don't want ...
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 ...
29
votes
1answer
21k views

How to fix pagination for custom loops?

I have added a custom/secondary query to a template file/custom page template; how can I make WordPress use my custom query for pagination, instead of using the main query loop's pagination? Addendum ...
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
1answer
2k views

meta_query on a date range using an array of values

How can I do a query to return the post if the custom field array contains a date that is within the specified range? The query below is basically what I am after but it does not work... // the ...
2
votes
1answer
2k views

get_template_part from plugin

This is default get_template_part function inside WordPress: function get_template_part( $slug, $name = null ) { do_action( "get_template_part_{$slug}", $slug, $name ); $templates = array(); ...
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
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 ...
0
votes
1answer
323 views

Repeating Loop on my Posts Page

I have a problem with my loop.php, it keeps on repeating posts. I'm guessing this might be controlled outside of this loop.php as it happens no matter what I try. Could someone please advise me as to ...
1
vote
1answer
3k views

ajax for filtering posts by category in wordpress loops

I've been looking around for a way to filter my posts on http://www.waziproject.com/wazimagazine/ without reloading the page. So my question is if anyone can help me out to turn the following into a ...
3
votes
1answer
566 views

Have different number of posts on first page

I need to have a different amount of posts per page on the first page that on the other pages. For example, this is what I need Total posts: 6 First page: showing 3 posts Following page: showing 2 ...
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
3answers
318 views

Order by a meta fiel in query loop

I would like to sort my article from a category by a number added in a meta field. Here is the first step, I get the articles to display on the page. <?php $cat = get_post_meta( get_the_ID(), ...
0
votes
2answers
559 views

WP Query - duplicated posts once including tags in search results

I running WordPress on IIS & SQL server. As some of the plugins do not work correctly with DB ABSTRACTION I am using a lot of functions.php filters as so on. To make my search results include ...
0
votes
1answer
330 views

the_content() “crashes” for single pages

I have big trouble with the_content() for single.php. Whats my problem? the_content() doesn't give any output on single pages furthermore it crashes (no other PHP code below the function call is ...
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 ...
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
1answer
599 views

wp_insert_posts Fatal error: Maximum function nesting level of '100' reached, aborting!

I'm having a weird problem I have written the code as below: add_action('save_post', 'save_post_func'); function save_post_func(){ include_once(ABSPATH . WPINC . '/feed.php'); $rss = ...
0
votes
1answer
47 views

Update status of all posts in a category

For one of my project I just want to change the post status of all the posts inside a specific category from publish to pending. It is possible to change status of multiple posts at once? I want to ...
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 ...