theme customizer – can a single option pass multiple values?

I understand what you are trying to do, but you are going in the wrong direction here, you can just check if one was selected in your logic and assign the value there like this: function css_customizer(){ $blog_setting_val = get_theme_mod(‘blog_setting’); $opacity_val = ($blog_setting_val == ‘block’) ? ‘1’ : ‘0’; ?> <style type=”text/css”> .blog__Link{display: <?php echo … Read more

What’s the proper way to sanitize checkbox value sent to the database

I would use the filter_var() function. It has some predefined filters that you can use depending on what kind of data you are expecting such as string, number, etc. So to sanitize for a number: $sanitizedNum = filter_var($yourVar, FILTER_SANITIZE_NUMBER_INT); For a string you would just change “_NUM_INT” to “_STRING”. Wrap those in a custom function … Read more

show/hide div with simple jQuery script [closed]

Most likely, the cause of your problem is that jQuery is in compatibility mode. This means that you can’t use the ‘$’ shortcode. To get your Javascript code to work, replace all ‘$’ with ‘jQuery’ Or, wrap your code in an anonymous function, like this: jQuery(document).ready(function( $ ) { // Put your jQuery code here. … Read more

Click a radio button must set textfield value

There many approach for your js part on input, and you were correct, but we can’t disccuss a lot about it here. And a part for your question related to WordPress, yes you are right. You can use wp_enqueue_scripts to enqueue your js function inside js file, remember to use get_stylesheet_directory_uri as part url of … Read more

Foreach loop not working as expected – custom tables and references while submitting a form

So the first part of your question is just how to get the contents of wp_redskaber into radio buttons. As you’ve attempted, use $wpdb->get_results(); to query the table. By default each row will be an Object, so you’d output it like this: global $wpdb; $results = $wpdb->get_results( “SELECT * FROM wp_redskaber” ); foreach ( $results … Read more