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
1answer
8 views

Optimizing the blog loop

I've got such post loop: <?php global $post; $post = $post_object; setup_postdata( $post ); $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts(array( 'post_type' ...
0
votes
2answers
596 views

WP Query - duplicated posts once including tags in search results

I running WordPress on IIS & SQL server. As some of the plugins do not work correctly with DB ABSTRACTION I am using a lot of functions.php filters as so on. To make my search results include ...
0
votes
1answer
21 views

Is there any good reason for two CSS files to @import each other?

I'm working on some critical style revisions for a client's WordPress site that was designed by another team. The CSS seems to be a tangled mess. One of the idiosyncrasies I've found is that the ...
0
votes
1answer
28 views

Limit tags shown in post

How do I limit the number of tags shown using the code below, without having to add $count=0; or if ($count <= to the query, but only for the home page, and a different number for each set of ...
0
votes
2answers
1k views

get parent content inside child posts

I have a custom post type where I've created 3 pages in a parent-child relationship. The pages are created like this : PARENT-CHILD-GRANDCHILD I want the child and the grandchild pages to get the ...
0
votes
0answers
5 views

Multiple loops on search results page return empty on no results

I've got a search results page that has several loops on it. One loop returns our most popular posts, and the other returns the top 5 of another custom post type. We use these loops on the blog, on ...
1
vote
1answer
17 views

Post loop for all taxonomy terms

I currently have a custom taxonomy set up called development-category at the moment, if I want to set up a posts loop for each of these taxonomies, I'm having to do it as follows: <?php ...
3
votes
1answer
49 views

WordPress category & taxonomy loop with pagination

I have two taxonomies belonging to the same post type (posts). Adventure - belonging to the category taxonomy Adventure - belonging to the holiday-type taxonomy I want to run two queries: $args = ...
2
votes
2answers
605 views

Single Page Wordpress Theme - Using page templates

Well I am lost, its late and I have been searching google all night. Heres the problem I am running into. I am trying to create a singe page website using wordpress "pages". How I have initially setup ...
4
votes
3answers
152 views
+50

Display Authors Comments on Profile Page

Hi I am trying to display a authors comments on their profile page (author.php) however both codes I tried, seem to display everyone's comments. Also the second code method is suppose to link to the ...
0
votes
1answer
398 views

the_content() “crashes” for single pages

I have big trouble with the_content() for single.php. Whats my problem? the_content() doesn't give any output on single pages furthermore it crashes (no other PHP code below the function call is ...
0
votes
2answers
568 views

Video post format, extra content breaks video embed

I am using the content-video.php include to show the latest video post on my homepage. The include only shows the video from the post and not the rest of the content, which works well. My problem is, ...
0
votes
0answers
8 views

Grouping posts by Custom Taxonomies and wording by date

I have already figured out how to create a loop that pulls posts from a Custom Posts Type that I created and grouping them by terms of a Custom Taxonomies. Sorting of terms Alphabetically works ...
0
votes
1answer
18 views

Where to find the code used to render a page that has a shortcode and a template defined?

I'm new to WP and trying to configure the 'My Account' page on a WP site. The site uses the Paid Memberships Pro (PMP) plugin. In the WP admin console > Pages, there is a page called 'My Account'. ...
0
votes
2answers
21 views

Where should I use post_class()?

I am trying to learn WP Theme development. And as I have understod it is important to use "post_class()" since plugins may need to use it. But what I not understand is where I should use it? Should ...
0
votes
0answers
11 views

How to get the categories from Related Posts using “Posts to Posts” plugin

Sorry if this has been answered elsewhere — if it has, I have been unable find the answer — or if this seems like a basic question. But I am trying to use the Related Posts functionality built into ...
1
vote
1answer
23 views

Define Function in functions.php or plugin and call in theme loop

I need to define a function in functions.php or a plugin and be able to call it inside the theme's loop & outside. Example; I have a $product_price = get_post_meta(get_the_ID(), 'product-price', ...
0
votes
1answer
10 views

Post Format problem

I'v tried really a lot of solutions, and the one that works, it works half a way. Inside single.php I'v added <?php while ( have_posts() ) : the_post(); ?> <?php if( ...
0
votes
1answer
732 views

Listing Specific Categories from Current Post with Depth

I've been on this for sometime and been having a ton of issues to find a proper way to do what I'm trying to achieve. An Example would be as follows: I have a featured Image with a rollover and I ...
0
votes
0answers
46 views

How to retrieve sticky post with Visual Composer's loop builder?

So I have a simple custom shortcode function build under Visual Composer with vc_map. <?php /** * Blog Posts * */ if( function_exists( 'vc_map_get_attributes' ) ) { $atts = ...
0
votes
1answer
62 views

Exceprt not displaying

I am using a custom template homepage in which I want to display some excerpt from a category but it's not displaying as I code for just the_excerpt. I have a confusion too, they say the the_excerpt ...
0
votes
2answers
684 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
0answers
28 views

Category filter with load more ajax

What I am trying to do is to do an Ajax request to filter posts on category click depending on the category id, then apply load more posts by ajax. Problem: when I fire the ajax call by clicking on ...
2
votes
1answer
2k views

get_template_part from plugin

This is default get_template_part function inside WordPress: function get_template_part( $slug, $name = null ) { do_action( "get_template_part_{$slug}", $slug, $name ); $templates = array(); ...
0
votes
0answers
28 views

When can a template skip the loop?

I've reached another point with WordPress where something simple is stumping me. In working with an older theme, I have some page templates that do not call the loop. They simply use ...
0
votes
1answer
447 views

Including all post id's of a custom post type into an array

For my single.php (products.php), I try to build a navigation via which the user can switch between products based on the meta key "price". I want to put all id's of the products post type into an ...
1
vote
1answer
3k views

ajax for filtering posts by category in wordpress loops

I've been looking around for a way to filter my posts on http://www.waziproject.com/wazimagazine/ without reloading the page. So my question is if anyone can help me out to turn the following into a ...
0
votes
1answer
2k views

Conditional two level dropdown filter for custom post type

I have set up a custom post type and taxonomy. The post type is called Local Services and the hierarchical taxonomy is called Regions. The Regions have child categories called Areas. I have set up a ...
1
vote
1answer
21 views

Only display videos and images in the_content() within loop

The issue I am trying to solve is within the WordPress loop, I only want video embeds or images to display, not any text. Currently, when creating a new post (Standard format) in the WordPress ...
0
votes
1answer
35 views

How to call custom single post?

newbie here playing with php stuff, wanna learn. So the problem is. I have created custom posts and data from those is shown in a widget. Now i want to create custom single posts for those custom ...
0
votes
2answers
483 views

Pagination/infinite scroll with WP_Query and multiple loops

I need that the main page of my site have 3 columns: - The first having the 5 most viewed posts; - The second with the next 5 most viewed posts; - The third with the most recent posts. I don't want ...
0
votes
1answer
11 views

Get meta value when the page is a blog archive

I'm using custom metaboxes on my pages. For example: header icon. I created a page for the news on my site. I selected it as a blog archive page under Settings->Reading page. Unfortunately I can't ...
0
votes
0answers
20 views

How do I prevent an infinite-loop. wp_insert_posts + JSON

I'm downloading posts from JSON file with this code: $bands = json_decode(file_get_contents('json file url'),true); $arrayLength = count($bands); for ($i=1; $i <= $arrayLength-1; $i++) { ...
0
votes
0answers
7 views

I want to show a list of all the custom taxonomies, and under each a list of some posts that match that

Does anyone know how they might do that? I imagine it would involve getting the list taxonomies, and then iterating through them with php to, and for each taxonomy item, querying the posts and ...
0
votes
1answer
410 views

Repeating Loop on my Posts Page

I have a problem with my loop.php, it keeps on repeating posts. I'm guessing this might be controlled outside of this loop.php as it happens no matter what I try. Could someone please advise me as to ...
0
votes
2answers
471 views

How do I exclude posts by custom field value?

I need to exclude posts that have a custom field 'city' value of 'Melbourne'. After much searching I think the solution might consist of 2 parts. In functions.php : A function to get the post IDs ...
0
votes
0answers
9 views

Category page that displays 3 posts from each subcategory

Alright, so my main menu I am adding category "MainCat" that has subcategories i.e "SubCatOne" "SubCatTwo" etc.. When I click on that page I see all posts from all categories on it, unorganised (below ...
0
votes
1answer
15 views

WP_Query secondary query failing

I'm needing a couple queries on front-page.php and am at a loss why this is not working. My first query works fine, however, my second one specifying the category (or even nothing at all) never ...
0
votes
1answer
726 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 = ...
0
votes
1answer
27 views

numberposts not responding to wp_reset_postdata()

I am working on a loop where I want the content (from 2 separate categories) to be displayed like this: 1 large format post, 1 random product, 2 small format posts, 1 feature post ...repeat. In order ...
0
votes
0answers
7 views

Loop using selection field to display content ACF

I 'm trying to create a loop to show only the contents of a multiple choice selection I have in the ACF ! I tried to do the consultation via WP_QUERY as explained in the ACF site , more does not work! ...
0
votes
0answers
20 views

Problem with pagination in custom loop on front page - no back link

I have certain problem: I have several queries on main page. When I call new WP_query on front Page (custom loop in main loop), make custom pagination, but it doest work in case if I want "Previous / ...
0
votes
1answer
27 views

Exclude first post (sticky or not) from the loop using query_posts()

I'm using query_posts( 'offset=1' ); to exclude the first post from the loop. However, if the first post is a sticky post it will be shown and the second (non-sticky) post will not be shown. Is there ...
0
votes
1answer
18 views

Returning One custom taxonomy term name

I have a custom taxonomy called cities and right now the only city is las vegas. I am trying to use the code in question to echo "Las Vegas" - for the posts that are associated - on the search results ...
0
votes
1answer
647 views

Offset WP_Query by negative 1

I have an event loop and I'm wondering if it's possible to offset the loop by -1, so the prev and next posts of the current post are shown. EDIT - Thanks for your comments, I think I can clarify. ...
0
votes
1answer
26 views

Tricky Custom post loop

I'm building a site using "theretailer" as a base and I cant figure out where to place code to get the loop to work for a custom post type "News"? the loop the theme uses is ...
5
votes
4answers
780 views

How to control output of custom post type without modifying theme?

I have a custom post type 'properties' that I'd like to control the HTML output for. For simplicity, let's focus on the archive view. As a basic example, here is what a loop looks like in an ...
1
vote
2answers
37 views

Should I use loop in the single.php file?

I read many tutorials, and checked many premium/free theme's source and most of them use loop in the single.php file. The single.php file only displays one post, so I think the_post() is enough, ...
0
votes
1answer
870 views

wp_query orderby random do not repeat infinite scroll - one loop

I have found a lot of documentation on solving this issue with multiple loops, I'm finding it hard to see a solution for one custom loop. Problem: I'm using infinite scroll to load in the next page ...
0
votes
2answers
25 views

Echo Most Recent Sticky Post in Loop?

I am looking to echo the most recent post in the loop of content. Only 1 post. Do I need to put some sort of parameter on the following code: if (have_posts()) : while (have_posts()) : ...