Custom Recent Post Widget

<?php Class My_Recent_Posts_Widget extends WP_Widget_Recent_Posts { function widget($args, $instance) { extract( $args ); $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Posts') : $instance['title'], $instance, $this->id_base); if( empty( $instance['number'] ) || ! $number = absint( $instance['number'] ) ) $number = 10; $r = new WP_Query( apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', … Continue reading Custom Recent Post Widget

Search Filter by post

/* Search Filter */ if (!is_admin()) { function wpb_search_filter($query) { if ($query->is_search) { $query->set('post_type', 'post'); } return $query; } add_filter('pre_get_posts','wpb_search_filter'); } /* End of Search Filter */

Add class to menu items of one specific menu or Current Menu

add_filter('nav_menu_css_class', 'springhomeshow_add_active_class', 10, 2 ); function springhomeshow_add_active_class($classes, $item) { if( $item->menu_item_parent == 0 && in_array( 'current-menu-item', $classes ) || in_array( 'current-menu-ancestor', $classes ) || in_array( 'current-menu-parent', $classes ) || in_array( 'current_page_parent', $classes ) || in_array( 'current_page_ancestor', $classes ) ) { $classes[] = "current"; } return $classes; }