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

Show Posts from Single Category Not Working

I have a simple loop that outputs the content of posts and then adds some navigation links at the bottom. Wordpress is set to only show 5 posts at a time. <?php while(have_posts()) : the_post(); ...
0
votes
1answer
30 views

How To Pick “full/thumbnail” Image In A WordPress Loop?

I am picking WordPress latest post through WordPress post loop for that I am using the below code but in this its picking all images at full size. <?php if ( have_posts() ) : ?> <?php while ...
1
vote
1answer
24 views

Inserting custom data to the_post() during loop

I have some posts on my WordPress site, and let's say I want to add a random number for each post with $num as key and random() as value. Then I want to access them with something like: $post->num ...
0
votes
1answer
17 views

Check if excerpt is empty at loop-portfolio

I want to check if excerpt is not empty, then echo the excerpt link, if not the echo permalink, like this: if(the_excerpt()!='') echo the_excerpt(); else echo get_permalink() but how can I check if ...
0
votes
2answers
16 views

How can I implement pagination on custom category page?

I have created a custom template page for every one of my categories. I am using a foreach loop in order to fetch the posts of this specific category in my page. if (is_page()) { ...
0
votes
0answers
27 views

Multiple Page Loops on front-page.php

Looking to build an easily editable front-page.php using multiple loops set to display pages. One way I thought about doing this was making a HOME page, then setting "About us, Services, Team" all ...
1
vote
1answer
22 views

show random image in loop if image is not set

I want to show a random image from a few options in my loop if a custom field hasn't a certain value, or it could be if it had no thumbnail. In any case, it should spit out one of the random images. ...
0
votes
1answer
34 views

Category Ajax call

I am following this post to get an ajax post filter via category to work 'Using ajax on categories and wordpress loops'. I think I have added everything in correctly as follows in my template I have: ...
0
votes
0answers
19 views

Display Meta Fields Attached to Custom Post Type [closed]

If I have several custom meta fields attached to a custom post type, how can I display them inside the template-cpt.php file's loop? Especially when the single.php file has them outside the loop? For ...
0
votes
0answers
20 views

Custom function within the loop, working only the first time [closed]

I have made a function that adds inline CSS to H2 tags. The CSS rules are loaded in the first post (Its a custom post type) but not in the posts after. The following function is in functions.php file. ...
0
votes
0answers
12 views

Possible to remove settings from wp_customize?

So, really basic setting here. function Ari_customize_register( $wp_customize ) { $wp_customize->add_setting('header_position', array()); $wp_customize->add_control('header_position', array( ...
0
votes
1answer
24 views

loop through posts and display inserted media and post title as a link

I'm fiddling around with an issue I cannot solve. Inside the loop I would like to find the URL of an inserted media file (pdf, doc etc) and display this as an anchor. Furthermore I would like to ...
0
votes
1answer
22 views

Custom Post Type not visible on category page

I would like to use the default category for my custom post type, but when I open the category page there's no posts there. The loop is very simple: <?php if ( have_posts() ) : while ( ...
0
votes
1answer
37 views

get link of inserted media file of post within loop

inside the loop I would like to retrieve the URL of an inserted media file of each post. My attempt was: <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <a href="<?php ...
0
votes
1answer
16 views

List ALL posts within last week from current category on category page

My category template shows 5 (full content) posts per page and I want to add a list of ALL the posts during the past week for that category to the top of the page as a quick overview. So the first ...
0
votes
0answers
24 views

Error Page-Template LOOP

I have this code and I want to create a page under wordpress and apply this code. I save as bcn.php file into Themes folder. I create the page and in Admin menu and apply the bcn template to the page. ...
0
votes
0answers
22 views

WP_Query Order by Specific Post ID First

I'm creating a website where I have a need to show a set of posts from a custom loop but I need to display a specific post first. This post will be dynamically specified in the URI by a $_GET ...
3
votes
3answers
120 views

Skip post in loop and mixin later

In the blog, i try to avoid to show two posts from the same category in succession. So if the latest two posts are from category 1, i want to skip the second one, take post 3 first (if it's not from ...
0
votes
0answers
11 views

Display Comments list and a Comment form in home page inside while loop

I am trying to get a list of comment and a comment form in the home page inside while loop for displaying latest post which shows one latest post. I tried with <?php $withcomments = "1"; ...
0
votes
1answer
59 views

Add Infinite Scroll to Ajax Loaded Category Query

Update: This has been resolved. See update below. Following a few different online tutorials, I've managed to create a function to modify my post display via Ajax based on a category selected from a ...
0
votes
1answer
13 views

Wordpress giving a 404 page when passing a year argument different than the current year

On this page you will see I'm listing events that fall in certain months: http://conciergemaps.ch/events/ This is on Wordpress, When you select a certain month and year it appends the URL with two ...
-1
votes
1answer
38 views

Enter a variable in the 'category_name' parameter

Is it possible to use a variable for the 'category_name' parameter? I have three pages: red, yellow, and blue. I have multiple posts that are categorized in three categories: red, yellow, and blue. ...
0
votes
1answer
19 views

Function to get the name in database table from the comma separated string

I already created admin column in WP using this code: add_filter('manage_pages_columns', 'page_custom_cols', 10); function page_custom_cols($pages_columns, $post_type) { $pages_columns['user_group'] ...
3
votes
1answer
109 views

In loop: posts have thumbnail AND other variables

I am looking to display posts that meet certain requirements. First and foremost, the idea is to show visitors the most viewed posts. I implemented that with some help. So, I got that working with the ...
0
votes
0answers
8 views

Splitting content into two columns and shortcode-slideshow above

I am working on a custom template that will allow me to display a shortcode gallery in full width, and below that, the text from the content of the post in two different columns. I have been able to ...
0
votes
2answers
47 views

Carousel Loop only duplicating

I have problem with looping and WP_Query. Any idea how i can implement the multiple carouselitems please check what html output should be in html So basically one of my goal is each div have a pages ...
0
votes
1answer
30 views

Loop doesn't display posts. It displays a link to the home page instead

I’m building a WP theme using Bootstrap. Aparently, all templates were working fine until I tried to display a list of recent post on the front page. Basically, the loop it’s not displaying posts (it ...
0
votes
1answer
96 views

Custom taxonomy archive page problem

My website is built on custom post types, that I have organized with different custom taxonomies. The menu buttons are the taxonomies archive pages (red, blue, green), so that when you click on the ...
0
votes
1answer
32 views

Wordpress loop only displays 5 articles max?

Right, I been playing around with my code for a bot now, and still can't come up with a solution to my problem. I have custom post types with custom fields and a custom taxonomy ("lieux") with ...
0
votes
1answer
21 views

How to exclude the 'featured' category from posts feed in the homepage?

I have two sections in my home page - featured and the default recent posts feed. The featured posts container displays all the posts under the category 'featured'. But it is also displayed in the ...
-2
votes
2answers
74 views

CSS code for “inserting a custom post divider” after each post

I want to add a custom post divider to separate my posts. I'm using the Enfold theme in WordPress.org. I've searched for the answer to my question but I don't understand the coding language. I ...
0
votes
0answers
26 views

How to show 4 previous posts from current article category in Wordpress?

How to show the 4 previous articles on Single Post (single.php), only from current article category? Also if no previous article found, loop from the next articles. Please no plugins... I need to ...
0
votes
1answer
38 views

Show related posts based of current ACF field name in a single page post (a loop within loop)

I have a single page where I display my current post. Within the post loop, I wanna display another loop inside that shows 3 other related posts by title that share the same text as the current post ...
0
votes
1answer
39 views

Post data in separate divs with incrementing class using WP_Query

I'm trying to achieve this result (which is the static HTML) and this is what I've gotten so far. Below is the approach I've taken: Created a CPT for 'locations' Created a custom taxonomy 'region' ...
0
votes
2answers
34 views

Getting a custom field in the middle of a loop

is there a way I can get <?php the_field("do_stuff")?> to go in the middle of a multiple loop like this: <?php query_posts('cat=4&posts_per_page=5'); ?> ...
0
votes
0answers
20 views

Show Taxonomy content

I've created a Taxonomy called Collections and also have a custom post type called products. I want to show the top 3 categories on the homepage and then when you drill down into each collection ...
0
votes
0answers
30 views

Stuck in a Redirect Loop

My Wordpress site is stuck in a redirect loop and I can't now access it. I recently purchased an SSL certificate which my site host says is installed correctly and points to the correct place. I ...
0
votes
1answer
15 views

CPT while loop not working

I am having problems getting anything out of this while loop: <ul> <?php $query_args = array( 'post_type' => 'Smart panels', 'posts_per_page' => 5, ...
2
votes
3answers
223 views

Display all posts in category, with specific tag posts at top

Rephrase question I need to order posts inside the loop for my category car. What I need, if I visit the category page of car, I need all posts tagged BMW to display first, and then the other posts ...
0
votes
0answers
16 views

Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?

I have the following problem with featured tag posts I have a page of a website in wich I want to show only the posts that have setted a specific tag (using the loop). So in this page I have put ...
0
votes
0answers
18 views

Search results problems

I'm having an hard time with the Search results page in my theme. I am using Magic Field for my creation of custom post type. All my custom post type are set to "post", but I can't get how the search ...
0
votes
1answer
42 views

Limit article to 100 characters. Can't use the_excerpt…

I've been struggling with this for a long time... I want to limit article lenght to 100 characters and after 100 char. limit, add at the end '...' linked to a single post (like wordpress's ...
1
vote
1answer
18 views

How to exclude the last post from a category(featured for example) from the main loop?

I am using 2 loops on the main page, one that shows the last post from the featured category and a general one with all the posts. The problem is that i get the last post in the featured category in ...
0
votes
1answer
110 views

Only display sticky post or latest post in custom loop

I'm new to Wordpress and PHP and I've been battling with this for a while now. What I have for the moment is 2 loops. I want to first loop to only ever show 1 post: either a sticky post, or the ...
0
votes
1answer
35 views

Move posts to top of WP_Query if in certain Taxonomy?

I'm trying to figure out the best way to promote certain (custom) posts to the top of my Wordpress loop. I can't use sticky posts because they are all in a custom post type.. I was thinking of using a ...
0
votes
0answers
46 views

Why doesn't my WordPress page show the most recent post?

I was wondering if someone could help me with the following. My news page on my WordPress website doesn't show the most recent blog post, which I want it to do. The code I have is: ...
0
votes
1answer
34 views

Next 10 posts data of currently viewing post in blog page

I am developing a theme and using WP_Query to fetch the content from the database, but now i wanted to implement a loop using a WP_query that will show me the next 10 posts with title links and ...
0
votes
1answer
23 views

Where is the WP_Query instance instantiated (when working with themes)?

This may be a very basic question, but I could not find the answer. The following documentation http://codex.wordpress.org/Class_Reference/WP_Query shows the code // The Query $the_query = new ...
0
votes
0answers
27 views

Custom post-type, multiple loops not displaying on page?

I have an issue with a loop within my page not displaying. The first loop I created (OUR SPONSORS) is displaying fine but the second (OUR PARTNERS) loop isn't displaying (confused!) Below is the site ...
0
votes
1answer
32 views

Adding custom post type to loop

Hope someone can help me with this. I have a custom post type ('article') in my WordPress installation, and I'd like to display those posts alongside the default posts in the regular post feed. This ...