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
2answers
19 views

how do i make this loop work

Apologies I am a PHp beginner and I have no idea why this loop is not working on my tag.php page any help would be welcome. <?php get_header(); ?> <div class="posts"><!-- BLOG --> ...
0
votes
0answers
22 views

Different post types on same page in 2 separate columns using 2 different loops [on hold]

I'm pretty new to WordPress and am working on creating a child theme (parent theme is Avenue). I've created 2 different custom post types and now would like to display them on the same page in 2 ...
-1
votes
1answer
14 views

How to do query_posts on tags pages

So I am using the tags.php on my WordPress site to create special featured pages; what I would like to do is create a featured area on the index of every page that contains the first five posts. I ...
0
votes
1answer
15 views

Multiple Loops on a Page Without Duplicates

I have tried many different versions of this and nothing seems to be working for me. I want to display single posts of a custom post type (portfolio) each in its own div. I don't want any duplicate ...
0
votes
0answers
14 views

How do I filter out certain posts from the loop while keeping total number of posts displayed the same?

I'm building a theme where a number of posts would be featured above the cut, while the rest of them would be displayed below. It's fairly easy to filter out the featured posts from the loop - I ...
0
votes
1answer
12 views

Modify loop output for a specific list of categories

I'm trying to modify the output of a loop on an archive page for a specific list of categories. Normally this loop outputs the Title, Author, Date and does so for every post in that given category. I ...
0
votes
0answers
17 views

How to make search for posts using get method?

So I am building a WordPress theme for myself to meet my needs, so what I am looking for now is make a search using a get method in PHP. If my URL is something like this : ...
-2
votes
0answers
25 views

Can the_archive_title and the_archive_description be used outside of the loop?

Can the following new 4.1 functions be used outside of the loop? the_archive_title the_archive_description I'm working off _s so the above are being used with: the_archive_title which can be ...
4
votes
2answers
53 views

Display several random posts, but make sure a condition is met

I have a custom post type for a group of people (employees). At first, I needed to display 7 random employees. That was easy <?php $args = array( 'post_type' => 'employees', ...
0
votes
1answer
35 views

group search results by post type?

My site has 3 unique post types: Default Blog posts ("post") custom type "lesson" custom type "series" When the user searches the site, I would like pertinent results from all 3 post types to show ...
0
votes
1answer
22 views

sort Posts by custom user filed

So I'm trying to sort the posts by custom user filed, I'll explain... So I have added users filed to the registration page, The fields are checkboxes, they allow the user to choose what topic he is ...
0
votes
0answers
29 views

Integrate WP Tiles into existing loop (index.php) and theme

I want to integrate WP Tiles directly into our Wordpress theme and into our existing loop but their documentation is pretty thin and I can't find much in the way of examples so not really sure how to ...
0
votes
2answers
51 views

Active class for my flexslider in WordPress

I'm calling images with a wordpress loop to display in a flexslider on the home page. However, the active class for the thumbnails of the slider aren't working in tandem with the slideshow -- I can't ...
0
votes
1answer
28 views

Issue in If else condition [closed]

I'm calling my all pages on one pages as a section. Here is my code: <?php $args = array( 'post_type' => 'page', 'orderby' => 'ASC', ...
0
votes
1answer
17 views

How to Generate a list of Most Commented post?

I'm trying to call a list of most commented post. But the call to the DB returns always the same post (the first one in the loop) This is my code in functions.php function ...
0
votes
1answer
33 views

Archive page…limiting posts per page

So what I have done is created a custom post type 'testimonials' and set the "has archive" option to "true" and have a PHP template file named "archive-testimonials.php". What I wan't to do is limit ...
0
votes
1answer
26 views

Foundation modal in wordpress php loop

I'm using Foundation V4 framework within a child theme for a website. I currently have the wordpress post loop outputting all the content as per normal, for images I plan to do something a little ...
1
vote
1answer
35 views

Better way to display posts from specific categories, in a grid layout

I'm using the following code to display posts from a specific category, in a grid layout, on my home page. It works exactly how I want it to, but I keep reading that I shouldn't ever use query_posts. ...
0
votes
1answer
54 views

Custom Post Type + Category archive

I have created a WP stack with 3 post types: 1. Post (default) 2. Event 3. Place These 3 post types share the same taxonomy, that being the default WP category, here are some example categories: ...
0
votes
1answer
18 views

Calling Specific Pages with wp query Part II

I'm making one page website and I added a custom field on "Page" post type that asks "Use this page as a section:" Yes or No(with dropdown). I called all pages on template-onepage.php(custom template) ...
0
votes
1answer
29 views

Why do I get `Call to a member function have_posts() on a non-object `? [closed]

add_action( 'genesis_loop', 'be_home_loop' ); define('PER_PAGE_DEFAULT', 2); function be_home_loop(array $query = array()) { global $wp_query; wp_reset_query(); $paged = ...
0
votes
2answers
58 views

Specific loop in Shortcode

I'm making shortcode and I'm stuck here. Here is code: add_shortcode('service-shortcode', 'service_shortcode'); function service_shortcode($atts) { extract( shortcode_atts( array( 'title' => ...
0
votes
1answer
17 views

Trying to get property of non-object in shortocde

I'm having error in shortcode that "Trying to get property of non-object" on line no 130 Here is code: while ( $our_work->have_posts() ) { $our_work->the_post(); $termsArray = ...
0
votes
0answers
51 views

Create multiple sections for all categories and then queries all the posts for each of those categories

I'm trying to find to find a way to create a loop that queries all categories and then the posts under those categories. I am using a custom loop to display my posts and I'd like to have it follow ...
0
votes
0answers
19 views

Loop latest posts from subdomain to main domain

If i install Wordpress in a subdomain, can i get latest posts from subdomain and dynamically show them in main domain?
0
votes
0answers
20 views

Display Users by usermeta using foreach loop with multiple relationships

I'm getting a real headache trying to sort this one out. Here's my problem: I'm working on a feature for a site that requires Users to be displayed according to their association with a common ...
0
votes
0answers
22 views

Link Button url count php and wordpress

I have a function where it behind me facebook tanned number, the more accurate it brings me a number of shares that a post had! I tried to solve the function, more is giving an error and I need help! ...
-1
votes
0answers
16 views

Pagination with Category template gives me 404

I've run into an issue trying to create a pagination for a regular Category template. Odd as it seems, I can get the same snippet working on a Page template. See code below, ( category.php ) ...
0
votes
1answer
28 views

Pagination not working with WP_QUERY

I have set up a custom loop that is working fine, but will not display the pagination links. After some searching around I've learned that the pagination links (as I've used them here anyway, but I'm ...
0
votes
1answer
49 views

Pagination in custom post type page template

I made a query for my custom post type "websites". I'm trying to get the pagination working but I'm running in some errors. I think the whole code is ok, only the part just before the end while tags. ...
0
votes
1answer
10 views

Trying to retrieve random post, getting a page

I'm trying to retrieve a random post to link to on my site. I have the following code, but the only thing that it seems to retrieve and display is a link to the homepage. Any help would be ...
0
votes
0answers
30 views

Infinite Scroll or Load More Button to Categories Loop

I have a question that I can't solve and find no solution. I show all categories using a loop like this: <?php $args = array( 'orderby' => 'name', 'hide_empty' => true, 'order' ...
0
votes
2answers
27 views

How to order by multiple fields using standard query_posts?

In our archive.php we show all the items which match our selected category. This works absolutely fine. Then we improved it by adding (just before the loop) a sort and upping the posts per page from ...
0
votes
1answer
25 views

Filtering by multiple conditions in the loop

I'm trying to filter the posts in my index by multiple conditions. So far I've tried with this: <?php $query = new WP_Query( array( "post__not_in" =>get_option("sticky_posts"), ...
0
votes
1answer
21 views

show latest authors blog post

how do you display the latest authors blog post? I have the below code: <?php $author = get_the_author(); $args = array( 'numberposts' => '1', 'author'=>$author ); $recent_posts = ...
0
votes
0answers
23 views

change the number of posts on the frontpage depending on screen width

My frontpage currently runs a secondary loop at the bottom of the page that shows 4 posts of a certain category. But I would like to reduce these posts to 3 when the screen width goes below 1024px. ...
0
votes
0answers
10 views

Change get_posts to loop.php suitable version

I did't know that get_posts don't work with loop.php. I already have this great loop.php file and I want to use it. I created this code: $pageposts = get_posts( array( 'relation' => ...
0
votes
0answers
11 views

Ordering in custom wordpress query

I have a custom wp query <?php $aId = get_the_ID(); $aList = new WP_Query(array( 'post_type' => 'porti', 'posts_per_page' => -1, 'meta_key' => 'aName', 'meta_value' => $aId, ...
0
votes
1answer
37 views

Display most viewed post from last 30 days is not working correctly

I've try several different loop to display the most viewed post from the last 30 days . . However its just showing the post from 30 dasy ago . . not from the last 30 days . . not the most viewed . . ...
0
votes
1answer
15 views

Cannot reset a loop in a plugin template

I am trying to override a query in a loop which exists in other plugin. I created an extension to override that loop using a hook that exists in the plugin. The plugin query: query_posts ($args); /* ...
0
votes
2answers
37 views

WP_Query loop else statement not executing

I have two WP_query loops in my frontpage.php file: <div id="aanbod"> <div class="container-fluid section-name-cont"> <div class="container"> <div class="row"> ...
0
votes
0answers
21 views

Sorting posts to make those with post thumbnail show up first

I am trying to sort post with If have post thumbnail list posts show first(i need the posts without thumbnail to show after it) by title. $args = array( 'post_type' => 'post', 'meta_key' ...
-1
votes
0answers
100 views

AJAX POST 500 INTERNAL SERVER ERROR

I am new in WordPress coding and I make one infinity loop for my WordPress blog. Its working great on Local machine (WAMP) but after putting it online at nginx server its showing POST mysiteurl ...
0
votes
2answers
86 views

Hiding carousel indicators if there's only one post

I am working on a custom carousel (Wordpress + Bootstrap). The carousel is working without problems. However, I would like to hide Bootstrap carousel indicators and arrows if there is only one post. ...
0
votes
1answer
18 views

Query Taxonomy By Page Title

What I want to do is display posts that share a taxonomy on a page with that taxonomies name. For example, a page named "PHP" would display all the of posts with the custom taxonomy "language" set to ...
0
votes
0answers
27 views

Does not show thumbnail in a given category

I am creating a loop with two formats for posting , one is the default post and the other is a video post using the post-format (video) . I found right here a function to capture and save thumbnail ...
0
votes
0answers
23 views

Show posts in category

I have a problem in the loop by the time I make a wp_query . What I'm trying to do : Bring only 4 random posts of the Videos category. Videos This category is the Post -Format Video type (I believe ...
-2
votes
1answer
42 views

Help with if/else loop [closed]

can you help me to add an else statement to this loop? <?php $post_type = 'post'; // <-- Post Type $tax = 'temporada'; // <-- Taxonomía $termino = get_terms($tax); $category = ...
2
votes
2answers
108 views

get_the_foo() in the loop - does it perform another query?

I'm unclear on the get_the_foo() style of functions, for example get_the_permalink(). My main question is: when this is performed in The Loop, is another SQL query executed (besides the original ...
-1
votes
1answer
81 views

loop mix my child-category and parent-category

i explain the situatio I'm having: I have a blog, which on the homepage, have display the most recent post. For each post category, I have set up one specific color and icon by css. ex: for ...