Multiple selection for wordpress widget

Hi why don’t you used multiple check-box instead of select option field. As well as you have used deprecated functions like “create_function”. I have modified your code which replaced select option with multiple check-box selection. function myCatWidget() { register_widget( ‘my_custom_cat_widget’ ); } add_action( ‘widgets_init’, ‘myCatWidget’ ); class my_custom_cat_widget extends WP_Widget { function __construct() { parent::__construct(‘my_custom_cat_widget’, … 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

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

Why can’t I return a value from $wpdb->get var?

get_results() by default returns each databse row as object, so $survey_mapping is an array of objects. Therefore you should replace $row with $row->surveyid in the second query: $dup_survey2 = absint( $wpdb->get_var( $wpdb->prepare(“SELECT surveyls_survey_id FROM oc_surveys_languagesettings WHERE surveyls_survey_id = %d”, $row->surveyid) )); and in $wpdb->delete(): array(‘surveyid’ => absint($row->surveyid)) By the way, you can use a single … Read more

Multiple Custom Taxonomy Dropdowns Lists

The “dropdown” element declared and used in each of these functions is the same, so the last one is overriding all previous. Specifying different terms each time fixes the problem: var writerdropdown = document.getElementById(“writers”); function onWriterChange() { if ( writerdropdown.options[writerdropdown.selectedIndex].value != -1 ) { location.href = “<?php echo home_url();?>/writer/”+writerdropdown.options[writerdropdown.selectedIndex].value+”/”; } } writerdropdown.onchange = onWriterChange; var … Read more