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

How to order by multiple fields using standard query_posts?

In our archive.php we show all the items which match our selected category. This works absolutely fine. Then we improved it by adding (just before the loop) a sort and upping the posts per page from ...
0
votes
1answer
13 views

Filtering by multiple conditions in the loop

I'm trying to filter the posts in my index by multiple conditions. So far I've tried with this: <?php $query = new WP_Query( array( "post__not_in" =>get_option("sticky_posts"), ...
0
votes
1answer
19 views

show latest authors blog post

how do you display the latest authors blog post? I have the below code: <?php $author = get_the_author(); $args = array( 'numberposts' => '1', 'author'=>$author ); $recent_posts = ...
0
votes
0answers
21 views

change the number of posts on the frontpage depending on screen width

My frontpage currently runs a secondary loop at the bottom of the page that shows 4 posts of a certain category. But I would like to reduce these posts to 3 when the screen width goes below 1024px. ...
0
votes
0answers
6 views

Change get_posts to loop.php suitable version

I did't know that get_posts don't work with loop.php. I already have this great loop.php file and I want to use it. I created this code: $pageposts = get_posts( array( 'relation' => ...
0
votes
0answers
6 views

Ordering in custom wordpress query

I have a custom wp query <?php $aId = get_the_ID(); $aList = new WP_Query(array( 'post_type' => 'porti', 'posts_per_page' => -1, 'meta_key' => 'aName', 'meta_value' => $aId, ...
0
votes
1answer
25 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
votes
0answers
18 views

Query show/hide current post in archive page

I'm having lot of headache with that since a couple fo days . . . I explain my situation: I'd like to show/hide the_content on click of the_title of a post in my archive page. Righ now, it display . ...
0
votes
1answer
15 views

Cannot reset a loop in a plugin template

I am trying to override a query in a loop which exists in other plugin. I created an extension to override that loop using a hook that exists in the plugin. The plugin query: query_posts ($args); /* ...
0
votes
2answers
22 views

WP_Query loop else statement not executing

I have two WP_query loops in my frontpage.php file: <div id="aanbod"> <div class="container-fluid section-name-cont"> <div class="container"> <div class="row"> ...
0
votes
0answers
17 views

Custom search engine optimization [on hold]

I am creating a search engine that receives, via POST, the information on a form containing several checkbox. See below that there are several sequences of results and is marked in orange one as an ...
0
votes
0answers
18 views

Sorting posts to make those with post thumbnail show up first

I am trying to sort post with If have post thumbnail list posts show first(i need the posts without thumbnail to show after it) by title. $args = array( 'post_type' => 'post', 'meta_key' ...
-1
votes
0answers
36 views

AJAX POST 500 INTERNAL SERVER ERROR

I am new in WordPress coding and I make one infinity loop for my WordPress blog. Its working great on Local machine (WAMP) but after putting it online at nginx server its showing POST mysiteurl ...
0
votes
0answers
14 views

Order by custom field returns nothing [closed]

im trying sort post by a custom field but i have no sucess: echo vp_metabox('meta_eventos.evento_data_start') Show one date, example: 16-03-2015 I need to sort posts by this date, im trying use: ...
-2
votes
0answers
18 views

how do I display individual posts in the featured area

Hi I am new to theme development and am building a wordpress featured area that looks kinda like the verge/ polygon etc... The problem is that individual posts have different colour blocks and their ...
0
votes
2answers
39 views

Hiding carousel indicators if there's only one post

I am working on a custom carousel (Wordpress + Bootstrap). The carousel is working without problems. However, I would like to hide Bootstrap carousel indicators and arrows if there is only one post. ...
0
votes
1answer
18 views

Query Taxonomy By Page Title

What I want to do is display posts that share a taxonomy on a page with that taxonomies name. For example, a page named "PHP" would display all the of posts with the custom taxonomy "language" set to ...
0
votes
0answers
14 views

Does not show thumbnail in a given category

I am creating a loop with two formats for posting , one is the default post and the other is a video post using the post-format (video) . I found right here a function to capture and save thumbnail ...
0
votes
0answers
18 views

Show posts in category

I have a problem in the loop by the time I make a wp_query . What I'm trying to do : Bring only 4 random posts of the Videos category. Videos This category is the Post -Format Video type (I believe ...
-2
votes
1answer
37 views

Help with if/else loop [closed]

can you help me to add an else statement to this loop? <?php $post_type = 'post'; // <-- Post Type $tax = 'temporada'; // <-- Taxonomía $termino = get_terms($tax); $category = ...
2
votes
2answers
106 views

get_the_foo() in the loop - does it perform another query?

I'm unclear on the get_the_foo() style of functions, for example get_the_permalink(). My main question is: when this is performed in The Loop, is another SQL query executed (besides the original ...
0
votes
1answer
60 views

loop mix my child-category and parent-category

i explain the situatio I'm having: I have a blog, which on the homepage, have display the most recent post. For each post category, I have set up one specific color and icon by css. ex: for ...
0
votes
1answer
20 views

Best way to check if a post with specific meta exists

I am building a function in wordpress that reads an XML file and imports 100-500 events as a post type to wordpress. The events have a lot of meta data that is saved as post meta. One of the meta data ...
1
vote
2answers
20 views

Query posts if meta key starts with

I need to find posts with a meta key that starts with the current year + the current month (i.e. 201502), but the actual value could also contain any day within that month (i.e. 20150214). The ...
0
votes
2answers
76 views

Filter by custom taxonomy slug on a custom post type

I am displaying results from a custom post type ("works") and want to optionally filter by a custom taxonomy ("genre") if that is set (i.e. if the loop is on the custom taxonomy archive template). I ...
0
votes
1answer
47 views

3 Posts in Loop, Show Stickies First

Okay I am starting to wonder if it is even possible to do this! As I've found very little info on the matter online. This is a fresh WP install that I've been experimenting on so that I can work in a ...
1
vote
1answer
60 views

How to prevent writing duplicate loops?

So i have some pages where i want to show my custom post type 'events' only by the last 5 posts (secondary query: WP_Query object) and some pages where i want to show all posts (for instance archive ...
0
votes
0answers
43 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 ...
0
votes
0answers
30 views

get_post_meta doesn't work with variable

The $event_count variable doesn't prints anything, what am i doing wrong? global $post; $event_count = get_post_meta($post->ID, 'eab_event-bp-group_event', true); $args = array( 'post_type' ...
0
votes
1answer
26 views

How to Display a Single Post Excerpt

Is it possible to show the excerpt for a known and single post (on the Home Page) while in the loop? I tried each of these and none of them work: <?php echo the_excerpt('10'); ?> <?php echo ...
0
votes
1answer
45 views

Display category title and three latest post inside the category

I am looking for something very similar to this question. However, the answer provided there seems strange to me. I don't know what the arguments posts_per_page=-1 and it seems more like a hack to me ...
0
votes
2answers
18 views

Best way to allow for extended use of Wordpress functions inside single.php

I am building a more-or-less distinguishing layout which forces me have a header far above the content in the DOM. A structure as follows: <?php get_header(); ?> <div id="wrapper"> ...
0
votes
1answer
19 views

Style first 3 posts differently with a container, then the rest of the posts [closed]

I can style the first three posts differently with no problem. What I can't figure out, is how to do it and include the first three posts in a single container div (e.g. not a new div for each ...
1
vote
2answers
46 views

Loop within a loop (Again) for template

I know that the question was already asked but all the answer i found doesnt help me.. I made an HTML page that I would like to integrate in Wordpress. The integration of the theme was done properly ...
0
votes
1answer
36 views

Adding unique marketing messages between certain products whilst using isotope/Infinite Scroll

I am currently using WooCommerce to display a list of products using the following loop to enable the post-type "product" be displayed and allow for pagination so I can use Infinite Scroll to smoothly ...
0
votes
1answer
37 views

add_action in the loop hooks

I have the following structure: add_action('my_content', 'standard_loop'); function standard_loop() { if (have_posts()) : while (have_posts()) : the_post(); ...
0
votes
0answers
34 views

Both WP_Query and get_posts returning 1 post

I am having a weird issue. Both WP_Query and get_posts returning only one result, i.e only the latest post. Never faced this before.. The WP_Query: function custom_tsr_query() { $the_query = ...
0
votes
1answer
74 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
1answer
32 views

Multiple get_posts() queries on one page

I'm building custom page template, which has some content editable through proper articles/posts. Below are those code blocks: <?php $contact = new WP_Query(); $contact = get_posts( array( 'slug' ...
0
votes
1answer
35 views

Loop with Custom Post Type and Taxonomies

Regards, i've a problem. What i want: Show a toggle with loop from Custom Post Type I create post type: Episodio And a Taxonomy: Temporada I create this loop: <?php $post_type = ...
0
votes
0answers
18 views

How to get past and upcoming post by defining date in custom field?

I have create a custom post type "event" and created some posts in it. I have also created a custom field "EventDate" and giving value like "April 08, 2011", "February 08, 2016" etc for each event ...
0
votes
0answers
35 views

2 loops with pagination on a single loop

On a page I want to always show the most recent post on top with a different layout, and have the rest of the posts listed below. So I created a template page with these 2 loops. But I cannot figure ...
0
votes
0answers
22 views

How to get Multiple Post Thumbnail in index page

I'm using this MultiplePostThumbnail plugin in my theme https://wordpress.org/plugins/multiple-post-thumbnails/screenshots/ It's working fine in all pages and in posts, problem i'm facing only on the ...
0
votes
1answer
28 views

toggle Multiple Loop with tittle

I need some help I want to list all post from a meta_key, order by meta_value in ASC order All this in 1 toogle jquery. I've this: <div id="box-temp" class="gray-shadow"> <!-- First Loop ...
1
vote
1answer
53 views

Any number in meta key (wp query)

I have such a query. The field modules_%_text is advanced custom fields flexible field where % should stand for ANY ROW number, it seams that it should work like that, however it's not. What i'm doing ...
0
votes
0answers
17 views

Posts are not showing on front page after import

I've recently importet Wordpress content from an old site to a new one, which worked fine. The problem is that those importet posts aren't showing up. I fiddled around and notices, that I need to go ...
0
votes
1answer
17 views

Custom search (wp query by custom fields)

I'm building custom search. Actually it's just need to check custom field value. The custom field is called 'summary'. However i'm not sure what i'm doing wrong as it is not working. Maybe someone ...
0
votes
0answers
21 views

Advanced Field Repeater Pagination with Custom Post

I am using a custom post type as well as advanced custom fields with a repeater. I need to somehow loop through all the repeater subfields and paginate them to 6 items per page. I have tried a few ...
0
votes
1answer
30 views

ACF field not appearing correctly in loop

There is a loop in my theme that displays posts with the following information: a title, some text, and a price. I have added a custom field to this post type using ACF. The field ID is tour_length. I ...
0
votes
1answer
25 views

Get Image tag from content of post

I have create a custom sidebar, and want to show only posts images in that sidebar. I have add a post with some text and choose image from gallery in the content of that post. Now i want to get only ...