WP_Query calls all posts?

There’s no such parameter as category for WP_Query, so WP is ignoring it. You should use category_name, where the value is the slug of the category.

Highlight post in sidebar on single page

The simplest thing would be to add a class to the link that contains the post ID. <a href=”https://wordpress.stackexchange.com/questions/97059/<?php the_permalink() ?>” class=”post-<?php echo get_the_ID(); ?>”> You can then write a custom CSS function, put it in functions.php and hook to the wp_head. This function only serves to echo the necessary CSS to highlight the link. … Read more

How to exclude Sticky from Recent Post?

You can try this: $args = array( ‘post__not_in’ => get_option( ‘sticky_posts’ ), ‘posts_per_page’ => 5, ); $recent = new WP_Query( $args ); to exclude the sticky posts. You can read more about it here in the Codex.

How to show one post different from the rest?

The code you posted will only make difference in adding <div class=”first-post”></div> for the first post, so it still displays same information for all posts. Try this instead: <?php $queryObject = new Wp_Query( array( ‘showposts’ => 5, ‘post_type’ => array(‘post’), ‘category_name’ => videos, ‘orderby’ => 1, )); // The Loop if ( $queryObject->have_posts() ) : … Read more

get_posts always returning the same number of posts = 5

get_posts() has some defaults set, including numberposts equal to 5. Since it’s not considered to be a loop by itself those are independent and not affected by admin settings. So simply pass in arguments numberposts/posts_per_page (same thing) number for how many posts you want or -1 for all matching posts.