get_post_class not working properly

An empty string is used for the glue parameter of implode(). get_post_class() will return an array, and you want to separate the array values with a space, so use this: $post_class = implode( ‘ ‘, get_post_class() ); This appears to be a bug in the WP Most Popular plugin. I submitted an issue to the … Read more

Add all category as classes in foreach loop

Please replace: $new->category_slug = wp_get_post_terms($post->ID, ‘portfolio_category’)[0]->slug; with $category_slug = wp_get_post_terms($post->ID, ‘portfolio_category’); $cat_cls=””; foreach($category_slug as $cat_classes){ $cat_cls .= ” ” . $cat_classes->slug; } $new->category_slug = $cat_cls; Because the code you have written above will store only first category it will get.

adding additional class to get the post thumbnail [duplicate]

Sorry for late reply, already fixed, i miss understood about array, so here the code that completely run as i want it. <?php $next_post = get_next_post(); next_post_link(‘%link’, get_the_post_thumbnail($next_post->ID, ‘prev_next_img’, array( ‘class’ => ’rounded-lg object-fill w-full max-h-full’ )) . ‘<h4 class=”text-center mt-2 lg:text-base text-sm no-underline text-black leading-snug font-medium”>%title</h4>’, false); ?> in function.php i put custome image … Read more