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
11 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 ...
0
votes
0answers
10 views

Template included with plugin doesn't return all posts for custom taxonomy

I'm in the process of developing a plugin with a custom page template (using template_include) with a loop that retrieves all posts with a custom taxonomy. I tested the code using the same templates ...
0
votes
2answers
634 views

While in “the loop”, detect if a post is the most recent

While inside "the loop" in WordPress, is there an easy way to detect if a post is the most recent? A Usage Example: I want to make the first post output an H1 for the title instead of an H2. Or I want ...
0
votes
1answer
23 views

Custom WP_Query doesn't display all posts

I'm building an options page which allows users to choose three posts and three custom images that display on the site's front page. I am using the Settings API to create a custom WP_Query which pulls ...
-1
votes
1answer
24 views

Do not show all post from all categories, just show posts from category in current loop

I have following loop that show all children categories of a parent category(id = 3) The first loop i want to show every child category in a parent div (destination-tours) The second loop i want to ...
1
vote
1answer
20 views

Filtering The Loop For Single Page and Blog Page

I want to start a div when loop starts in a single page ( also in the blog page ). And end that div when loop ends. Obviously using any filter hook or action hook. Thanks In Advance
-1
votes
2answers
20 views

make get_post work in the loop

I'm getting a post by id with get_post(); $post = get_post(17); $page = get_post_meta(17); setup_postdata( $post ); include($page['_wp_page_template'][0]); After getting the post I include a ...
0
votes
0answers
20 views

Custom Loop and Infinite Scroll

I am using customized version of _s theme where I have Product CPT. In the following files, I need to use Infinite scroll (provided by Jetpack) - archive-products.php taxonomy-[tax-name].php ...
0
votes
2answers
1k views

Change or update WordPress loop based on dropdown selection

I have a Contact Us page which is showing 9 locations on the sidebar by querying the custom post type "Distributors." I want the user to be able to use a drop down that is populated by the taxonomy ...
0
votes
1answer
15 views

WooCommerce - Checkout suddenly stops working

From one day to the next apparently the checkout, specifically selecting a payment option stopped working. I can't figure out why, but when selecting an option, the page keeps jQuery reloading. this ...
0
votes
2answers
586 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
57 views

Ajax loop and history.js for SEO

For a project, I have to ajaxify the main loop with a "load more" button to show more posts (basically as well as Canva Design School). To make this work I used the method described in the tuts+ ...
0
votes
2answers
393 views

Can't get the previous and next posts permalink

I tried to get the next and previous URL, and create a navigation. But it seems to only retrieve the permalink from the two first posts (but not the others recents posts). I have 5 posts (ID = 25, ...
0
votes
1answer
9 views

<?php the_content(); ?> to get a little more content after 'read more' inside loop

I want the to give a little more content after <!--more--> tag inside Loop. I saw this on wordpress codex This script gives the content before the <!--more--> tag: <?php global ...
0
votes
1answer
19 views

How to add div blocks after certain set of post

Ok I broke my post down into different style settings. Like shown below. The first post is a large block. the next four post are small and aligned next to the larger post. I used the loop below to ...
1
vote
3answers
6k views

Can i merge 2 new WP_Query($variable) 's?

I am running a multisite network and i have setup a sql query that uses swith_to_blog(); and queries the posts. Is there a way that i can declare the query inside a new WP_Query and actually merge ...
0
votes
0answers
16 views

Query posts by switch

I need your help to add a case to a switch in my theme to order posts. My theme uses a query_post: query_posts( $query_string . $orderby ); In the loop to order generated posts. The query uses ...
0
votes
0answers
19 views

How to solve this script problem in theme directory?

I have a jQuery Ajax call that calls a php script. This call works if the file is in the root of the site but does not work if this php script is in the theme folder . Additionally, I have a 500 error ...
1
vote
1answer
47 views

How to use WP_Query to display many posts?

This is my WP_Query instruction but this not work. This display just first post. Help me please? // WP_Query arguments $args = array ( 'post_type' => 'teachers', 'p' => ...
1
vote
1answer
34 views

How to pass many ids in post__in?

I need to pass many ids to the parameter post__in in args. This not work !!! Help me please. foreach ($rows as $obj) { $todos .= $obj->ID . ","; } $ids = trim(trim($todos), ","); # echo ...
1
vote
3answers
3k views

Pagination not working on home page

I've a page named "share" with a complex loop that's working perfectly. This page is located at domain.com/share. Now I need to use this page as the home page, so I went to "Settings -> Reading" and ...
0
votes
1answer
727 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 ...
1
vote
2answers
1k views

How to determine if an admin is logged in outside the loop

I need to be able to tell if an admin is logged in ouside of the loop. This is needed for some php files that are part of a WP site but do not use require( '../wp-load.php ); What I need to do is ...
0
votes
1answer
24 views

add bootstrap post slider with tabs

I'm trying to add a carousel with my post. UNder the carousel, some tabs with the post title. On click of the post title, it should change it the slide to display the related post. In " Static" in ...
0
votes
2answers
42 views

Most elegant way to enqueue scripts in function.php with foreach loop

I wonder is there a way of running wp_register_script and enqueue with the help of foreach loop to manage label and dir? For example, function wbs_app_components(){ $scripts_list=array( ...
0
votes
0answers
12 views

Custom Taxonomy Link Text Echo Name Not Slug

I'm a little lost about where I can place a simple php echo within a loop. I have a "program" taxonomy where each program is echoed onto buttons. Right now I'm only echoing the slugs for the link ...
0
votes
1answer
376 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
370 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 ...
0
votes
0answers
31 views

Display featured products through custom loop in woocommerce on template page

I was wondering if someone could help me out. I would like to display 6 featured products from my woocommerce store on my home-page.php template. After some researched I found that the right way to do ...
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
2answers
625 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 ...
1
vote
1answer
25 views

add most viewed post by google analytic in loop [closed]

I'm trying to find a solution to display the 5 post most viewed ( from google analytics) in my loop. The only way I find at the moment is to use this plugin 'Google Analytics Top Content Widget ' ...
-1
votes
2answers
77 views

WooCommerce - Show orders for a specific product ? [closed]

How to view orders for a specific product in WooCommerce using sku or product name? What I have so far is that, but it does not work.. Does anyone know how to do? <?php $args = array( ...
0
votes
1answer
1k views

Change the way wordpress outputs images or image galleries

The title is the short version of the question. Here's what I need in more details... If the answer is not so simple, I would be glad if you can point me to the right direction with a tutorial or to ...
0
votes
2answers
544 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
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 ...
0
votes
0answers
23 views

Pagination not working Search posts

if ( have_posts() ) { while ( have_posts() ) { the_post(); global $post; //loop here } if(function_exists('wp_pagenavi')) { wp_pagenavi(); } } I have the following code in function ...
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(); ...
2
votes
1answer
2k 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( ...
0
votes
1answer
18 views

Multiple loops without repeating content

I have a second loop on a page where I want to display posts from the same category as the present post but excluding the present post. I have a loop that displays all the posts from the same ...
0
votes
2answers
57 views

Pagination for custom loop on custom page template is not displaying anything

I have created a page where user can see his favourite post which has been bookmarked by him get_user_favorites($user_id); This function is responsible for returning me all the favourite posts ...
0
votes
1answer
42 views

How to check if there are posts with the same tag

I have this code but I can't get to delete the div with the class otrasObras <?php $test = ""; $posttags = get_the_tags(); if ($posttags) { foreach($posttags as $tag) { $test .= ',' . ...
0
votes
1answer
389 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
431 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
625 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
2answers
35 views

Make loop alphabetical

I have a simple loop but it returns it in any order. What I'm looking for is to alphabetize the loop. I've tried a few different things but Can't seem to get it to work. <?php // Start the loop. ...
2
votes
2answers
40 views

Query sticky posts with thumbnails

I need to display max 5 latest sticky posts that have a thumbnail. And I need to have accurate counting of the displayed posts. I've tried to exclude sticky posts without a thumbnail with meta_query, ...
0
votes
0answers
27 views

Wordpress loop not working only on home page, works on all other pages

I'm currently working on a new WP theme. I was working on my theme locally and it was working perfectly without any issues. Since I moved the theme to my dev server, everything has worked except ...
0
votes
0answers
15 views

Get link in loop after redirect to page contact

i have loop in archive: <?php if (have_posts()) { while (have_posts()) { the_post(); ?> <div class="list"><a href="<?php the_permalink() ?>" title="<?php the_title(); ...
1
vote
1answer
27 views

Show Sticky Post at the top but do not show again in the loop?

Regarding wordpress.org - sticky posts are displayed at the top but they also appear again in the loop. For the main loop on my homepage I want to display the sticky posts at the top BUT I don't ...