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

Buddypress Group Activity Loop Filter activity type

I'm using Buddypress 1.8.1 When the group home page load I want to show only 'activity_update' and 'joined_group' activities in Activity Loop. Here is my Activity Loop code. It is standard loop ...
0
votes
0answers
43 views

need a wordpress loop to put in the sidebar

I need WordPress loop to do the following : check if there is no sidebar widgets active then get 5 recent posts with only titles and thumbnails But here is the thing : I don't want the loop to get ...
0
votes
0answers
61 views

Problem with the loop?

I'm customizing my Twenty Twelve theme to show a single posts from two separate categories on my home page using a custom template. Here's my code : <div> <?php $catquery = new ...
0
votes
1answer
87 views

change the_content images for different sizes (Desktop, tablet, mobile)?

This may be a complicated question so I'll try to explain it as easy as possible. I have three sizes for images in my post (thumbnail, medium, large, 640px, small) and I would like to change the size ...
0
votes
1answer
61 views

ACF loop and php formatting

The following php will loop through each page and then output ALL of the ACF custom fields sequentially. What I need help formatting is a conditional statement that places all $fields, except ...
0
votes
1answer
29 views

Show post if in category

I've searched a lot for options like has_category, in_category, get_the_category, but I couldn't make them work Here's my pastebin http://pastebin.com/Zi7auvtv I want this code to run only if the ...
1
vote
2answers
127 views

Loop custom taxonomy to get lists of cutom post types?

I have a custom post type 'products' and custom taxonomy of 'maker' that i have connected to that cpt 'products'. I have written this code : <?php $myproducts = new WP_Query(array('post_type' ...
0
votes
1answer
116 views

Advanced Custom Fields (ACF) Plugin - Random Image in Sidebar

I’ve created a Custom Post Type, “Slide”, and I’m attempting to load a random slide image, with title and caption, in my sidebar. I’m using the Advanced Custom Fields Plugin for the post/slide ...
0
votes
1answer
15 views

Loops in category description

I would like your help to find how to do a thing I need: I have some posts, for example: Article Title: Banana Article Title: Orange Article Title: Lemon Article Title: Strawberry All this ...
0
votes
1answer
35 views

Multiple Queries and Loops within CPT Archive

I have a Custom Post Type called 'properties', and have set up an Archive page to display posts within that category. Essentially, the Archive page needs to contain 3 different query types; the first ...
0
votes
0answers
12 views

How do I create pagination? [duplicate]

I've got a site with a static front page and another page for posts. On the posts page I'm using paginate_links() to generate pagination. However, it isn't producing output. Dumping the output as a ...
0
votes
1answer
33 views

Custom loop to query posts with no featured image and/or no post editor content

I am looking to query and pull a list of all custom posts 'foo' that have no featured image set and/or have no text copy (from the WP editor). The list will be used to determine which posts need ...
0
votes
1answer
27 views

How to display thumbnail if post is assigned one otherwise not

I would like to display the most recent post in a block, and if the post is assigned with a thumbnail I would like it to be shown on the left to the post content. This is my code that I have been ...
0
votes
0answers
62 views

Buddypress registration page redirection loop errors after adding if(!is_user_logged_in)

I'm running WordPress Multisite install with BuddyPress (WP 3.9, BP 1.9). I'm using the code below to make the main website protected from not-logged-in users, and let them to visit only the ...
0
votes
1answer
71 views

How to render the single post template with the post name?

I'm calling pages with Ajax and I have this code in functions.php to determine which page is called and then, render the corresponding template: function ajax_callback() { if( isset( ...
0
votes
2answers
41 views

Get author_id in wordpress

I'm having problems to get author_id in this code. Don't show nothing. Some can help me? <?php global $query_string; query_posts( $query_string . '&orderby=rand' ); ?> <?php ...
0
votes
0answers
30 views

Wordpress Next & Previous post outside the loop

As a (front) designer I'm looking for the following: How can I get the following code working for next/previous posts OUTSIDE the loop? <img src="<?php get_featured_image ?>" /> ...
0
votes
1answer
76 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
1answer
38 views

How to put a block of code between [shortcode][/shortcode] in do_shortcode()?

So I want to put a loop of post behind a 'like lock' thats created by a plugin that uses the shortcode [to_like ID="XX"]content[/to_like]. But instead of the plugin blocking the content, i just get a ...
0
votes
1answer
27 views

Have multiple loops on a page appear after/between page content

I created a function (in function.php) that allows me to put additional loops for different categories into pages: function custom_summary($atts) { extract(shortcode_atts(array( ...
5
votes
2answers
76 views

Retrieve each widget separately from a sidebar

I would like to retrieve each widget existing in a sidebar in order e.g. to mix them with posts inside the main loop. I know I can use different widget areas (sidebars) but this approach clutters the ...
0
votes
2answers
43 views

Default featured image set as background image [closed]

I'm using the following code to set my post featured image as a background-image… <?php if (has_post_thumbnail( $post->ID ) ): $image = wp_get_attachment_image_src( get_post_thumbnail_id( ...
0
votes
1answer
30 views

Breaking up multiple words and inserting an image after first word

I'm not sure if it's possible, however, what I'm after is to break up WordPress titles that are multiple words and then insert an image. My current loop works just fine. Right now it gets the page's ...
0
votes
1answer
36 views

Print the whole page?

I am trying to make a loop to loop all pages beneath each order. I want this because I want to make a one-pager with a page as an element of the one-pager. So that you can go into WP to edit a page ...
0
votes
1answer
181 views

Adding first and last classes to three column layout in Bones boilerplate

I'm using the bones boilerplate theme in Wordpress and on the homepage am displaying a section containing three columns for the latest three posts in Wordpress. The bones theme uses the responsive ...
0
votes
3answers
74 views

Order by a meta fiel in query loop

I would like to sort my article from a category by a number added in a meta field. Here is the first step, I get the articles to display on the page. <?php $cat = get_post_meta( get_the_ID(), ...
0
votes
1answer
34 views

Breaking up the results of a loop

In my query, I'm gathering 6 posts and displaying them into an unordered list. Here's the code I'm using: $args = array( 'post_parent' => $page_id->ID, 'showposts' => 6, ...
0
votes
0answers
21 views

Load Index on “Earlier” Post, Prev and Next Links

how would i load the index of my blog at a later point in the reverse chronological feed while maintaining the chronology of the feed overall? i found this explanation of how to load the feed at a ...
0
votes
1answer
46 views

How to add title attribute to archive items

How can I have the title attribute to each listed archive item, so when I hover an item, it says: view all posts in archive: '' $html = wp_get_archives( array( 'show_post_count' => false, ...
0
votes
1answer
39 views

How to have post count after each listed category

How can I have a post count after each listed category with the following function? Also, how can I apply this with wp_get_archives and also with the same option as the below function? <ul> ...
0
votes
0answers
44 views

How to get multiple loop in category.php, my scripts becomes madness

I am trying to develop a category.php page for my new theme and the loop which I’ve developed shows all posts of my blog and really bad too. I'm not an expert in WordPress theme development and ...
0
votes
1answer
34 views

How to add ASCII symbol after each recent post [closed]

How do I add an ASCII code after each recent post list item? <?php $args = array( 'numberposts' => '2' ); $recent_posts = wp_get_recent_posts( $args ); foreach( $recent_posts as ...
0
votes
1answer
24 views

Adding a category at even positions on main loop with modified pagination

I have different categories showing over main loop. I want to add a specific category post at even positions of main loop. Example current post list with categories: cat1 cat1 cat1 cat1 required: cat1 ...
0
votes
2answers
48 views

How to change the default post type over the loop?

I want to include some kinds of posts in the default query. When the loop begins: if ( have_posts() ) : // Start the Loop. while ( have_posts() ) : the_post(); the ...
0
votes
1answer
52 views

Compare Two Custom Post Types Using The Same Custom Taxonomy

I have two post types, courses and testimonials, sharing the same taxonomies. What I am looking to accomplish is to check whether a course is in the same category as a testimonial. Then display if it ...
0
votes
2answers
121 views

Filtering posts by category name based on page's slug

I've created a page template and the goal is to create a loop that gets all posts by category name. The category name is passed from the slug of the page name. I haven't been able to get this to work ...
1
vote
1answer
58 views

Grab the first paragraph of each post

I have some code that uses preg_match to grab the first paragraph, and then spit it out in the loop: function first_paragraph() { global $post, $posts; $first_para = ''; ob_start(); ...
0
votes
1answer
43 views

WP_Query not getting all posts, just tagged posts

I'm trying to create an archive page that grabs every post submitted. At the moment, I have this, which doesn't work: <?php $args = array (); $query = new WP_Query( $args ); if ( ...
1
vote
1answer
48 views

Move sticky posts down in main loop

Currently I am working for a site which runs on WordPress, and using twenty thirteen theme which already has a sticky post function built in and working reasonably well. But I do not like how a ...
0
votes
1answer
28 views

Query counting excluded category on paged loop

I have an Index.php with a basic loop with this query before: <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'category_name' => 'work', ...
0
votes
1answer
27 views

Inserting A Feed and Sidebar into an HTML Page

I have a website I've built and the last step is to configure the blog page. My html and css is solid but my php and wordpress development knowledge is almost non-existent. I don't need a dynamic ...
0
votes
2answers
20 views

Exclude recently updated post from custom WP_Query using multiple loops

I want to do something like this but can't manage to figure it out. [Click][1] I am using this custom WP_Query to display upcoming events on my homepage. $events_args = array( ...
0
votes
2answers
57 views

How to find meta_values to call

This thing has really confused me, when writting a custom query with wp_query we have pass multiple arguments. But i am using woocommerce, and i found this part of query on some form, which is $args ...
0
votes
1answer
20 views

How can I display other user avatars on an author profile page?

I have an author profile page where I'm displaying a user avatar and information about the author. On this same page, I'm also trying to include posts by other authors with their avatar displayed next ...
0
votes
3answers
44 views

How would I get 1 latest post from a query for 5 posts?

So I have a wp_query which is getting the 5 most recent posts from my Wordpress site. What I want to do is from within this query, grab the most recent post and show this as a sort of 'hero' post, and ...
0
votes
1answer
58 views

wp_query inside the_loop

I am having this issue with my loops. I am making a shortcode that will be called from the main query. It will display on the front page from the_loop. for some reason that I can't figure out. The ...
0
votes
1answer
67 views

get_template_part() to render single page Theme

I´m developing a single page theme and want to render all pages with their respective templates on a single page. I know I could make a query and write the markup for the respective page, but I prefer ...
2
votes
1answer
103 views

Impossible to get Attachments Outside Wordpress?

My page (outside the wordpress install) begins something like this: global $wpdb, $wp_query; define('WP_USE_THEMES', false); include_once 'word/wp-blog-header.php'; $args = array( ...
0
votes
1answer
45 views

Posts without featured image using other post's featured image

I am using the following code (see bottom) to display a custom post called 'artists'. I am also using <?php if (has_post_thumbnail( $post->ID ) ) so I can set the background of a div using the ...
0
votes
0answers
40 views

Suppress the_content filter in a nested loop

I have some layout changes that are being applied to the_content. I need to do one of two things, but neither is working as expected... either: Pass data to the filter so that it knows if it is a ...