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
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
91 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
3answers
46 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 ...
2
votes
4answers
1k views

Using the loop inside admin

I have the following issue: I am creating a custom-meta-box for the user to add custom fields in a friendly way. I want to generate a drop-down box with all posts that fall under category 10. I have ...
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
2answers
897 views

wp_insert_posts Fatal error: Maximum function nesting level of '100' reached, aborting!

I'm having a weird problem I have written the code as below: add_action('save_post', 'save_post_func'); function save_post_func(){ include_once(ABSPATH . WPINC . '/feed.php'); $rss = ...
-1
votes
1answer
95 views

Display custom post type posts first, then default posts

A normal author.php template has a single loop that displays a list of all the author's posts. I'd like another loop place just above this normal post loop that lists all author's (defined) CPT ...
0
votes
0answers
83 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
47 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 ...
1
vote
1answer
1k views

Filtering posts by multiple taxonomies

I have a page on which I want to display all posts of a specific custom post type, let's call it "persons". I want to allow the user to filter all persons by multiple (!) taxonomies: age, city, ...
0
votes
1answer
3k 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
392 views

Display all attached image of every post of custom post type and link to original post

I've written a loop that displays all the images that are attached to every single post of a specific post type. The post type is called "atls_events" and I'm outputting an image size called ...
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
26 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
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
40 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
64 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 ...
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 ...
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
votes
1answer
39 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
78 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
41 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
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 ...
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
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 ...
2
votes
0answers
4k views

AJAX with loop filtering categories

I've been researching on how to make my loop with AJAX. I found some codes online and modified some parts but I can't seem to get it to work. This is my code for the loop: <article id="main" ...
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 ...
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
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
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 ...
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
2answers
109 views

divide custom field values in div every two values

i have this html mark-up to sort some data <div class="row"> <div class="col-xs-2"> <img src="images/member-schools/ms1.jpg" class="img-responsive"> </div> <div ...
-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