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

Infinite Redirect Loop after moving to subdirectory

I installed WordPress locally and created a theme, which worked fine. Now, as I wanted to deploy the site to a webserver via FTP, I got stuck by an 301 Redirect loop which makes it impossible to ...
0
votes
0answers
11 views

Timeout error 504 with 2 query_posts , how can I make them work?

Im experiencing a error: ERROR 504 - GATEWAY TIMEOUT I have this loops that works fine IF in logged... if not, it doesn't work... Update: I have deactivated one of the query_posts and it works. ...
0
votes
2answers
718 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
1answer
68 views

The post order is different for logged-in and non-logged-in users? [on hold]

I noticed that for some reason on my site, the post order changes depending on whether a user is logged in or not. When I am logged in as the admin, the posts display is chronological order. But when ...
0
votes
0answers
13 views

Redirect loop in WP Admin with SSL

we're running a membership site on the latest Wordpress 4.5.3 hosted on Bluehost. We need to move the website to SSL so made some changes in .htaccess, wp-config.php and added Wordpress HTTPS plugin ...
0
votes
1answer
389 views

Thumbnail Image Rounded Corners w CSS (or any other good method)

I've been researching how to display thumbnails with rounded images, but every solution ends up running out of gas. One trick I tried was wrapping the thumbnail in a division with the same size and ...
-2
votes
1answer
28 views

Wrap every 2 divs in row - for each loop [closed]

For some reason, having a bit of a nightmare wrapping every 2 divs in a row in this for each loop.... Could anyone shed any light on it at all? <?php $terms = ...
0
votes
0answers
18 views

Prevent the Loop from running on tags page

I wrote a custom post query for the tags page (tags.php), which queries all posts. I therefore do not need the Loop on that page, because it only queries those posts related to the tag. Is there any ...
4
votes
2answers
61 views

Unit testing to simulate the loop

How do you construct unit tests with PHPUnit and the WordPress test framework that simulate being in the loop? For instance, if I want to test a function that is only able to be called in the loop ...
0
votes
0answers
10 views

How to insert a product programmatically in DB?

I need to know what the minimum information required to insert a product in woocommerce database and make this product active in the virtual store. I need this for an API implementation in my ...
0
votes
0answers
13 views

How do I edit The Loop? - I want to change the layout etc

I know HTML and CSS but not PHP. I am trying to edit the way that the list of Posts are displayed when the visitor clicks on a category. I am using Wordpress with the Genesis Framework and the ...
0
votes
2answers
40 views

display post multiple times based on array of dates

I have a custom post type for a simple schedule list and using the meta box plugin i have two meta boxes assigned to custom post type. 1 for an image and 1 for an array of date times . In my ...
0
votes
1answer
551 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
57 views

pop-up lighbox with AJAX

I need to create ajax script where user choose a post type and after choose post type post show on a light-box or any thing but without loading. I can't get an idea. Please give me a idea to improve ...
2
votes
3answers
4k views

the_title() shows title of the first post instead of the page title?

I'm occasionally facing this problem and not sure what causes it, any ideas? <?php get_header(); ?> <div class="content" role="main"> <h1><?php the_title(); ?>&...
-1
votes
2answers
41 views

How to wrap every 3 posts in a div (and close the last div too) [on hold]

I have code that wraps every 3 posts in a div (so that the posts will line up horizontally even if different heights). It closes the div after 3 posts, but the problem is the div is left open if there ...
7
votes
3answers
290 views

Remove the Homepage Query

I have a homepage displaying the home.php template, containing 2 sidebars with widgets in them. The main query still pulls in the standard 10 posts, but since I'm not displaying these, I'd like to ...
0
votes
0answers
39 views

jquery Load All Wordpress Post and Pages Into Div Using AJAX

Ok So I am working on my first Wordpress them based off html5 template that I created myself. Right Now On the site I have a continous music player. It allows the users to listen to music while ...
-1
votes
2answers
430 views

display all posts in current category

I am trying to display all the content/posts assigned to a certain category. I have a custom post type set up called 'Videos' and within this I have created categories called music, commercial, promo ...
0
votes
0answers
13 views

Filtering search results for nested loops

So I have a list of companies that have counties and cities. I need to be able to do something like /findmanagers/miami-dade/ and then build a query that fetches all the companies we have listed ...
0
votes
1answer
423 views

Loop and add Specific Categories and Products Images

Thanks to Rafael Marques, I have a list of Products and Categories organized based on different created categories. I also have 5 different Custom Page Templates. Now I would like to display the ...
0
votes
0answers
29 views

Custom Page Load by wp_query

Is there a way I can use wp_query to retrieve custom pages and posts, and display them on the front page of my WordPress site? I'd like to do that for every custom page I have, to end up with a one-...
0
votes
1answer
22 views

How is WordPress changing the content markup?

In my post there is Visual and Text tabs. I've formatted some content and in the text tab it looks like this: <strong>The Mission Statement –</strong> The following is a mission ...
0
votes
1answer
26 views

Dividing the loop to style post differently

I'm using a plugin that displays post and shows them in a certain area on my site, such as the sidebar or anywhere i put the <?php;?> code, but only if the author that is writing the post clicks ...
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
26 views

Cannot retieve the_content() and the_author() - both returning empty strings

I am creating the following code to display open graph meta data in the header of my single.php page add_action('wp_head', 'mycode_add_og_meta_tags', 5); function mycode_add_og_meta_tags () { ?> ...
0
votes
3answers
629 views

Order by a meta field 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

Query only displays one page_id

I have a short query that is supposed to load IDs from pages that the user picks in the backend. Currently it does display an array with IDs on the frontpage, but it stops displaying posts after the ...
0
votes
0answers
24 views

Using custom query on a custom page for a custom post type

I have setup a custom page (page-mypage.php) and I want to list all posts of a custom post type when I use the loop in my custom page. I'm using pre_get_posts hook to modify the query. Problem: In ...
-2
votes
1answer
501 views

Unable to display paging navigation with a custom post type loop

I have used a starter pack for my WordPress theme development, but I can't display the navigation on a custom post type loop. The framework starter is : http://underscores.me/ There is my PHP Code ...
0
votes
1answer
55 views

Group posts that matches a term in a loop

I'm working on a website that shows a lot of products, and this is my structure: Product (custom post type) -->Brand (custom taxonomy) ------>Brand A (custom term) ------>Brand B (custom term) -->...
-2
votes
1answer
57 views

Get posts that matches specific terms of multiple custom taxonomies

I'm working on a page that show a lot of products. My structure is Product (custom post type) -->Brand (custom taxonomy) ------>Brand A (custom term) ------>Brand B (custom term) -->Department (...
3
votes
1answer
40 views

Displaying custom posts only if custom meta box's date is not expired

I have a problem with displaying custom posts - I want each post to show only if a date set in a custom field has not passed. I can't figure out the where I should put the if statement in the code. ...
0
votes
1answer
466 views

Admin login not working, because: wp-admin%2F&reauth=1 redirect

I want to login my WordPress site, but i can' because the login always redirect to this: http://testsite.com/wp-login.php?redirect_to=http%3A%2F%2Ftestsite.com%2Fwp-admin%2F&reauth=1 1, I add ...
1
vote
1answer
813 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
2answers
39 views

Get Sticky User in user loop based on user role

I have this shortcode to display a loop of user avatars with order by registration date. function Profiles() { $args = array( 'orderby' => 'registered', 'order' => 'DESC', '...
0
votes
1answer
40 views

How to keep a CPT stick to specific position?

I have created a CPT (esp-publicitarios) using Metabox plugin with the following code: add_filter('rwmb_meta_boxes', 'elclarin_register_meta_boxes'); function elclarin_register_meta_boxes($...
0
votes
1answer
486 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
429 views

Second level subcategory

I'm trying to get anoter level subcategory to show in my select option. I've managed to get one... how can i get the other? <?php $taxonomies = array(CUSTOM_CAT_TYPE); $args = array('...
5
votes
2answers
22k views

How to get posts published between a date and today?

Is it a way to get posts published between a date and today with query_posts() ? Example : All posts published since 2012-04-01 Thanks EDIT : How to add the filter date on this Query Posts ? ...
2
votes
1answer
46 views

A snippet after every image

folks. I need to put a piece of code after every post image (post attached image). it's something like this: <img class="alignnone size-full wp-image-3079" src="imgurl.jpg" alt="02" width="2592" ...
2
votes
0answers
27 views

Showing random content / pictures from earlier posts in a sticky post?

I have a sticky post on my wordpress blog, in the beginning. I would like to place some random content in it, by simply replacing some HTML in the post content. The random content would come from ...
0
votes
2answers
3k 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 ...
3
votes
1answer
25 views

How to order category.php loop by 'meta_value'?

So I have a basic loop on category.php that displays all posts from the specific category, like this: <?php if (have_posts()) : while(have_posts()): the_post(); ?> <a href="<?php ...
0
votes
0answers
13 views

modifying variables passed to the Wordpress LOOP, with IF/THEN?

good evening, i'm trying to make my coding as modular as possible. my site uses three different LOOPs, each to accomplish a different task with my posts/pages, and i've got each loop on its own file, ...
0
votes
1answer
16 views

include(locate_template) messing up the loop

So, I've developed a one page theme that pulls in child pages of the parent in order create the layout. I also have it set up to pull each sub pages page template and display the content accordingly, ...
0
votes
1answer
649 views

WP_Query post at custom position

Lets say I have a custom query which based on two custom post types: $wp_query = new WP_Query(array( 'post_type' => array('post-type-1', 'post-type-2'), 'post_status' => '...
0
votes
2answers
961 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 ...
2
votes
2answers
3k 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(); ...
3
votes
3answers
48 views

Why does the_content not work like others for a set post id?

Here's something odd, I want to print out a certain post on any page request, if you have a constant $idnumber of your favorite page/message, then add: $GLOBALS['post'] = get_post( $idnumber ); ...