Passing boolean values with wp_localize_script

Try this: $options = get_option( ‘theme’ ); wp_localize_script( ‘flexslider’, ‘flex_vars’, array ( ‘flex_auto’ => ($options[‘slide-auto’]) ? ‘true’ : ‘false’, ‘flex_animation’ => $options[‘slide-animation’], ‘flex_direction’ => $options[‘slide-direction’] ) ); Assuming slide-auto is the option you made a boolean. This script isn’t tested, I directly typed it in here.

Adding a checkbox to the theme customizer

Checkbox is possible. A example, I hope this help you. At first you must define the setting, via add_setting, important is the param type with value option. After this control the field via add_controland set the param type to checkbox. Alternative it is possible to use select. If I add a default value via std, … Read more

How do I add settings to the Background Options Page?

The page content for custom backgrounds is created in wp-admin/custom-background.php. There is no action available where the fields are printed. To add new fields we have to print JavaScript into the page footer. The action is ‘admin_footer-appearance_page_custom-background’. To save those field values we have to hook into ‘load-appearance_page_custom-background’. The following example adds a new option … Read more

How to Use Checkbox in Custom Option Page Using The Setting API

Have a look at: The Complete Guide To The WordPress Settings API (Part 8: Validation, Sanitisation, and Input II): add_settings_field( ‘Checkbox Element’, ‘Checkbox Element’, ‘sandbox_checkbox_element_callback’, ‘sandbox_theme_input_examples’, ‘input_examples_section’ ); function sandbox_checkbox_element_callback() { $options = get_option( ‘sandbox_theme_input_examples’ ); $html=”<input type=”checkbox” id=”checkbox_example” name=”sandbox_theme_input_examples[checkbox_example]” value=”1″” . checked( 1, $options[‘checkbox_example’], false ) . ‘/>’; $html .= ‘<label for=”checkbox_example”>This is an … Read more

How to Dynamically Resize WordPress Image On-The-Fly (custom field/theme option)

Re-size WordPress images on the fly using built-in WordPress functions. Use the vt_resize function to dynamically re-size WordPress images located in a custom field, featured image, uploads directory, NextGen Gallery WordPress plugin, or even an external link to an offsite image. It is very simple to use, just copy/paste the code below into your WordPress … Read more

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