get_the_ID not returning correct ID value

The array intialize of the variable $valid_post_id is incorrect. Change: <?$valid_post_id(‘1′,’2′,’3′,’4’);?> to <?php $valid_post_id = array(‘1′,’2′,’3′,’4’);?>

Post loop count is not in order

a) Try to initialize the $count variable before your loop: $counts=0; $loop = new WP_Query( array( ‘post_type’ => ‘focus-areas’, ‘posts_per_page’ => -1 ) ); while ( $loop->have_posts() ) : $loop->the_post(); $counts++; echo $counts; echo ” – “; endwhile; b) or use the current_post method (starts at 0) of WP_Query: $loop = new WP_Query( array( ‘post_type’ … Read more

displaying recent comments outside loop without plugin

You can do that with get_comments. <?php $comments = get_comments(array( ‘number’ => 10, // 10 comments ‘status’ => ‘approve’, // only approved comments ‘post_status’ => ‘publish’, // only on published posts )); // do stuff with $comments You can see how the core itself does this in the recent comments widget.

Multiple Rows in a using wp_query

Get all of your posts in one query, then count the iterations of your loop. Pseudo-code follows. if ( $query->have_posts() ) { $i = 0; while ( $query->have_posts() ) { // If $i is 5 (5th post), end one row and start the next if (++$i == 5) { echo ‘</tr><tr>’; } // the rest … Read more