How to get post id of last approved comment?

<?php $recent_comments = get_comments( array( ‘number’ => 1, ‘status’ => ‘approve’ ) ); foreach($recent_comments as $comment) : $latest_postid_with_comment = $comment->comment_post_ID; endforeach; ?> Probably way to compress this code into something smaller. But this will work.

How to display a “NEW”-icon on posts from today

you can use the difference between the post time (get_the_time()) and the current time (date()) – for instance, this snippet added to functions.php of your theme would add a new css class to post_class() if the post is less than 24hrs old: function post_from_today_class($class) { //add .new-post-today to post_class() if newer than 24hrs global $post; … Read more

How to list post as buch of category, and all of them

here is a general structure how I would do it: $categories = array(5,2,4,3,1); //manually enter the array of the category ids in the order how you want them to appear foreach( $categories as $cat ) { $args = array( ‘category__in’ => array( $cat ), ‘posts_per_page’ => -1 ); $cat_query = new WP_Query( $args ); if( … Read more