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

Implementing an OR statement to wordpress wp_query

I am trying to return all posts that meet the following conditions: The category must be 63 OR the post must have a value associated with the meta key named 'android_link' My current argument ...
1
vote
1answer
190 views

How to add tags (custom taxonomy) to post class css?

I am trying to figure out how to add my custom taxonomy for tags to the post class css when I already have added the custom taxonomy for categories. The code Im currently using to add the category ...
1
vote
1answer
530 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 ...
1
vote
0answers
186 views

Loop that displays PARENT PAGE & CHILD PAGE & outputs GRANDCHILD PAGE title and content

I've never posted here, but I'm tired of slapping code together. That said, I would be most appreciative if someone could help me with this. I need a page template that: outputs the PARENT PAGEs, ...
1
vote
2answers
60 views

Page-loop is looping content from custom loops on the same site. How to avoid that?

i've made a custom home-page (with a template) and i'm using three loops on this site: two category-loops and on the bottom of the site the main loop for the page (the page content). the problem is: ...
1
vote
1answer
2k views

WooCommerce Product Page Loop - Output All Product Thumbnails

http://69.89.31.200/~horologi/shop/ I'm working on the site above and the client has requested that on the shop page, all the product information is displayed on that page, including all product ...
1
vote
0answers
229 views

Display one post from each term in a custom taxonomy

I am trying to display a list which shows one post (and information about the person posting) from each custom taxonomy term. The code I am using is as follows, but it is instead printing out EVERY ...
1
vote
1answer
50 views

How to list posts with disabled/closed comments, with pagination?

i'm interested how to display all posts (from all categories) that have closed/disabled comments? I have tried using the comments_open() function inside the loop, that works, i don't know how to ...
1
vote
0answers
55 views

Display posts with comments closed, with pagination?

i'm using a custom query, which needs to display all posts with closed comments. I have this <?php $the_query = new WP_Query('showposts=-1'); ?> <?php while ($the_query -> have_posts()) ...
1
vote
0answers
68 views

Problem getting current post tags to show in a widget

I have tried tons of examples and suggestion on this topic but I can not get them to work. What I am trying to do is display the tags associated with the current post in a widget. I have built the ...
1
vote
0answers
583 views

Display products for a category, sorted by post_excerpt

I'd like to display a list of products for a certain category, sorted by the post_excerpt. The original code I used was this: $args = array( 'tax_query' => array( array( ...
1
vote
0answers
61 views

Modified loop-single-forum.php to work inside of a sidebar Widget, not working on some site pages

So I took loop-single-forum.php, copied it and renamed it, fixed it so the site is calling the copy and then removed what I did not need from it to place it in a sidebar widget. It works beautifully ...
1
vote
1answer
227 views

Display related custom taxonomy posts in sidebar

Can I use this snippet to retrieve posts from a custom taxonomy in a custom post type? <?php $sermon_series = new WP_Query( array('series' => 'type')); ?> <?php while ...
1
vote
0answers
119 views

List authors with the last post title and order by last post date

I want to list authors with last post data and order them by last post date. Now i have this codes but i don`t know how to edit them. // Selects from tables wp_users and wp_posts, selecting published ...
1
vote
0answers
85 views

Order by category titles

I have a category page called 'features' this is all fine, but the posts in the features category also belong to a certain genre of film, and it's this what I want to order the posts by on the actual ...
1
vote
0answers
56 views

Access to Media Library

Im trying to find a way to pull random images from either a post or wordpress's built in image library. Im not sure how to query image uris from a post or the media library - is there a tag or method ...
1
vote
1answer
129 views

How to get the role id from the role name?

I need to retrieve the id of a role by giving it roles name. For example: if( current_user_can('editor') ) { //here I want to retrieve the id of editor. } How can I do that?
1
vote
2answers
114 views

Query last updated posts (posts updated in the last 24 hours)

I'm having some difficulty to find an example of how to create a loop with posts that had been updated in the last 24 hours. My idea is to have a page of posts or perhaps on the index.php a lists of ...
1
vote
3answers
437 views

posts page - different lengths of excerpt

is it possible to get wordpress on the posts page to do the following example. the first three posts need to have a large image spanning the width of the title box and a longer excerpt. the rest of ...
1
vote
1answer
47 views

How to exclude visited posts from loop

How can I exclude visited posts from a loop? I have a loop of recent posts on a single post page that excludes the current post and I want to extend the amount of times users browse by filtering out ...
1
vote
4answers
118 views

Does Wordpress Loop have a function like Shopify's cycle?

Shopify's Cycle lets you alternate between things within a loop. Here's my example: <div class="{% cycle 'first', 'second', 'third' %}"> {% include 'product-grid-item' %} ...
1
vote
1answer
316 views

Use two different post_per_page limits with infinite scroll

I have one loop on my homepage that I use infinite scroll to paginate. To keep the load time of the homepage down, I want to load a smaller initial amount than when the infinite scroll is triggered ...
1
vote
1answer
202 views

How do I write this SQL statement for Posts written in last 24 hours?

Someone gave me this SQL code to count the number of posts (of post_type 'mixtapes') in the last 7 days. I tried to convert it to 'in the last 24 hours' as well, but it's giving the wrong number. ...
1
vote
1answer
882 views

pagination not working for category.php (custom post types in categories)

it works everywhere on my site but it isnt working in category.php. When i click page to it goes to... domain.com/category/cat-slug/page/2 by the way this is showing custom post types within certain ...
1
vote
0answers
81 views

Replace default Wordpress search behavior with Sphinx

I want to implement Sphinx Search in my Wordpress site but I'm not exactly sure how to change Wordpress search behavior to use Sphinx. How do I get Sphinx Search engine to replace whatever Wordpress ...
1
vote
1answer
133 views

Basic multiple loops only displaying first loop

I'm trying to set up multiple loops on a page. The first loop will display the latest four blog posts, and the second loop below it will display the latest eight blog posts with pagination. I set up ...
1
vote
1answer
455 views

Taxonomy posts on Archive page

Hello, I have been stumped for a few days on a perfect way to display the posts using my custom post type (track) and the taxonomies ( genre, sub_genre). When a user goes to ...
1
vote
2answers
74 views

How to show only blog-domain instead of the whole permalink in the loop

I wanna show the blog URL instead of the whole post URL in my loop. The reason is that I use Wordpress multiblog with sitewide tags, so on my front-page of the main blog I'm showing the 10 last ...
1
vote
1answer
240 views

How to remove a plugin filter's priority on specific loops (custom queries)?

So I have a review plugin that is automatically sorting all my site based on the score rating. It seems here are the filters the plugin is applying globally: //Post sorting $sort = ...
1
vote
1answer
69 views

Different Queries Return Same Results [closed]

EDIT: After fiddling with the loop a bit, it somehow corrected itself. At the end of the day the code remains the same, only now it's working. http://sct.io/tt95p4 - development site. Scroll down ...
1
vote
0answers
171 views

In Loop, if a Gallery, Only Pull First Image [closed]

I'm trying to create a loop that only displays the post types: "photo" and "gallery". If it's a gallery I would like to display only one of the images, preferably the first. I'm a little confused ...
1
vote
0answers
81 views

Showing sequences of related posts [closed]

I'm starting a Wordpress site similar to Khan Academy [*]. It'll be a series of blog-posts, one video per post, from multiple instructors, with each post providing the canonical place to discuss the ...
1
vote
2answers
3k views

get custom post type by tag

Is it possible to retrieve post entry for a custom post type by tag, I have been trying with the following code, however it just locks me into a infinte loop. <aside class="supporting_images"> ...
1
vote
2answers
3k views

Custom loops, sticky posts, and pagination nightmare

I've tried everything. I've looked at every. single. question. here, on StackOverflow, the WP help forum, googled 10 pages deep and literally tried EVERY combination of code I could find, for the ...
1
vote
1answer
193 views

How to make a second query offset -2 from current post

I would like a second WP_Query on a custom post type's single page to return 5 posts, starting with two before the current post, so that I get this: The-one-before-the-previous post Previous post ...
1
vote
4answers
192 views

Dynamic Landing Page

I have a site with posts going back 5 years and I want to create a couple landing pages to highlight groups of posts. For example, I want to create a page about "blue widgets". The page should include ...
1
vote
3answers
459 views

Only show posts with date of today or in the future (i.e don't show past posts)?

Is it possible to only show posts that have todays date or in the future? I don't want to show any posts that are in the past. Also, I want the list to show posts that have a date in the future as ...
1
vote
1answer
147 views

Listing all term items alphabetically / sorting loop

I have my own custom post type and it has its own taxonomy and terms. Whenever user visits http://example.com/mytaxonomy/myterm I want the page to display all items within this term alphabetically. ...
0
votes
3answers
90 views

wordpress simple loop, huge issues

Im having a problem where for some reason, a basic loop im trying to add to a sidebar keeps....keeps looping on interior pages (single and page .php ) but not on index.php. on index.php (home page) ...
0
votes
3answers
166 views

is_home, and is_front_page conditional problem

I have this snippet in a "portfolio-loop.php" file. I'm using get_template_part to display the loop on the front page and on other pages. I have this within the loop: <?php if( !is_home() || ...
0
votes
2answers
1k views

When would you use $_post instead of $post?

I've seen some examples that use $_post instead of $post. What's the difference and when would you use $_post instead of $post? Example: if (have_posts()) : while (have_posts()) : the_post(); ...
0
votes
2answers
631 views

How to setup a query to output posts by groups of five?

I'd like to have a query that returns posts grouped five by five. Right now I have a simple query loop like this one : <?php if( $query->have_posts() ) : ?> <ul class="posts"> ...
0
votes
1answer
217 views

Ajax loop in sidebar to load post titles/categories

I have a sidebar that displays the 20 latest posts, what I'd really like to do is Ajaxify that loop so there's a load more button at the bottom. The problem is, it's a fairly complicated loop and ...
0
votes
4answers
148 views

How do I display an image before the first post of the loop when I'm using get_template_part?

I have used $count before, but never run into this problem. I cannot get it to work. I have limited php background, so please be patient with me! Here is the $count setup code: <?php $count = ...
0
votes
3answers
2k views

Exclude the category from the Wordpress loop

Question Hi everyone, I have this code for the loop, and I need to exclude a category 4 from this loop. Please help :) Code that starts the loop <?php if(have_posts()): ?> ...
0
votes
4answers
7k views

Get excerpt using get_the_excerpt outside a loop

I have a code that call get_the_title() and it works, but get_the_excerpt() return empty. How can i make it work? This code is inside a plugin called "WP Facebook Open Graph protocol". Here's the ...
0
votes
2answers
49 views

“Right Way” to make custom Loop respect reading settings inside admin panel?

I have created custom Wordpress loop using WP_Query, loop is working fine and I can customize it nicely, however i have a problem using "Blog pages show at most" settings, for example inside my loop ...
0
votes
4answers
448 views

Multiple loops in same page, without duplicate content

I'm trying to make a page with multiple loops, I need every loop to display a predefined number of posts from the same category (every loop displays X number of posts from Category CATS). But I also ...
0
votes
4answers
217 views

Does WP have a global of $id?

I'm trying to attach an object to every post of any type. This will require post ID to populate or create my object. So, I either call global $post, or get_the_ID(), or do get_post(). I hope there is ...
0
votes
2answers
42 views

How do I automate multiple category loops?

I've asked this question already on the WordPress forum, but it sank like a stone, which isn't at all unusual. I've set up a general Articles page with multiple loops, in order to display the first ...

1 4 5 6 7 8 20