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

Category page shows only 1 post when that post has more than 1 category?

The error I'm seeing is that the way I currently have my category page set up, if a post on that page has more than 1 category, the loop won't load the posts that follow the one with multiple ...
0
votes
1answer
36 views

Why the first <li> with flexslider appears as blank <li> on my code?

I have a question about flexslider, I'm working with it on Wordpress theme, but I've a problem, why te first slide appears as blank slide , I hope anyone can help me with this, the PHP code works fine ...
0
votes
0answers
11 views

Post formats in 2 columns display

I'm having a hard time trying to figure out what's wrong in my loop. Here is my loop for a 2 columns post display : <?php $i = 0; ?> <?php if (have_posts()) : while (have_posts()) : ...
0
votes
1answer
24 views

Rendering pages

I'm making a custom wordpress theme for the first time and I am having an issue. I have a static index.php file and I created page.php file which looks like this: <?php if ( have_posts() ) : ...
0
votes
1answer
32 views

Loop doesn't work

I'm making a box in my sidebar that shows with a loop a list of articles of a single category: <?php // The Query query_posts('cat=31&posts_per_page=5'); // The Loop while ( have_posts() ) : ...
0
votes
2answers
246 views

Get post id within comments loop

I have a custom comments loop on my author.php page. I am trying to get the post id so that I can echo the permalink for the post that the comment belongs to. Also so I can echo some post meta custom ...
0
votes
1answer
79 views

Problems with WP_Query, Loop, a condition and Posts per Page

I am creating a website and I have Custom Types (Plugin: Types). These Custom Types are called 'Veranstaltungen' --> they are Events. All of these Events have a starting date ( start-datum ) and an ...
0
votes
0answers
32 views

get_template_part for each level of taxonomy term w\control if empty term

before we start, thank's for your time. Structure: cpt = corsi tax = argomenti tax_term = parent tax_term_child = child tax_term_child_granchild = grandchild Current code (on ...
-1
votes
1answer
198 views

How to use add_action(“wpcf7_before_send_mail” outside wp loop?

I am trying to trigger an add_action hook (add_action("wpcf7_before_send_mail", "add_data_to_custom_table");) from outside the wordpress loop. The add_action hook is defined in theme's ...
0
votes
1answer
116 views

get_template_part for each level of taxonomy term

before we start, thank's for your time. Structure: cpt = corsi tax = argomenti tax_term = parent tax_term_child = child tax_term_child_granchild = grandchild Current code (on ...
0
votes
0answers
21 views

How to remove the most recent post from $the_query

Apologies for a very basic question: I've been searching for hours and can't find a solution. I have a Wordpress page that displays all posts of a particular custom type by using WP_Query to return ...
0
votes
1answer
113 views

get_terms() parent, child and grandchild

parent1 - child1 - grandchild1 I need to show child terms of any current term (only direct child) for each term I visit. Works only for the parent (show child1) but not for the child (doesn't show ...
0
votes
1answer
60 views

Filter existing hook using parameter and foreach loop

I am trying to create a filter to add a custom column to the edit page of any custom category that might exist in Wordpress. I am aware that the filter hook must be in the form, ...
0
votes
1answer
119 views

Alternate row and columns every X posts

Does somebody know ho to accomplish the following structure with a Wordpress loop, and repeat it for all my posts? Would be really helpful. I tried to modify the code Joshua provided here: ...
0
votes
1answer
17 views

Querying multiple categories in the WP loop if one of the category IDs is dynamically obtained

I don't know exactly where this is going wrong, but what I figure is happening is that the category I am dynamically obtaining based not the BuddyPress Group slug (post categories have matching names) ...
0
votes
0answers
16 views

multiple_loop of filterable taxonomy_portfolio for CPT

first sorry for my "school-level" english and for possible mistakes (it's the first time on this forum) I have a CPT "corso", I have more taxonomy for this CPT (argomento1, argomento2, ...) and I've ...
0
votes
1answer
39 views

Index.php is ordering posts strangely

Index.php has the loop and I'm adding HTML at intervals, but when I preview the post list page, the order is incorrect. I've tried a different loop, and I've also tried query_posts & without, but ...
0
votes
1answer
12 views

Cant pull in featured Image

I have 6 posts with a featured image set for each. I have created a template file called portfolio-template.php. I have set the portfolio page to use that template file. Inside portfolio-template.php ...
0
votes
1answer
33 views

How to execute custom loop before loop content?

How to execute custom loop before loop content? <?php remove_action( 'genesis_entry_header', 'genesis_do_post_title' ); remove_action( 'genesis_entry_footer', ...
0
votes
0answers
24 views

Displaying no post message in rather complex query that shows only future events

I'm trying to do something rather simple, which is display a message if there are currently no posts available. However, the environment I want to do it in is rather complex, as I'm using the Types ...
0
votes
1answer
72 views

Run “the loop” in a random order

I'm using a transient to store a query that gets 60 posts and makes a mosaic of background images, because it improves performance greatly. The query has 'orderby' =>'rand' set, but obviously when ...
0
votes
0answers
34 views

Query and compare multiple meta values

The problem: I have a custom post type of 'events' which has two metaboxes: cf_eventdate and cf_eventend. The first contains the event date, in the format: 2015-11-05. The second contains the end ...
0
votes
0answers
27 views

Loop returns more items than exist?

Using the answer here: http://wordpress.stackexchange.com/a/207601/45709 exact works as it is intended. It returns 3 slides because only three slides exist. I had to slightly modify the code because ...
1
vote
1answer
59 views

How to loop over custom fields in a page template?

I was originally using a single field and things worked perfectly with the following code. Now I need to alter it to loop of several fields that are similar. To start: I've created several custom ...
0
votes
0answers
59 views

Loop through posts by category in descending date order

I am using standard posts to display news. I have three categories to assign news posts to, and a post is only ever assigned to one of these. Let's say I have post data like this: 01-Jan-2015 - ...
0
votes
1answer
79 views

How To Loop Through <li> list with Custom Post Types

Please excuse me for being ignorant. I am currently trying to learn more about PHP and WordPress. This is my first time to post a question on StackExchange. I found a jQuery plugin for a simple ...
0
votes
1answer
48 views

Get audio metadata on file upload

I am trying to fetch all audio metadata when I upload a file. This all happens in a plugin, and I currently use the add_attachment action to trigger my custom function : // link add_action( ...
0
votes
1answer
23 views

Category ID returns as '0'?

I'm trying to populate the category id from the category name within the loop. <?php $cat_name = get_theme_mod( 'cat_1' ); ?> <?php $category_id = get_cat_ID($cat_name); ?> ...
0
votes
0answers
127 views

Isotope Grid - Parent Category Filters and Subcategory Items - How?

I'm trying to develop an Isotope-based grid, with a custom post type subcategories being filtered by their parents. So the grid has filters, which are the parent categories, upon choosing a filter, ...
0
votes
0answers
21 views

Custom query . How to restore parent in custom template

I have a custom query which looks if a page has subpages and if any exists loops over childs the codes <?php // get sub pages $subPages = get_pages( array( ...
1
vote
1answer
80 views

CPT + CMB2: data not displaying for only first post in loop

I've a CPT incorporating CMB2. I loop through every category and show each post within that category. My issue is that the first post in each category doesn't display certain info from two metaboxes: ...
0
votes
1answer
55 views

WP_Query | 'post_type' doesn't work

I'm new to WP theme development and I've an issue. I've created a custom post type 'portfolio' via CPT UI plug-in. Now I want to create a custom query to show all the posts with the post_type = ...
0
votes
0answers
29 views

How to : pagination in 3 different custom loops on the same page

I have this content in my index.php. 3 areas with 3 distinct custop wp_query loops to get different categories of articles in each one. I have set wordpress to show 12 articles by page, so it displays ...
0
votes
2answers
26 views

Post are not showing up

The site I am working on is skinnnybantonmusic.com The Lastest News page is suppost to show the blog posts but for some reason none are showing up. (http://www.skinnybantonmusic.com/latest-news/) ...
0
votes
2answers
20 views

Page gets displayed in post field

I'm making my first WordPress theme from scratch, and I currently have two pages: index, and events. The index is static and the events.php is dynamic (loaded with latest events displayed by the title ...
0
votes
0answers
74 views

How to put php code inside a tag loop?

I have something like this. The loop is from the woocommerce plugin in the cart.php. I want to put the php code inside the a tag <?php echo wp_kses_post( wpautop( $data['display'] ) ); ?> ...
0
votes
0answers
20 views

Trying to show some custom post types

I'm using WordPress 4.3.1, and using some custom post types for information (events, publication,...). Events should appear only at sidebar (eventON plugin) and post, and publication. I'd like to show ...
0
votes
2answers
32 views

Repeat code, change variable?

Is this possible in WordPress? Like if I use a piece of code to display Post1 image+title and some more code to display six more posts in that category... But then to do the next category I have to ...
0
votes
1answer
49 views

List active taxonomy terms

I'm working on tweaking a template which has a filterable masonry layout. I made a taxonomy-categories.php and for the filtering I need the terms of the active taxonomy. The template which I'm using ...
0
votes
2answers
143 views

ACF - Get lowest & highest value from field

I am using Advanced Custom Fields to get a list of properties as follows:- <?php $args = array( 'posts_per_page'=> -1, 'post_type' => ...
0
votes
1answer
92 views

Three Most Recent Posts, One Per Term

I'm trying to figure out how to write a custom query for a Custom Post Type, and Taxonomy where I would retrieve the most recent posts, but with a twist: only one post per unique term. So if I ...
0
votes
1answer
99 views

Redirect category to url with /category

I'm want to redirect every category page to to URL prepended by /category. For example; I want /blog redirecting to /category/blog Why? For some reason /blog gives to same result as /category/blog, ...
0
votes
3answers
61 views

How to get all post except one post from a custom post type?

I had created a custom post type named rooms, I would like to get all other post except the one with post id 164 as the output of the below code. Please help. <div class="room-container ...
0
votes
0answers
125 views

Wordpress loop with nested bootstrap tabs

I have been trying to get this to work for a couple of days, but I am stuck. I am generating the initial tabs using a wordpress loop. Each tab is a post. I have information within each post that I ...
0
votes
1answer
107 views

Custom post type with custom taxonomy permalinks

I've looked around but can't find a decent solution. I have a custom post type that adds businesses. In the loop it will list all by default but I want to be able to attach an event category to ...
0
votes
2answers
30 views

How does the loop know which post to view?

I think I have understood most of how to create my own themes but this one thing: How can a loop in say page.php know which page to view when it loops through all the pages on my site? If I load one ...
0
votes
1answer
32 views

WP Loop. If featured image is a panorama (3:1 ratio) execute some code

I'm wondering if there is a way to write a condition (if/else) for a featured image. If user submits a featured image in 3:1 ratio (panorama, one edge is 3 times longer than the other edge) - execute ...
0
votes
1answer
74 views

custom post type loop

If i have something like this, how should i write the loop? The first section - "img tag" first and then "div .poster-content" The second section - "div .poster-content" first and then "img tag" ...
0
votes
1answer
50 views

Add “showing posts x to x of y” in custom post type paginated loop

Is there a way that I can add "Showing posts x to x of y" into a paginated custom post type loop? So for example if I have 100 posts I'm showing 10 posts per page, on /page/3 it would show "Showing ...
0
votes
0answers
45 views

Ordering Posts by parent category, name ascending

I am currently creating a theme, and I have 2 parent categories: Budget and Brand. On home.php, I want to order all the posts ascending by their sub category name without showing the category title. ...