wp_dropdown_categories – how to save in widget?

You didn’t add the dropdown/select name attribute, that’s why it’s not working as expected. Please try updating your $dropdown_args, here’s the updated arguments – $dropdown_args = array( ‘taxonomy’ => ‘cs_categories’, ‘id’ => $this->get_field_id( ‘cs-category’ ), ‘name’ => $this->get_field_name( ‘cs-category’ ), // Added this line ‘show_option_none’ => __( ‘Select category’, ‘text-domain’ ), ‘hide_empty’ => true, ‘hierarchical’ … Read more

Sorting dynamic select/dropdown for Contact Form 7 of Modern Tribe Events posts

For any poor soul out there that stumbles on the same, niche problem, the answer was frustratingly simple. Instead of trying to reinvent the wheel and build my own query, I should’ve been using the tribe_get_events function that I’m sure the Modern Tribe devs already worked hard to write. Anyway, here’s the final solution for … Read more

HTML dropdown setting not showing last saved value in the database

The problem is this: selected(get_option(‘lp_actPage’, $slug)) selected needs 2 parameters, but you gave it 1, and get_option wants 1 parameter but you gave it 2. If we reformat this, the problem becomes much clearer: selected( get_option(‘lp_actPage’, $slug) ) What’s necessary is: selected( get_option(‘lp_actPage’) $slug ) Sidenote get_pages doesn’t use the normal post querying code, and … Read more

Bootstrap drop down Navigation Menu in WordPress

You will want to extend the Walker_Nav_Menu class. This allows you to “walk” through the various states of a navigation menu. One of the first google searches I did for the term Walker_Nav_Menu led me to this Github repo with a class already built. wp-bootstrap-navwalker.

Convert UL to dropdown list not working

@CharlieJustUs when you use Fiddle is automatically sets the $ variable for you. When your script tries to run on your site, that variable is not set, and it fails. Try this please. jQuery(document).ready(function($) { $(function() { $(‘ul.clearfix’).each(function() { var $select = $(‘<select class=”dropdown-toggle” />’); $(this).find(‘a’).each(function() { var $option = $(‘<option />’); $option.attr(‘value’, $(this).attr(‘href’)).html($(this).html()); $select.append($option); … Read more

Use a filter on menu items that have children

There is indeed a filter, walker_nav_menu_start_el will be able to handle it for you! Take this code for example: function wpse356896_filter_primary_nav_menu_dropdown( $item_output, $item, $depth, $args ) { // Only for our primary menu location. if ( empty( $args->theme_location ) || ‘primary-menu’ !== $args->theme_location ) { return $item_output; } // Add the dropdown for items that … Read more

Modify output of wp_dropdown_categories to add term IDs to each option

get_terms ended up bring a more customizable solution which is working for my needs. I was able to easily add the term IDs to each option as needed. Hope this helps someone else. <div class=”location-cats-dropdown”> <form id=”location-category-select” class=”location-category-select” method=”get”> <?php $loc_cats = get_terms( array( ‘taxonomy’ => ‘location_category’, ‘hide_empty’ => true, ‘orderby’ => ‘menu_order’, ‘order’ => … Read more

wp_list_categories walker without links on categories that have subcategories (to make a nested dropdown menu)

If you say the wp_list_categories output format is ok to you and all you need is only to remove the links from parent categories, try the following code (you can add it to your functions.php): add_filter( ‘wp_list_categories’, ‘sanitize_list_categories_links’, 10, 2 ); function sanitize_list_categories_links( $list, $args ) { if ( isset( $args[‘sanitize_links’] ) && $args[‘sanitize_links’] ) … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)