Pagination on category.php and tag.php not working

If you merely want to modify posts_per_page for tag and category archive index pages, don’t use query_posts(); instead, filter the $query via pre_get_posts: function wpse87489_filter_pre_get_posts( $query ) { if ( ( is_category() || is_tag() ) && $query->is_main_query ) { $query->set( ‘posts_per_page’, ‘2’ ); } } add_action( ‘pre_get_posts’, ‘wpse87489_filter_pre_get_posts’ );

Specify strict ‘order by’ in WordPress query

You could use usort(). Your callback function would need to determine the last names and sort by them. So, for instance: $args = array( ‘post_type’ = ‘Employees’, ); $employees = get_posts( $args ); usort( $employees, ‘wp91501_sort_employees’ ); and then your callback might be: function wp91501_sort_employees( $a, $b ) { // split the names into arrays … Read more

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