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

WordPress loop by three meta values with random order

We have three custom fields with names plan_name1,plan_name2 and plan_name3. Need to check if these meta keys has values (1,2,3) OR (2,3,1) OR (1,3,2) OR (2,1,3) OR (3,2,1) OR (3,1,2) We mean ...
0
votes
0answers
19 views

Terms showing empty inside a loop

I have the following problem: I have 2 taxonomies that belongs to a custom post type What i want to do: Loop = taxonomy 1 loop = taxonomy 2 loop = post type My code works but, it shows ...
2
votes
0answers
36 views

Display Featured Image On Hover in Seperate Div

Hi I'm trying to accomplish showing my featured thumbnail on hover. Here is a photo example. The photo on the left is the featured image for the first post on the right. I want first post ...
0
votes
1answer
797 views

Listing Specific Categories from Current Post with Depth

I've been on this for sometime and been having a ton of issues to find a proper way to do what I'm trying to achieve. An Example would be as follows: I have a featured Image with a rollover and I ...
0
votes
2answers
289 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
1k views

WP_Query orderby random do not repeat infinite scroll - one loop

I have found a lot of documentation on solving this issue with multiple loops, I'm finding it hard to see a solution for one custom loop. Problem: I'm using infinite scroll to load in the next page ...
0
votes
2answers
2k views

How to exclude specific category from the get_the_category(); array

In my loop I've added: <?php $categories = get_the_category(); $separator = ' '; $output = ''; if($categories){ foreach($categories as $category) { $output .= '<span ...
1
vote
1answer
48 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
472 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
16 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
108 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
27 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
90 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
878 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
632 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
444 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
32 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
548 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
691 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
30 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
25 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
768 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

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
38 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
520 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
42 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
68 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
40 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
589 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
4k 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
595 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
30 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
507 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
947 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
50 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
791 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
474 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
321 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 ...