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)

4
votes
3answers
153 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
13 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
196 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
18 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
43 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
23 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
132 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
20 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
53 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
33 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
154 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
38 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
35 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
108 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
31 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
49 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
51 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
37 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
21 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
37 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
17 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, ...
3
votes
3answers
282 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
18 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
22 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
49 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
21 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
154 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
49 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
52 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
38 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
27 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
29 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
59 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 ...
0
votes
1answer
98 views

Unable to display paging navigation with a custom post type loop

I have used a starter pack for my WordPress theme development, but I can't display the navigation on a custom post type loop. The framework starter is : http://underscores.me/ There is my PHP Code ...
-1
votes
2answers
27 views

Single loop with dual content area

Is there a way to implement a single loop with dual content area. E.g. A single loop having 2 of <?php the_content(); ?> Dinstinguished as shown bellow with video and write-up respectively ...
0
votes
2answers
72 views

Multiple instances of Featured Image Thumbnail As A Background On Homepage

Here's what I'm trying to do: Make it so the first 6 posts are displayed differently on the homepage than posts 7 and on. The first six posts should grab their featured thumbnail images and use them ...
1
vote
2answers
56 views

Transient not working for custom loops

I'm working at a WordPress theme. Since I need to display featured posts, related posts, some widgets with recent posts and so on, I need to use multiple custom loops. Because of this, the number of ...
1
vote
1answer
50 views

List all posts commented by current user

I need a page to display all posts (in Foods custom post type) that have comments by the logged in user. The list just needs to show the title with link to the title. Is this possible? What I've ...
0
votes
0answers
55 views

Wordpress loop only displaying one post

I don't know enough PHP perhaps to recognize immediately why the loop in my wordpress theme is only displaying one post and so I humbly ask for assistance. <div class="container"> <div ...
0
votes
1answer
42 views

Display one post on category.php: Wrong featured image

What I want When a user opens a category link, there should be automatically displayed the first queried post. My query looks like this: <?php global $query_string; $posts = ...
-1
votes
1answer
27 views

Query for page content, and query for posts on the same page?

I'm having trouble with trying to make a blog listing page, I have a page in Wordpress called Blog. Within this is some written content and that's it. I'm using the following query to make it output ...
1
vote
2answers
82 views

User Defined order on get_categories?

Below is some basic code to call specficic categories to our front page post loop. It works fine, except my client wants the categories displayed in a particular order. I know there are other posts ...
0
votes
1answer
80 views

Blank content php code not parsing advanced custom fields gallery add-on [closed]

I have blank contents where the content for the act gallery code is. I think there is an issue with the code. < ?php /* Template Name: Images scroll */ ?> <?php get_header(); ?> ...
0
votes
0answers
40 views

running queries of multiple post types

I am trying to figure out the query I need to build for my project. I've got a little idea but i am getting confused by all the different query methods and I'm not sure which one to use. I have two ...
0
votes
1answer
33 views

How to overwrite orderby with add_query_var

So I would like to have an archive that displays its posts in a random order. <?php $query = new WP_Query($query_string."&orderby=rand"); ?> But also then if the user chooses they ...
0
votes
2answers
40 views

Escape current post from loop

I'm creating a search widget and for that I use a secondary loop via new WP_Query(); $query = new WP_Query('s=searchTerm'); if ($query->have_posts()){ while ($query->have_posts()){ ...
0
votes
1answer
182 views

WP_Query on custom post type not displaying, multiple loops & get_template_part

I'm having problems getting my testimonials to display. On page.php I have a testimonials section. So I have a loop that grabs the content for page.php, and then a get_template_part('content', ...
0
votes
1answer
36 views

An archive page without post format (just standard post)

I'm trying to get posts with not marked with any type of post types (aside, audio etc). But I didn't find any solution to do this. I thought doing this with custom fields but site has a lot of ...
2
votes
1answer
38 views

Show posts without term

I am working on a product page where I show reviews from my post type 'reviews', if the product page title matches with my term from the taxonomy 'review-product'. Example. Product page title: ...
0
votes
0answers
31 views

How to get rid of extra Untitled Article in html5 document outline when using new WP_Query?

Here is a simplified version of the code I'm using on a static homepage template made for a child theme of TwentyTwelve. I simplified some of the divs used for styling and just focused on the problem ...