Tagged Questions

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

How to display different number of posts

How do I display different number of posts on the home page and archive pages, the archive pages can use the value set in the admin, but I want a custom number of posts to be displayed on the home ...
0
votes
0answers
7 views

Running posts thumbnails in flexslider

This is what i'm trying to achieve: Front page with 10 posts, with three first posts shown in a slider (flexslider) and the rest shown as regular excerpts underneath it. Ive managed to do it, this is ...
0
votes
1answer
16 views

Custom post type archive pagination with HTML5Blank theme?

Can't get the pagination to work. Here's my archive-work.php: <?php get_header(); ?> <main role="main"> <!-- section --> <section> ...
0
votes
1answer
12 views

Strange switch_to_blog() issue

OK, so WordPress has been destroying me this afternoon and this particular issue I really can't figure out. We are building a multisite network and for our particular purpose need to loop through each ...
0
votes
1answer
20 views

How do I display posts with specific value in a custom field into my loop?

I'm trying to display posts that contains a specific value from my custom field. For example, I created a custom field that asks for the year, let's say I would like to display only posts with the ...
-3
votes
0answers
38 views

WordPress Loop file

Am trying to study on loops in wordpress. The problem is that i dont want to add an other " if (have_posts()) : while (have_posts()) : the_post(); " in my files so i was looking for it in index.php ...
0
votes
0answers
22 views

Link (by categories) to the first and last posts in custom post type

Link (by categories) to the first and last posts in custom post type For a new theme, I created a “story” custom post type. The main content has a different style than the blogging part, with ...
0
votes
0answers
12 views

wp-types - showing custom field on parent [on hold]

I am wondering why this piece of code: <?php $cena_produktu = types_render_field("cena", array("raw"=>"true")); echo $cena_produktu; ?> is not working on a page as parent? well.. it's ...
0
votes
0answers
15 views

Archive sorted by month - separate

I was looking for my answer in this forum but without success (so far..). Case is following - I have a news page with sidebar that shows archive (last 12 months). I'm using following code: <?php ...
0
votes
2answers
17 views

WP update_post_meta link loop

I've tried to update post meta by link in loop. Here is code function make_sticky($post_id) { // Update, add, or delete field ---------------------------------- if ( get_post_meta($post_id, ...
0
votes
2answers
27 views

Change query from cat id to slug or name?

I'm using the following query to fetch posts in a category (10). I would like to change this code to use the category slug or name instead of the id number as this often changes when I move sites ...
0
votes
1answer
29 views

how can i order the category by date

This may be a quick and simple fix for someone but i want to be able to sort by 'ASC' OR 'DESC' This isn't my markup but here is the loop i want to change just not sure how. I read the query ...
0
votes
2answers
36 views

Integrating WordPress with Your Website

I am intergrating WordPress with a non WordPress site. I have installed WordPress at my evercam.io/wordpress and I have followed the codex and I have been able to display a list of posts on a static ...
0
votes
1answer
50 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
45 views

How to pick “full/thumbnail” images in the loop?

I am picking the latest posts through the WordPress loop using the below code, but it's picking all images at full size: if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> ...
1
vote
1answer
25 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
18 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
21 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
31 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
49 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
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
27 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
26 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
49 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
20 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
25 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
31 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
135 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
94 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
15 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
22 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
115 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
11 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
49 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
32 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
115 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
33 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
28 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
87 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
29 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
43 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
35 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
32 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
234 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 ...