Swapping wp_dropdown_categories function with wp_category_checklist

As you are not working with the default categories but with another taxonomy instead you must not use wp_category_checklist(). Instead you should probably be using the more generic wp terms checklist(). The signature of this function also differs from the one of wp_dropdown_categories(). And the arguments array takes completely different options. You shlould start with … Read more

Use menu link or onClick to set a variable

By this you can pass the value using ajax, you have fetch value from $_POST in your php script jQuery(document).ready(function(){ jQuery(‘.dayLink a’).click(function(){ var li_id = jQuery(this).closest(‘.dayLink’).attr(‘id’); jQuery.ajax({ url: ‘url_to_php_script’, data: {dayValue: li_id,action:call_to_ajax}, method: ‘POST’, success: function(res){ console.log(res); } }) }); }); The closing brackets were out of order. <?php if(isset($_GET[‘li_id’])){ $test = $_GET[‘li_id’]; echo $test; … Read more

How to insert custom widget in custom sidebar in theme activation?

but we have to change some little things if we want this when theme is activated.Changs maded done inside function awesome_register_sidebars.Add below code inside in your theme functions.php file: function awesome_register_sidebars() { $sidebars = array ( ‘a’ => ‘sidebar-footer-1’, ‘b’ => ‘sidebar- footer-2′,’c’=>’sidebar-footer-3’ ); foreach ($sidebars as $sidebar) { register_sidebar( array ( ‘name’ => $sidebar, … Read more

Previous_post and Next_post – Custom Post Type

You want to change the in_same_term value to TRUE as follows: function crunchify_post_navigation(){ ?> <div class=”arrowNav”> <div class=”arrowLeft”> <?php previous_post_link(‘%link’, ‘&#8606;’, TRUE); ?> </div> <div class=”arrowRight”> <?php next_post_link(‘%link’, ‘&#8608;’, TRUE); ?> </div> </div> <?php } add_action(‘wp_footer’, ‘crunchify_post_navigation’);

Why does the ‘wp_nav_menu’ function work only until a menu is created?

This is due to the wp_nav_menu parameter fallback_cb: If the menu doesn’t exist, a callback function will fire. Default is ‘wp_page_menu’. Set to false for no fallback. You have not specified an alternative, so it uses the default, wp_page_menu. You could create your own function to display a page menu with the proper markup, or … Read more

Menu — How to add “current-menu-grand-ancestor” css class

Something like this will help you filter a menu item and add a custom class conditionally. ( Untested ) function add_nav_class( $classes ) { if ( class_exists( ‘current-menu-ancestor’ ) || $item->title == ‘blog’ ) { $classes[] = ‘current-menu-grand-ancestor’; } return $classes; } add_filter( ‘nav_menu_css_class’, ‘add_nav_class’, 10, 2 );

custom post type not showing in menu

// portfolio code function codenovo_portfolio_init(){ $labels = array( ‘name’ => _x(‘Portfolio’, ‘post type general name’), ‘singular_name’ => _x(‘Portfolio’, ‘post type singular name’), ‘add_new’ => _x(‘Add New’, ‘portfolio’), ‘add_new_item’ => __(‘Add New Portfolio’), ‘edit_item’ => __(‘Edit Portfolio’), ‘new_item’ => __(‘New Portfolio’), ‘view_item’ => __(‘View Portfolio’), ‘search_items’ => __(‘Search Portfolio’), ‘not_found’ => __(‘No portfolio found’), ‘not_found_in_trash’ => … Read more