Adding active/current class to get_terms list

Run a conditional check in the foreach loop using is_category($term-name) Assign a class variable to active if it’s the same as $term->name $terms = get_terms( ‘category’ ); echo ‘<ul>’; foreach ( $terms as $term ) { $class = ( is_category( $term->name ) ) ? ‘active’ : ”; // assign this class if we’re on the … Read more

Get List of all the Authors

You can display author’s list by using function wp_list_authors for more info : http://codex.wordpress.org/Function_Reference/wp_list_authors And for author Template Hierarchy see below link http://codex.wordpress.org/Author_Templates

When would you use $_post instead of $post?

I’m not certain, but if you’re talking about $_post as seen here: http://codex.wordpress.org/Function_Reference/in_category It’s referring to a post ID so they’ve probably added the underscore to avoid confusion. The $post variable is a post object with all the details of the post. However, $_POST is a global PHP variable containing all the values sent from … Read more

wordpress simple loop, huge issues

Add wp_reset_query(); after your loop to prevent other loops on the page (for example, the navigation) to break. <?php query_posts( array ( ‘category_name’ => ‘left_sidebar’, ‘posts_per_page’ => 4, ‘orderby=menu_order’ ) ); if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <li><a href=”https://wordpress.stackexchange.com/questions/84336/<?php the_permalink(); ?>”><?php the_title(); ?></a></li> <?php endwhile; endif; wp_reset_query(); // reset … Read more

How to limit total number of posts in wp query loop?

You can use the found_posts filter to alter the number of posts WordPress reports finding from a query. add_filter( ‘found_posts’, ‘wpd_found_posts’, 10, 2 ); function wpd_found_posts( $found_posts, $query ) { if ( $query->is_home() && $query->is_main_query() ) { return 25; } }

Replace default WordPress search behavior with Sphinx

The Sphinx Search website lists three wordpress plugins on its Plugin Page. Maybe one (or more) of them does what you want? Voce Connect. WordPress Plugin. Ivinco. WordPress Plugin. Gigaom. WordPress Plugin. Filters WordPress’ core WP Query to allow interoperability with and improve performance of other plugins and existing queries, including core taxonomy queries.