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)

1
vote
1answer
55 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
36 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
19 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
45 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
18 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
28 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
30 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
92 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
54 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
70 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
47 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
85 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
50 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
28 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
28 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
57 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
33 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
27 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. ...
0
votes
2answers
83 views

How to Fix Custom Wordpress Loop with Pagination on Single Post View?

I have a custom post type called "Releases" set up and paginated perfectly using the following code: The Loop <?php $paged = (get_query_var('page')) ? get_query_var('page') : 1; $args ...
0
votes
1answer
41 views

the_content() keeps repeating itself

I'm new to Wordpress and am having trouble getting my loop to make the_content() not repeat itself. I've tried writing multiple loops as well to no avail. I mainly just want the_content() to iterate ...
0
votes
1answer
80 views

Query posts by specific word on title

Is it possible to query posts by a specific word on title? Example: I have 3 posts inside my blog and only two have the word car on the title. She wants a ride on my truck My car is super fast ...
0
votes
1answer
18 views

Using page template to fetch posts in page

i want to display posts in wp page. to do that this is what i did i created a template named mypage-page.php and copied code from page.php to mypage-page.php this is my mypage-page.php ...
1
vote
1answer
111 views

How to Filter Posts by Custom Fields?

I would like to learn the best way to filter custom post types by custom fields. In the example I am working on, I use custom taxonomies to organize my posts and filter them. I would like to add ...
-1
votes
1answer
40 views

Query wordpress posts on static page

I'm working with Wordpress theme where i need to show my posts in a static page.There is a only one section in site where we need to add posts frequently (services) and i need to fetch these posts on ...
0
votes
1answer
79 views

Store post content in a php variable and output them using for loop

I want to show the content of my post in a separate row one at a time whenever a tab is clicked. I already achieved this but the problem is, its showing the output for only the last tab. Other tabs ...
0
votes
1answer
25 views

Custom Looping of Wordpress Posts

I have been working on a Wordpress theme from few days. I want to achieve modern like layout in my theme's frontpage. But I am having no clue that how to achieve it. Now my wordpress theme loops ...
0
votes
1answer
42 views

Get post content from outside the loop with plugin shortcode usability

This is great for showing just the raw content... Get post content from outside the loop But i'd also like to apply shortcodes from various plugins to my content to affect the content. What would I ...
0
votes
1answer
40 views

Cannot implement byline into posts container in single.php

I tried inputting PHP byline code in page.php, single.php and page-sidebar.php inside of the loop, under the title. As I thought, the byline appears on pages but not on posts. Also, I noticed my ...
0
votes
1answer
65 views

Loop through two different sets of custom fields

I created a Custom Field ('custom_name') to allow content editors to specify a 'custom_name' (different from the title of the page) to any post created: custom_name - (Field type --> 'text') For a ...
0
votes
2answers
34 views

Not all posts showing in query

PHP: <?php $posts_query = new WP_Query('post_type="posts&posts_per_page=-1"'); if ($posts_query->have_posts()) : while ($posts_query->have_posts()) : $posts_query->the_post(); ?> ...
0
votes
1answer
58 views

Loop through incrementing custom fields

I created 4 custom fields for a specific page. Field type: Post Object (I grab thumbnails and titles from the posts) Field names: featured_content_1 featured_content_2 featured_content_3 ...
1
vote
2answers
297 views

How to load all pages into one page with their templates

I am learning how to work with Wordpress, and im trying to build my own website in it. Since my website is a onepages, i would like to be able to load all my pages ( they then count as sections ) to ...
0
votes
1answer
31 views

Configure query with multiple categories in a custom order?

I have a site with posts in 16 categories ("departments"). The home page is a grid of the current (newest) post in each category. I would like to create the HTML for displaying a department's ...
0
votes
0answers
40 views

All pages showing same posts

My blog is showing all the same posts (recent 10) on every paginated page. I'm trying to get it to display only the category "irl", which is working. but /page/2 etc. show the same posts.. my loop: ...
0
votes
1answer
59 views

Looping Through Custom Tax Terms and Displaying All Posts For Each

I'm using the following code to attempt to loop through each of the terms within my custom taxonomy category-film and then output the term name as a heading together with displaying all the custom ...
0
votes
2answers
71 views

Add row after three columns

on my newssite i have the first post in a full-width column, after that all older post are in three columns per row. But now i want that wordpress put after every three columns a and to keeps the ...
0
votes
0answers
36 views

Index.php Not Showing Custom Posts / Terms

I have my index.php page set up and is displaying my posts page as well as category archive pages without any issues. The problem however, is trying to display posts for custom taxonomy archives. The ...
0
votes
0answers
46 views

How to know if the search result is page?

I want to have other format to show search result if it is a page ..else do as usual <?php while ( have_posts() ) : the_post(); ?> <?php if('page' == $post->post_type)?> <?php ...
0
votes
4answers
137 views

ACF custom field in <head> [closed]

I've created an image field using Image URL via the ACF plugin. This field appears across my pages. This field enables admin to change the background image for a selected class. Here's the code I ...
0
votes
1answer
195 views

how to handle the loop using filling bootstrap grid structure?

i make a code that can fill bootstrap grid structure i used while and for loop in my code but the issue is for loop repeat its value in 2nd row the above picture tells you column 2 and 3 of first ...
0
votes
1answer
52 views

Check for the main query from the template

Besides the main loop in index.php, I'm calling several other custom queries across the theme, like this: $new_query = new WP_Query(array( // some args )); if ($new_query->have_posts()) : ...
1
vote
1answer
68 views

post loop causes wp_users and wp_usermeta DB queries for each users

Continuing my previous question: My post loop produces 2 queries per post: SELECT * FROM wp_users WHERE ID = '53' require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), ...
0
votes
0answers
30 views

Cannot Get Title or Thumbnail of Posts Page

I set up a page called 'News' and applied this as my posts page. I am really struggling, however, to output the title 'News' or the featured image that has been added to the page itself. Whenever I ...
0
votes
1answer
22 views

Foreach loop inside foreach loop?

I have a situation where only way seems to use loop inside a loop. Is that a good idea? Like everybody else, Im looking for the most optimized solution possible. Situation: I need to assing ...
0
votes
0answers
8 views

Custom template with paginated loop that returns the same posts on every page

I'm pretty frustrated right now. I've spent over 24 hours trying to make a custom template for my homepage with a custom loop (to return only featured images linked to their posts). The thing is that ...
0
votes
1answer
34 views

Show different Google Map markers for different post_meta values

A lot of websites use it but suprisingly nobody tell us how to do it (right way). I have few ideas but Im not sure if this was the most efficient way - Im not very good with loops (under a year of ...
0
votes
3answers
70 views

How to paginate this custom loop? [duplicate]

guys! I'm pretty sure this will be a piece of cake for y`all, but I'm trying to add pagination to my loop. I've tried some codes that were available around, and got to paginate it, but pages 2, 3, etc ...
-1
votes
1answer
29 views

Custom Post Type archive above Single Post in single.php (same author)

I don't know if this is possible but I'd like a separate cpt archive type of loop above the normal single post loop. Something like this in single.php archive-cpt (loop) single post (loop