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)

2
votes
0answers
4k views

AJAX with loop filtering categories

I've been researching on how to make my loop with AJAX. I found some codes online and modified some parts but I can't seem to get it to work. This is my code for the loop: <article id="main" ...
2
votes
0answers
1k views

Loop that displays PARENT PAGE & CHILD PAGE & outputs GRANDCHILD PAGE title and content

I've never posted here, but I'm tired of slapping code together. That said, I would be most appreciative if someone could help me with this. I need a page template that: outputs the PARENT PAGEs, ...
2
votes
0answers
738 views

Display one post from each term in a custom taxonomy

I am trying to display a list which shows one post (and information about the person posting) from each custom taxonomy term. The code I am using is as follows, but it is instead printing out EVERY ...
1
vote
0answers
26 views

Infinite Scroll and DFP

Well , I'm trying the next loop to make work DFP in an Infinite Scroll. I thought that if I change the name of the Slot I could get the banner shown, so I tried this: <!-- DFP Controller --> ...
1
vote
0answers
18 views

Two loops on different pages do the same thing, but only one page works

I want to verify a code sent in an email. I do it once to verify your email when you signup and again if youre the winner of the contest. Since its basically the same thing, I reused the same code ...
1
vote
0answers
28 views

How to append element after thumbnail

Hey I just wanted to know how to add an element after the first thumbnail image in my loop. Basically I want an HTML div tag inserted after the first image in my post. Anyone know how to do that in ...
1
vote
0answers
14 views

Change the main loop Wordpress impact on the server?

I used pre_get_posts to change the loop of my Wordpress site. The idea of this loop is not show posts I define an expiration date, whose dates are added in a custom field ( postexpiry ) . These ...
1
vote
0answers
38 views

Posts active and expired in different loops

I am in search of the best way to display pages active posts categories and expired after a certain period. I want to display active posts or have no expiration date in the main loop and those that ...
1
vote
0answers
22 views

Adding a custom product filter

I'm currently working with woo-commerce. I'm looking to add a custom product filter (I'm looking to build this as a learning exercise), currently my product categories pull back all products in that ...
1
vote
0answers
93 views

How to use jPList with search results

I've been working on a real estate site and looking for a way to refine search results page + update pagination, instantly, like the big name sites (ie hotpads.com, trulia.com, hotels.com, etc.). ...
1
vote
0answers
64 views

Trying to use AngularJS with WordPress without any API

I understand one can do this using the JSON RESTful API from WP but I don't want to go that route since it only works with sites on Wordpress.com and not on localhost (at least that's what I was told ...
1
vote
0answers
32 views

Search form not working with custom query?

My search query doesn't seem to work, the query in my url is all correct but the content just refreshes without finding the posts with the search term.. I got a custom search query and a function to ...
1
vote
0answers
51 views

Blog page Server error 500 with stick post loop in query.php

Using sticky post on site near about 5000 sticky post i have. In wp-includes/query.php here i have bellow snippet code.on line 3748 to 3760.If i comment this code the blog page work properly. if ...
1
vote
0answers
55 views

Woocommerce order query parameters IP address

I need to list all orders in a specific date and exclude ordrs from specific ip address. I know how to retrieve the order from a specific date $args = array( 'post_type' => ...
1
vote
0answers
33 views

Can't find infinite loop cause

I am working on the below function which will eventually create a set of posts based on meta data entered into a "parent" post. I'm running into an infinite loop when hitting the save button, which I ...
1
vote
0answers
71 views

Custom Loop through category menu to include sub categories

In my custom wordpress theme I currently have the below loop to the main categories <?php $menu = wp_get_nav_menu_object('navigation'); $items = wp_get_nav_menu_items($menu->term_id); ...
1
vote
0answers
17 views

Blog's post count cause irratic behavior

Using WP 4.4, if i set my 'max posts' in Settings > Reading = 1 , Reload blog page [which is front page] the page loads infinite 404s i have this in the start of my format.php <?php if ( ...
1
vote
0answers
46 views

Default Custom Field Value Automatically Update

I have created a hidden custom field with a php function as its value. Like so -- $value_rating = get_post_meta($Property_Id, 'vr', true); <input type="hidden" name="vr" class="form-control ...
1
vote
0answers
37 views

Can't get WooCommerce Category to display in loop

So. I'm trying to display only a certain category on my page, but it keeps saying "no matched posts with your criteria" (only in Dutch, so forgive me if the error message is poorly translated). I'm ...
1
vote
0answers
33 views

WooCommerce free products always first in catrgory/archive loop

I needed to make some products to show POA instead of the price, so I used FREE products option and changed FREE text to POA. Now I've got a request to make those products to always be first when ...
1
vote
0answers
32 views

How to : pagination in 3 different custom loops on the same page

I have this content in my index.php. 3 areas with 3 distinct custop wp_query loops to get different categories of articles in each one. I have set wordpress to show 12 articles by page, so it displays ...
1
vote
0answers
60 views

Pagination with an array of post objects?

I am curious, I have the following code: foreach ($this->networkBlogs as $siteBlog) { switch_to_blog($siteBlog['blog_id']); foreach (get_posts() as $postObject) { ...
1
vote
0answers
284 views

Custom Loop and Infinite Scroll

I am using customized version of _s theme where I have Product CPT. In the following files, I need to use Infinite scroll (provided by Jetpack) - archive-products.php taxonomy-[tax-name].php ...
1
vote
0answers
51 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
0answers
32 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 ...
1
vote
0answers
146 views

How to make search for posts using get method?

So I am building a WordPress theme for myself to meet my needs, so what I am looking for now is make a search using a get method in PHP. If my URL is something like this : ...
1
vote
0answers
267 views

Default 'post' post type archive slug?

I have a wordpress site, which has a front-page.php rendering a custom front page, so that this template will show no matter if WP admin settings is set to static page or show posts. The default ...
1
vote
0answers
209 views

WordPress ignoring LIMIT / posts_per_page despite being in wp_query

Using WP query: $myquery = new WP_Query( array( 'posts_per_page' => $instance['count'], 'meta_key' => 'mywp_post_views_count', 'orderby' => 'meta_value_num', 'order' => ...
1
vote
0answers
166 views

Conflict with get_posts and the_content

I have this snippet in my header.php to display a slider: <?php $args = array( 'post_type' => 'post', 'posts_per_page' => 6, 'meta_query' ...
1
vote
0answers
215 views

Multiple Loops on category.php with pagination on last loop

I'm trying to achieve what should be fairly simple but I've hit a brick wall when trying to paginate the last of three loops on the category.php template. I've read just about everything I can find on ...
1
vote
0answers
349 views

WP_Query Order by Specific Post ID First

I'm creating a website where I have a need to show a set of posts from a custom loop but I need to display a specific post first. This post will be dynamically specified in the URI by a $_GET ...
1
vote
0answers
47 views

Multiple Loops Meta Data

I am now trying to figure out how to create the functions/ loops to pull my data from custom post types. I have two post types(keys): And I need to pull the data from both to run my functions. ...
1
vote
0answers
137 views

Divide Loop Into Days & Categories

If you could help, I'd greatly appreciate it, because I'm halfway there, but I'm currently stuck! The site I'm working on needs to have it's posts, within the loop, divided up by days, and then under ...
1
vote
0answers
361 views

Get Page content to displayin Bootstrap Modal

Ok I'm a relative novice here, and after looking around I still haven't found the answer to my problem. I'm basically trying to link a Bootstrap Modal to some text in a footer (widget), the content of ...
1
vote
0answers
89 views

WordPress Rewriting the DOM?

WordPress 3.9.1, Bones Theme. I'm setting up an archive page for regular 'ol blog posts. The theory is to wrap each post's information in a permalink. Such as: <?php if (have_posts()) : while ...
1
vote
0answers
67 views

Custom Theme With Custom Loops

There are so many different questions on how to make pages show page numbers at the bottom but I can't seem to use the concepts explained in those to solve my own problem. I know some PHP and I've ...
1
vote
0answers
32 views

Start WP Pagination From Number 1 in URL

I am using this code to paginate gallery post type images: $images = get_posts(array( 'post_type' => 'attachment', 'post_status' => 'inherit', 'post__in' => $image_ids, 'orderby' => ...
1
vote
0answers
42 views

How can I load posts starting from, and including, the current post?

I'm loading some posts using this argument: $args = array( 'category__in' => $catID, 'category__not_in' => 1, 'posts_per_page'=>10, 'date_query' => array( array( 'before' => ...
1
vote
0answers
93 views

How to show a post if was published less than two hours ago?

I want to show posts only that were posted less that 2 hours ago and have the custom field "¿directo?" with the value "Sí". These are my progresses, but they don't work: Functions.php: function ...
1
vote
0answers
97 views

Sort results by groups of numbers and letters

I have this code: <?php $letter=' '; query_posts( array ( 'orderby' => 'title', 'order' => 'ASC' ) ); if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <ul> ...
1
vote
0answers
297 views

Infinite Scroll on a loop?

I have a home page with four different loops (different category's) On one of the loops I want it to display five posts but also have the infinite scroll on it. I have installed the infinite scroll ...
1
vote
0answers
394 views

Shortcode in posts called by ajax is not working

I am using ajax to load content of post. Functions like the_title() works fine, but unfortunately the_content() doesn't returns any shordcodes( gallery nor tablepress ) data. here is my code: ...
1
vote
0answers
483 views

multiple loops with pagination on the same page

I'm searching the web for this answer for three weeks now. Tried many things but nothing seems to work as how it should work. There must be a kind of trick what probably won't make sense to anybody ...
1
vote
0answers
495 views

Show all posts using the template page and the loop?

I am trying to make a template page that would display all posts from all categories, in short - every post added to my website. I was googling around and found out that it can be done by using The ...
1
vote
0answers
131 views

Checkbox doesn't stay checked, conten

I'm using the morefields plugin to create textfields and checkboxes in the dashboard. For a test I have first created a checkbox on 'pages' if it was checked, the frontend showed the text ...
1
vote
0answers
34 views

On single.php, fetch 2 posts created after and 2 posts created before in relation to the actual post (using menu_order)

Looking for a way to on single.php fetch and show the actual post, and then by looking on the menu_order value of that specific post (lets say the post have menu_order value 3 in this case) go and ...
1
vote
0answers
132 views

Custom post type conditional in loop

I need multiple loops on a page and have created them as such global $post; $args = array( 'numberposts' => 3, 'category' => 10 ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : ...
1
vote
0answers
206 views

Listing all term items alphabetically / sorting loop

I have my own custom post type and it has its own taxonomy and terms. Whenever user visits http://example.com/mytaxonomy/myterm I want the page to display all items within this term alphabetically. ...
1
vote
0answers
70 views

Display posts with comments closed, with pagination?

i'm using a custom query, which needs to display all posts with closed comments. I have this <?php $the_query = new WP_Query('showposts=-1'); ?> <?php while ($the_query -> have_posts()) ...
1
vote
0answers
113 views

Problem getting current post tags to show in a widget

I have tried tons of examples and suggestion on this topic but I can not get them to work. What I am trying to do is display the tags associated with the current post in a widget. I have built the ...