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
2answers
33 views

spliting posts into two columns

This is a continuing question from Merging a complex query with post_rewind and splitting posts into two columns Hi, I need help with my loop. What is does is split posts into two columns. <?php ...
0
votes
0answers
23 views

remove post that has no content

Code below display posts now I only want to display the items if it has a <?php echo c2c_get_custom('Gallery'); ?> on it. <ul id="gallery-container"> <?php ...
1
vote
2answers
22 views

Does get_template_part pull data once in a loop?

When i use the "get_template_part();" inside a loop, does it search for that template file every cycle of the loop (each post) or does it search for the file once and then reuse it every cycle of the ...
0
votes
2answers
110 views

Merging a complex query with post_rewind and splitting posts into two columns

I need help with my query that uses rewind_posts so that if a post is in a particular category, it moves to the top. What I would like to do is have a query that splits posts into a two-column page (...
0
votes
1answer
35 views

Two custom loops, pagination is MESSED UP!

here's my problem: I'm on single.php and am trying to display at the bottom of the post a group of four related posts first, and then a list of all posts using infinite loading. So I created two ...
0
votes
1answer
27 views

Submit button inside foreach loop updates all table rows instead of one row [on hold]

I created this simple function to update a row inside a table called wp_todos function update_completed_todos($id,$complete) { global $wpdb; $table_name = $wpdb->prefix . 'todos'; $...
0
votes
3answers
177 views

separate the post of a category by subcategory

I'm dynamically generating my category post by getting the Page title and match it with the category name. The category I'm posting sometimes has a subcategory now I need to separate this subcategory ...
1
vote
0answers
16 views

Get posts sharing taxonomy term with current post's

I have a post and I want to get a loop with a list of all other pages, which are in the same taxonomy/taxonomy-categorie. Right now, I'm only able to insert the taxonomy name by myself. I think it ...
0
votes
0answers
19 views

wordpress wrap every 3 posts in a div after the very first post in a loop so that the fist loop is a featured post [duplicate]

I want to add every 3 posts in my index.php file in a row div but I would like to exclude the first post so that I can style the first post differently. I currently have the loop working for every 3 ...
2
votes
2answers
35 views

post expire after x days

I want to create a code snippet for expiration of post after x days from the post published date, I tried with this code but I always displays the true condition, what am I doing wrong? $pfx_date ...
0
votes
1answer
11 views

QueryObject un-orders post

Hi I'm using this code below to display post from a specific category and also to style the first post different from the next 5 post. <?php $queryObject = new Wp_Query( array( 'showposts' => ...
1
vote
3answers
69 views

Check if loop has any categories?

In my loop, I have ten posts with the following categories (slug): group-a, group-a-first and group-b. The loop/query looks like this: Post (group-a) Post (group-b) Post (group-a-first) What's the ...
0
votes
1answer
18 views

Is wp_reset_postdata() redundant after the main loop?

I'm confused about an example from the docs: <?php // The main query. if ( have_posts() ) : while ( have_posts() ) : the_post(); the_title(); ...
0
votes
0answers
20 views

ACF for loop only iterating once [on hold]

Hi there I am attempting to output stuff based on an ACF drop down selection. I am using a for loop to output but it only iterates once and outputs the "1_col" part. Also the "component_button" part ...
0
votes
0answers
18 views

Adding a term to a listing inside of shortcode that otherwise contains permalinks to custom post items with custom field values

I have this shortcode to output all items of custom post type "song", on a page listing all the songs a musician released throughout his career. // Custom shortcode, to query tracklistings on the ...
1
vote
2answers
31 views

Loop and Page template : my WP_query don't take args

I have a problem with a loop that I try to put into a custom Page template. I would like to display posts with conditions, but whatever I put in my WP_query parameters, it is not taking in ...
-1
votes
0answers
32 views

Where to place script in while loop

I'm currently working on a grid template for a WordPress Custom Post Type loop. Basically I'm showing a video cover and when the user is clicking the cover a Modal opens with video and more opens. ...
0
votes
1answer
27 views

query_posts() doesn't seem to be called in my page

I've a problem with my query_posts() call. Here is my code: $results = $wpdb->get_results("SELECT post_id FROM " . $wpdb->postmeta . " WHERE meta_key = 'mashsb_shares' ORDER BY CAST(meta_value ...
0
votes
1answer
20 views

Div Missing In Custom Loop Query

I'm using a customized php code for my wordpress loop. The code is designed the break the post up to be styled differently via html & css. The code is also designed so that I can add div blocks in ...
0
votes
2answers
41 views

Assign custom parameter to each post in query

I'm trying to add an incremental variable to each post that comes up in a series of queries. The purpose is to calculate a weight for each result in order to be able to order everything later. This ...
0
votes
1answer
416 views

add bootstrap post slider with tabs

I'm trying to add a carousel with my post. UNder the carousel, some tabs with the post title. On click of the post title, it should change it the slide to display the related post. In " Static" in ...
1
vote
2answers
325 views

Display custom post on home page based on a metabox selection

I am trying to display an post to my home page based on a selection. What I mean is in the backend I have a custom post that has a metabox labeled Assign to Home with a drop down that has a selection ...
1
vote
3answers
573 views

Custom taxonomy template loop

I know that this question is asked numerous but i din't find an answer that suits to me. Well i'm made some custom post types and some custom taxonomies. I have the custom post type Products and ...
0
votes
1answer
15 views

Popular posts with Varnish ESI

I am trying to get Varnish ESI to work with displaying the most viewed posts on a new blog I am working on. Here is my current script; In theme file: <esi:remove> <?php get_template_part( '...
0
votes
0answers
28 views

Own class in while post loop

I've created my own class which I load trough my functions.php For my custom post type, I've created an own archive-{posttype}.php. In my while loop I'm trying to access $obj->functionName(), but ...
1
vote
2answers
62 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
19 views

Converting fake php page loop to wordpress loop?

I was handed off a project that was created using backbone.js to be "WordPressified" and I'm having trouble converting the fake page loop in to a standard WP loop. When I first took this project on, ...
0
votes
1answer
555 views

the_content() “crashes” for single pages

I have big trouble with the_content() for single.php. Whats my problem? the_content() doesn't give any output on single pages furthermore it crashes (no other PHP code below the function call is ...
0
votes
1answer
15 views

Wordpress query posts by custom post type not workng

I'm trying to display the featured images of my custom post type of 'instrument' I created the custom post type using the plugin 'Custom Post Type UI' The query seems to work, but the problem is ...
0
votes
1answer
424 views

Loop and add Specific Categories and Products Images

Thanks to Rafael Marques, I have a list of Products and Categories organized based on different created categories. I also have 5 different Custom Page Templates. Now I would like to display the ...
-1
votes
3answers
649 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(), ...
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 ...
-1
votes
1answer
36 views

How do grab the main loop, with conditions, and output via shortcodes

I don't have any code for this because I'm not sure how to begin. I created a category called "News". On my homepage I want to show the 3 most recent articles, but I need to output them using a ...
0
votes
0answers
16 views

can I separate two taxonomy (category) loops on one page

I have created a staff and teachers page with custom posts and categories. I currently have them display in an archive-teachers-and-staff.php template with no filter. I am using the date to get the ...
-1
votes
0answers
30 views

Shuffling Posts On First Load?

I have a category with 20 posts and I would like to shuffle the posts on the page for each individual user that visits the blog. I don't want the posts to constantly change order on reload, so what ...
0
votes
2answers
41 views

Conditional in foreach loop is outputting content twice

I have a website that displays a slideshow using custom fields and the Slick carousel, using the code below. <?php $entries = get_post_meta( get_the_ID(), '_mysite_homepage_slider_group', ...
1
vote
2answers
8k views

Display featured products through custom loop in woocommerce on template page

I was wondering if someone could help me out. I would like to display 6 featured products from my woocommerce store on my home-page.php template. After some researched I found that the right way to do ...
0
votes
1answer
39 views

Add post class in custom loop (WP_QUERY)

Normally if I wanted to add a custom post class I would use the post_class filter. However, when using a custom loop the post_class filter is not accessible. I am trying to apply classes that will ...
-3
votes
1answer
45 views

Group posts by year in loop

How can I separate posts by year in archive page for Custom Post Type? while ( have_posts() ) : the_post(); the_title(); the_post_thumbnail('thumb'); endwhile; The end result would look ...
0
votes
0answers
24 views

Creating a wordpress loop with featured images in different divs

I'd like to create a wordpress loop that allows me to style each featured images in separate divs. I've done a fair bit of research but can't seem to find anything that helps. Can anyone point me in ...
0
votes
1answer
15 views

Display Authors in a grid loop

I currently have the following php code which gives me a list of all the current WordPress authors, including their name and avatar. <?php printf('<h1>%s</h1>', the_title()); ...
0
votes
1answer
12 views

Wordpress query with items from more than one selfdefined taxonomy as `term` argument

So I'm working with a bought version of a plugin (WP Catalogue, sorry I can't post more links than 2) as basis for my code for a website i'm working on and i'm adjusting it so that it can be used for ...
0
votes
1answer
536 views

Admin login not working, because: wp-admin%2F&reauth=1 redirect

I want to login my WordPress site, but i can' because the login always redirect to this: http://testsite.com/wp-login.php?redirect_to=http%3A%2F%2Ftestsite.com%2Fwp-admin%2F&reauth=1 1, I add ...
0
votes
2answers
959 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. ...
3
votes
1answer
85 views

Exclude filter on front page

I am using this code in functions.php to append a button for link to a post. function new_excerpt_more($more) { global $post; return '<a class="excerpt-readmore" href="'. get_permalink($post-&...
0
votes
1answer
442 views

Second level subcategory

I'm trying to get anoter level subcategory to show in my select option. I've managed to get one... how can i get the other? <?php $taxonomies = array(CUSTOM_CAT_TYPE); $args = array('...
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
515 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 . . ...
2
votes
2answers
857 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 ...
6
votes
2answers
23k views

How to get posts published between a date and today?

Is it a way to get posts published between a date and today with query_posts() ? Example : All posts published since 2012-04-01 Thanks EDIT : How to add the filter date on this Query Posts ? ...