has_excerpt() not working inside wp_query

So we already resolved the issue via the comments, but I thought I should explain something: has_excerpt() returns ! empty( $post->post_excerpt ) if the post has a custom/manual excerpt, so if the function is returning true when it should be false, then it’s likely because the length of the excerpt in the database is > … Read more

How to add automatically bootstrap 4 order-lg-1 and order-lg-2 classes for columns in foreach loop based on the count?

You should use the PHP modulo operator for that. Since you need two different layouts, you should calculate your classes numbers according to $count % 2 and ($count + 1) % 2: <?php $count = 0; foreach ($howtoplaycontent as $hpc): ?> <div class=”row courses_row” style=”background-color: #f8f8f8″> <div class=”container”> <div class=”row” style=”padding: 15px;”> <div class=”col-lg-6 course_col … Read more

Create a page template for “top rated posts” but show full content and not just a list

I opened up that plugin (WP-PostRatings) and located the get_most_rated() function. It’s in the following file: includes/postratings-stats.php In that file, on line 57 you get the following: foreach ($most_rated as $post) { $output .= expand_ratings_template($temp, $post, null, $chars, false).”\n”; } From that, I went searching for the expand_ratings_template() function. Found that in the following file: … Read more

How to loop custom post_type from (a) specific category(ies)?

This is my loop, try using it. <!– Post –> <?php $paged= (get_query_var(‘paged’ )) ? get_query_var(‘paged’):1; global $query_string; $myquery = wp_parse_args($query_string); $myquery = array( ‘paged’ => $paged, ‘posts_per_page’=>6, ‘post_type’ => ‘portfolio’. ‘tax_query’ => array( ‘relation’ => ‘OR’, array( ‘taxonomy’ => ‘category’, ‘terms’ => array(‘picture’), ‘field’ => ‘slug’, ), ), ); query_posts($myquery); while ( have_posts() ) … Read more

Query Nopaging action not having effect

nopaging does not fetch all posts, it just tells WordPress not to bother figuring out stuff like how many pages there are. What you actually wanted was not to disable pagination, that’s just a solution to your problem that you asked about. You should ask about your problem instead, aka how to show all posts … Read more

WordPress query undefined offset in loop

There might be other causes to the issue in question, but one issue I noticed in your code is that because you are looping through a custom WP_Query instance, i.e. $loop, then you need to use $loop->the_post() instead of just the_post(): while ( $loop->have_posts() ) { $loop->the_post(); the_title(); } And you could see that I … Read more