Adding an onchange event to a custom dropdown menu in WordPress

I have added a wrapper to your html output and then written a jQuery code that you can use – function embed_url() { $dropdown_menu = ‘<select><option>OptionDefault</option><option value=”?id=1″>Option1<option value=”?id=2″>Option2</option></select>’; $full_url=”<object type=”text/html” data=” . $embed_this_url . ‘ style=”width:100%; height:100%”><p> URL could not be loaded. </p> </object>’; return ‘<div class=”site-url”>’ . $dropdown_menu . $full_url . ‘</div>’; } jQuery … Read more

‘Dehighlighting’ navigation once clicked

You’re removing the current menu item, and current menu page, however your CSS refers to these: .site-navigation li .current_page_item > a, .site-navigation li .current_page_ancestor > a, .site-navigation li .current-menu-item > a, .site-navigation li .current-menu-ancestor > a .current_page_ancestor and .current-menu-ancestor are not handled by your javascript, but they are styled, hence your problem. You will need … Read more

Need to hide an element depending on date and post category

Drop this into the file that is displaying the date (assuming you are using get_the_date): $month = date( ‘F’ ); $categoryIds = array(); $bannedMonth=”September”; $bannedCategory = 13; $categoryArray = get_the_category(); foreach ( $categoryArray as $categoryObj ) { array_push( $categoryIds, $categoryObj->term_id ); } if ( $month != $bannedMonth && !in_array( $bannedCategory, $categoryIds ) ) { echo … Read more

How to deregister scripts all at once

Its already answered on this link <?php //To remove all script from the page function remove_all_scripts() { global $wp_scripts; $wp_scripts->queue = array(); } // to remove all stylesheet add_action(‘wp_print_scripts’, ‘remove_all_scripts’, 100); function remove_all_styles() { global $wp_styles; $wp_styles->queue = array(); } add_action(‘wp_print_styles’, ‘remove_all_styles’, 100); ?> It will remove all the scripts enqueued by standard method. Manual … Read more