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

Post Format single-loop.php using get_template_part

I have set up to use post formats gallery and video in addition to the standard. I am editing the loop-single.php to give it different layouts for each post format, but I'm to include ...
0
votes
1answer
86 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
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
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
121 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' ...
2
votes
3answers
6k views

How to Change Loop to Order Posts by Views (using wp-postviews plugin)

I hope somebody would be kind enough to help. I currently have a page that orders all of the posts by comment count, but I want to change the loop to order the posts by view count. I have installed ...
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
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
2answers
703 views

remove <p> tags from the_content

I've got a post format of Image, and I am running into an issue where the image is being wrapped by a <p> tag. I want to get rid of that tag (specifically on the single.php version) of those ...
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
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
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
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
59 views

Building theme so user can change header image [closed]

My Google-Fu is letting me down so I'm trying it here. I'm building a theme and I want the customer to be able to change the header image him/herself in the wp-admin. How do I go about this? As I ...
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
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
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
75 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
42 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( ...
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
366 views

Post_type doesn't work for widgets?

I've found almost the same question: http://stackoverflow.com/questions/4796165/multiple-loops-in-wordpress-second-loop-not-resetting but the answer doesn't work for me. I have "portfolio" post type, ...
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( ...
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
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
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
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
1answer
147 views

display only parent replies count in index.php

Currently my posts display the total count of comments (i.e both replies and sub-comments). I want to display only the number of reply count in my index.php (and not comments for a reply) for each ...
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 ...
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, ...
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
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
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
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
2answers
1k views

Display one latest post from multiple categories

This should be very easy, however for some reason I can't find a working snippet anywhere on the web.. I basically need to display one latest post from 6 categories (can be changed to 7,8, etc etc) ...
2
votes
1answer
97 views

How can I let users to access plugin functions based on roles?

I use a plugin called "Live Edit" to let authors and editors edit the content front-end. But the issue is that the plugin lets any logged in users to edit the content. I want the edit(specified by ...
0
votes
3answers
3k views

Problems excluding a custom post-type from the loop

Morning all, I'm having some issues with excluding my custom post-type 'events' from my index.php loop for my Blog page. I simply want to display the posts from my actual Blog, which I assume come ...
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
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
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
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
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( ...