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

Wordpress slider with bootstrap carousel

I have create slider for front-page with bootstrap carousel, for slider content get from featured category, problem is the slider 1st, 2nd, 3rd displayed as list. normally layered with navigation ...
0
votes
0answers
20 views

Inserting CPT and static content at every X post, is this possible?

I'm working through a spec list for a new project which has the following feature: Display all CPT's from a specific category on an archive page, then insert an advert (CPT) into the loop after every ...
0
votes
1answer
17 views

Two near-identical custom field types - one works, the other doesn't . What can cause this?

I'm using Advanced Custom Fields to add meta information to a custom post type and in ACF I've created two different 'Select'-dropdowns - one is called 'series' the other 'classification'. I run a ...
3
votes
1answer
27 views

Apply styling only to first page sticky posts

I'm using the following bit of code to highlight sticky posts: <?php if (is_sticky()) : ?> <div class="col-md-12 box-01"> <div class="content"> <?php endif; ?> The ...
0
votes
0answers
14 views

Alternative layout the loop

i'm trying to make an alternative loop as found here on stackexchange, it has been a great help to what i've achieved so far, but i'm stuck now. The goal is to make the newspage look like this The ...
0
votes
1answer
21 views

Integrating Orbit slider into wordpress through custom post type

I am currently working with FoundationPress, It is a great starter theme loaded with cool features. I would like to create a custom post type called "slides" which will be displayed on the homepage ...
1
vote
1answer
28 views

How do I Use Nested Loops of Custom Post Types for MultiSite Blogs using WP_Query()

I'm using the code from miguelpeixe's 'WordPress Query Multisite' in order to create a custom loop for my WP Multi-site's 'child sites.' Within this loop, I want to nest another loop that will pull ...
0
votes
2answers
35 views

the_content() stop images being pulled through

I have created a custom post type to pull through the date, title, thumbnail and content, some of the posts have images and the_content() is pulling through those images and I don't know how to stop ...
0
votes
0answers
21 views

angularjs not displaying all posts

I learned about angularjs today and I am trying to create a page for my search results so that I can be able to create facet filters. Currently I have a page template with the following code -- ...
0
votes
0answers
9 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
votes
0answers
24 views

Wordpress custom post loop for slider

I am writing the looping within the slider, slider will look like double slider , The second a tag inside li comes below : ...
0
votes
2answers
27 views

How to handle “the_terms” inside loop

I have been searching google but I am really confused. I am trying to display the terms of the taxonomy assigned to the post. I am using the_terms($post->ID, 'locations');. The custom taxonomy is ...
0
votes
0answers
23 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.). ...
0
votes
1answer
33 views

Loop through Navbar, Output Icons

I'm trying to loop through my Navbar in WordPress so that I can output some Icons at the end of the last link. I have this working but I end up outputting a Navbar and a list. I think this is because ...
1
vote
1answer
28 views

Creating loop within functions.php

I'm using Woocommerce on my website, on the checkout page I've got a custom select checkout field with radio buttons. I'm using this working snippet within my functions.php: /** * Add the field to ...
0
votes
2answers
50 views

The loop seems stuck to a single (now deleted) post

At first I thought it was an ACF problem, but printing some values helped me to find out that somehow my Loop seems stuck on a single post, but only when some fields are concerned. To sum up my ...
2
votes
2answers
52 views

Sort Popular Posts by Views for the Last Week

I'm trying to sort the popular posts so it shows the most visited in the last week, but it hasn't worked. Anyone have an idea of why it isn't working? <?php $popularpost = new WP_Query( array ( ...
1
vote
1answer
28 views

Custom Shortcode, functions PHP WP_Query loop

I have the following code in my functions.php file:- function featured_properties_func( $atts ) { $args = array( 'posts_per_page'=> -1, 'post_type' => 'properties', ...
2
votes
0answers
18 views

Double count view in archive.php

I'm having a hard time using this snippet I'm getting double views each time the post is queried. This is in my functions.php file: function getPostViews($postID){ $count_key = ...
3
votes
1answer
62 views

Displaying post per day

Currently I have the code displayed below. <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <div class="col-lg-3 col-md-4 col-sm-6 col-xs-12"> <a ...
1
vote
1answer
25 views

Meta Key Value in current-user-only loop

I created a loop for logged-in-users-only which works perfectly for all data except for meta keys. I'd like to be able to also extract meta keys but had no luck so far. This is my loop (based on this ...
5
votes
2answers
73 views

How to list some posts first in the loop based on post id

I have a query for to display some posts . $args = array( 'post_type' =>'products' 'posts_per_page'=> 12, 'orderby' => 'meta_value_num', 'meta_key' => '_price', ...
1
vote
0answers
26 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
votes
1answer
37 views

Standard Loop - wp_query

I was readind this article (https://codex.wordpress.org/Class_Reference/WP_Query) and try run the Standard Loop, but I can't receive the any result. My code is this: <?php get_header(); /* ...
-1
votes
2answers
37 views

Tag custom loop show posts

i have a posts tag with 'php'.....i am using this code to show all posts tag with 'php' but it not work <?php query_posts('tag=$tag'); if ( have_posts() ) : while ( have_posts() ) : the_post(); ...
1
vote
1answer
24 views

Sort by meta key on archive page

I am trying to sort an archive page using a meta key value (which happens to be a Unix timestamp). Currently I have the posts listed on the page by their WordPress creation date. I want to use the ...
1
vote
2answers
37 views

Override global query results without hooks

I have a custom php page and i need to override the global posts variables, but i cant get it to work. When going through the main loop im able to override the global posts, but i cant override ...
1
vote
0answers
24 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
1answer
39 views

How to display all posts from standard posts to custom post types in a loop with pagination?

I have several standard posts and posts from a custom posts type. Now I want to display all of them on my home page using a loop. My problem is that it displays the posts including the posts from the ...
1
vote
0answers
13 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
1answer
20 views

Displaying recent post excerpts on static front page

I'm trying to display a static front page with recent posts at the bottom. Specifically, I want to display just an excerpt from the recent posts, as would be returned by the_content() if I had a ...
1
vote
2answers
24 views

where is the 4th taxonomy terms? taxonomy terms is disaapearing in the loop

I am listing custom taxonomy names. The list is displaying and the table structure is: <table> <tr> <td>Name 1</td> <td>Name 2</td> ...
1
vote
0answers
20 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' => ...
2
votes
0answers
102 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 ...
1
vote
0answers
24 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 ...
-2
votes
1answer
24 views

How to add a continuous number to HTML tag attribute value inside The Loop [closed]

I am looking to get a result like this in my list of posts: <div data-panel="panel-1"> <!-- content --> </div> <div data-panel="panel-2"> <!-- content --> ...
0
votes
0answers
6 views

How to add a new property to an existing object dynamically in php? [migrated]

I am new to php, T am trying to add a new property onhold to my object. $designation is object array coming from data base. foreach ($designation as $key => &$value) { $result = ...
1
vote
0answers
21 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
1answer
25 views

Multiple Loops Inside a Function

What I understand from the CODEX, (https://codex.wordpress.org/Class_Reference/WP_Query#Multiple_Loops). then I'm trying to do a list of posts like this: <nav id="cbp-hrmenu" class="cbp-hrmenu ...
1
vote
1answer
24 views

Get a post from other loop each n-posts in the main loop

Here's the layout, I'd like to achieve. 1st row: three posts in three columns from category A 2nd row: one fullwidth post from category B 3rd row: the next three posts from category A 4th row: ...
1
vote
2answers
53 views

How to limit WP_Query to one result on the loop?

I am trying to get only one post and this needs to be the latest one so here is what I am doing: $basic_args = $wp_query->query_vars; $basic_args['tax_query'] = $wp_query->tax_query; ...
0
votes
0answers
14 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
2answers
27 views

Get post/page data outside the loop

I'm trying to make a mu-plugin dedicated to make OpenGraph tags for my website, since the current plugin in WP directory arent updated for ages. But i ran with several headaches trying to get post or ...
1
vote
1answer
26 views

Checking array against author id in loop

So I have a function in Wordpress with a plugin that returns a list of friends as an array. The function code is here: function friends_get_list($tmp_uid, $friend_status=1) { global $wpdb; ...
1
vote
1answer
43 views

WP_Query loop within WP_Query loop

I'm trying to use a custom WP_Query loop within another one to display data from the inner loop independently from the main loop. I found this solution but don't really understand how to use it. Here ...
0
votes
1answer
18 views

Why loop renders only last metabox from array? [closed]

The auestion is, why my foreach loop renders metabox only with information from last array? The code of class: class CusomMetaBox { /** * Hook into the appropriate actions when the class is ...
1
vote
1answer
22 views

Posts per row on archive page (custom post type)

I have problem with showing posts in more than one row, if I have more than 3 posts. How can I set more rows if I have more posts? For example, if I have 7 posts, I should have 3 rows. Can I do that? ...
1
vote
1answer
25 views

Complex query and posts pagination

I have this complex posts query, but I cant get the page navigation to work, been trying for hours with no luck, what am i missing? $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ...
2
votes
1answer
35 views

get_field not displaying my custom field value

I'm asking regarding the ACF plugin (Advanced Custom Fields) I'm working on creating a category group that will add custom fields to the category pages. These are the fields: They seem to work in ...
1
vote
0answers
37 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 ...