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

Make a custom loop inside single.php with pagination

I want to create a custom loop inside a single-ediciones.php file and I need pagination (actually AJAX pagination). I need my normal loop because I need to show some data of the CPT "Ediciones" and I ...
0
votes
1answer
470 views

Unable to display paging navigation with a custom post type loop

I have used a starter pack for my WordPress theme development, but I can't display the navigation on a custom post type loop. The framework starter is : http://underscores.me/ There is my PHP Code ...
0
votes
1answer
14 views

Getting the Most Recent Posts from Multiple Categories

I've got a page (page, not post) that near the bottom of the page I want to get the most recent 15 posts from a set of categories. I'm new to doing this and thought I was doing it correctly. The div ...
0
votes
2answers
104 views

How to overwrite orderby with add_query_var

So I would like to have an archive that displays its posts in a random order. <?php $query = new WP_Query($query_string."&orderby=rand"); ?> But also then if the user chooses they ...
0
votes
2answers
3k 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
1answer
26 views

have_posts() return false on single post

I'm a little bit confused with the use of the Loop. This is my first theme and i just use index.php currently to display all my pages. It works fine for pages but have_posts return false when i try to ...
1
vote
3answers
86 views

get_the_content not working in loop?

I am trying to modify my loop to save post data by category. I found some code on this site that saved the post's titles based on their categories and tried to modify this to save the post's content. ...
0
votes
2answers
868 views

Including all post id's of a custom post type into an array

For my single.php (products.php), I try to build a navigation via which the user can switch between products based on the meta key "price". I want to put all id's of the products post type into an ...
2
votes
1answer
3k 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
631 views

WP_Query post at custom position

Lets say I have a custom query which based on two custom post types: $wp_query = new WP_Query(array( 'post_type' => array('post-type-1', 'post-type-2'), 'post_status' => ...
0
votes
1answer
439 views

Display most viewed post from last 30 days is not working correctly

I've try several different loop to display the most viewed post from the last 30 days . . However its just showing the post from 30 dasy ago . . not from the last 30 days . . not the most viewed . . ...
1
vote
2answers
31 views

if ( is_home() && ! is_front_page() )

I see the following code a lot in index.php files. I understand that is_front_page() returns true when viewing the Site Front Page (whether displaying the blog posts index or a static page), while ...
1
vote
1answer
829 views

Pagination Issues using WP_Paginate Plugin

So I have read more posts and articles about this issue than I care to admit and still nothing I can find works. Here is the issue - I can not get the pagination to advance and it shows all the same ...
0
votes
1answer
26 views

Customize Wordpress Loop With Div Breaks

Hey I am attempting to customize my wordpress post loop to create different post style for a certain set of post. For example the first three post would be styled in it's own way, the next four post ...
0
votes
1answer
544 views

How can I use get_permalink() outside the loop?

I've been struggling with this question for a while and although there's some information regarding this subject I'm not sure how to implement it. My question regards sharing the current page. I am ...
0
votes
2answers
683 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, ...
13
votes
9answers
29k views

Get post content from outside the loop

Is there a way to get the content from another outside the loop? The ID is 302 and I need to display the content of that on another page.
0
votes
0answers
26 views

wp_get_archives doesn't work with 'post_type' with WordPress 4.5

wp_get_archives support the post_type parameter from 4.4.0, so I decided to add a <select> on the cpt's archive page. Unfortunately wp_get_archives returns with NULL. Do you have any idea ...
0
votes
0answers
23 views

Display category name only once inside loop

I have been researching on how I can output the category name on a wordpress loop for custom post only to display only once. If there are any posts under the same category, the category name will not ...
0
votes
2answers
759 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
26 views

Wp_query with 2 meta keys and array of meta values

Hi in my post_type=shop i have 2 meta keys and array of values Custom fields Name Values cu_status pending,processing,completed cu_date 12-Jan-2016 , 13-Jan-2016, ...... any ...
0
votes
0answers
15 views

wp-video-post plugin upload loop only if uploading bigger mp4s [on hold]

I know the question is very special, but I really don't know what to do. It's about this wonderful plugin: https://wordpress.org/support/plugin/wp-video-posts It's working great, but after a few ...
0
votes
1answer
37 views

Omitting the latest entry with custom type and taxonomy term from the loop

My agency has inherited a client with a customized theme provided to them from a separate agency, which farmed the work to another agency off-shore. The documentation for this theme is non-existent ...
0
votes
1answer
519 views

page.php showing loop of posts and not page content

My front page displays the latest posts using index.php. My page.php contains the wp_header up top, the wp_footer below, and this in between: while (have_posts()) : the_post(); ...
0
votes
0answers
10 views

List posts that are geotagged within a certain area

I'd like to geotag some post on WP with latitude and longitude in a custom field. It's very easy to show a map with this data but what if I want to show all the posts that are geotagged, let say, in a ...
0
votes
1answer
39 views

How to make a wordpress loop file that displays posts based on certain conditions

Am recently trying to learn the framework aspect of WordPress,so i want to build a user homepage that only displays posts from other registered users, but the posts that will be displayed will have to ...
1
vote
1answer
64 views

Custom Post Type Pagination Not Working On Archive Page

I've spent the last 3 hours trying to get pagination to show up on my custom post type archive page. I sort of understand that pagination only works with a default loop and once you modify the loop, ...
0
votes
1answer
38 views

meta_query not working properly

I'm trying to run a query that only displays items that meet a condition in an Advanced Custom Fields select box, but I'm getting nothing. Here's my query. Any help would be appreciated: <?php ...
0
votes
2answers
35 views

How to Order By Two Custom Fields?

Note : This is not a duplicate question to If value present, order posts by two consecutive custom fields. After filtering a custom filed, I need to order by another custom filed. (The above link ...
1
vote
1answer
52 views

Wordpress have_posts() return false but count says “3”

The situation is this: I have created a custom post type which works perfectly, now I want to create a specific archive page template for the taxonomies of this post type. I duplicated the ...
-2
votes
2answers
42 views

How to create a loop where loop changes every post?

How can I create a type of loop in WordPress where an image moves left or right for each post? I.e. first post image will be left, second post image will go right, third post image will go left, and ...
0
votes
3answers
585 views

Order by a meta field 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(), ...
3
votes
6answers
3k views

Get date of last update outside of loop

I'm trying to figure out how to display the date that a post was last updated outside of the loop. I'm able to display the published date using get_the_time() but there doesn't seem to be a "loopless" ...
0
votes
1answer
592 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 ...
0
votes
1answer
28 views

Adding a html class based on post count

I'm creating a grid of columns and need to add a css class to each column at the end of the loop based on the amount of posts returned so it returns something like this: <div ...
0
votes
1answer
505 views

How can I include sub-forum topics in a bbpress topic loop?

Out of the box, bbpress shows topics from a particular forum when you are on that forum's archive page. Makes sense. If that forum has a sub-forum, it will link to those sub-forums, but it won't show ...
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 ...
0
votes
1answer
946 views

Search.php - return number of results but cannot loop through

I have a following search.php page (this is just the code required for problem presentation). Why is my $total_results returning a number of posts found, but when I do a loop though it always print ...
0
votes
2answers
48 views

How to display post list in a table layout (multiple queries in single loop)

I am setting up an events page for my website. This page is using a loop to display a list of acts performing at different venues month-by-month. When a viewer comes to the page, they use a simple ...
0
votes
1answer
772 views

group search results by post type?

My site has 3 unique post types: Default Blog posts ("post") custom type "lesson" custom type "series" When the user searches the site, I would like pertinent results from all 3 post types to show ...
0
votes
0answers
13 views

Loop through author and edit post tags

I'm setting up a 'free marketplace' for a friend based on wordpress and a woocommerce theme (makery). Each user has his own shop and products. Both the shop and products are custom posts that belong ...
0
votes
1answer
20 views

How can I make this iterative conditional within the Loop work via function?

I want an element to appear within the Loop, but only at certain points. I can supply the condition - in the form of a "flag" that gets set when the condition is fulfilled, preventing further ...
-1
votes
3answers
469 views

How can I implement pagination on custom category page?

I have created a custom template page for every one of my categories. I am using a foreach loop in order to fetch the posts of this specific category in my page. if (is_page()) { ...
2
votes
1answer
3k 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( ...
2
votes
1answer
301 views

How to remove items in quick edit panel-Function for remove items in wordpress quick-edit panel?

I need to remove some items in the quickedit panel .Let me know is there any way to hide product attribute list from quick edit window of product page in woocommerce? Currently iam doing this via css ...
0
votes
0answers
14 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 --> ...
0
votes
1answer
26 views

Posts Per Page is Not Returning Correct Number

I have a single.php with 3 loops one the page (related posts, latest posts and the actual content). All loops are using the wp_reset_postdata(); at the end. For some reason my post_per_page ...
-1
votes
1answer
16 views

How to separate posts loop in to two columns? [duplicate]

I need to separate WordPress posts loop in to 2 columns , left ( all odds ) and right ( all evens ) . Currently I am doing this with 2 separate loops but would like to make it with one and would ...
0
votes
2answers
59 views

Pagination Not working on Home Page with 2 Query

I have two loops in home page (index.php) <?php $args = array( 'post_type' => 'post', 'posts_per_page' => 3, ); $another_query = new WP_Query($args); if( ...
3
votes
1answer
2k 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 ...