illegal offset in option add

The array is ‘hidden’ inside the form elements. Their respective name/ID is like MY_option_name[some_other_name]. That is the array structure. // Edit (to elaborate a little on that) Suppose you have the following form: <form action=”options.php” method=”post”> Font:<br /> <input type=”text” name=”MY_options[font]” id=”MY_options[font]” /> Color:<br /> <input type=”text” name=”MY_options[color]” id=”MY_options[color]” /> <?php submit_button(); ?> </form> If … Read more

Fatal error: Call to undefined function get_option()

I don’t see any get_option() function on line 9 or anywhere else in your code. After quick googling, my guess would be that your problem is the same as this question on stackoverflow EDIT As @Ray proposed at the linked question, paste this in your code to check if wp-includes/option.php is included: $includedStuff = get_included_files(); … Read more

Where to adjust presets for slider options “auto rotate” (3, 5, 10, 15 seconds)? [closed]

In anybody needs this in the future I found a quick and easy workaround: you could just adjust the slider interval in the shortcode. First you have to switch to the “classic mode” (turn the Visual Composer off) and then find the shortcode that defines the interval: [vc_gallery interval=”10″ images=”22390,23006″ img_size=”full”] You can then set … Read more

Using get_option() for check box field

This may not exactly answer the question, but let’s see the issues with your code: If you want to save the data in the same format as the default value ($fields_default), then: Start your foreach like so: foreach ( $orderdescider as $i => $item ). Then inside that foreach, $id and $checkbox should always be … Read more

selecting options from another form

In the following line: $select_branch = $wpdb->get_results($wpdb->prepare(“SELECT * FROM $table_name”));, you are using $wpdb->prepareincorrectly. wpdb::prepare needs two arguments, first one is a Query string with sprintf like placeholders and second an array of the values to to substitute the placeholders. More details here. And that is the error you are getting as posted on top … Read more

Integrating CSS Into a WP Function Call [closed]

Apart from the fact, that the conditional is based on a WordPress option, this is pure PHP, but anyhoo: <?php $show_views = get_option( ‘to_post_views’ ); if ( ‘Yes’ === $show_views ) { echo ‘<div class=”postviews”>’ . getPostViews( get_the_ID() ) . ‘</div>’; } ?>

Pull Random Images From Options Page [closed]

There’s nothing WordPress-specific about this, just some simple php: // generate an array of numbers $numbers = range( 1, 8 ); // shuffle the array in random order shuffle( $numbers ); // use the first 4 values from the randomized array of numbers echo eh_get_option( ‘eh_slide_image_’ . $numbers[0] ); echo eh_get_option( ‘eh_slide_image_’ . $numbers[1] ); … Read more

I don’t have permission to save the theme options I created myself?

You’re adding the menu page using the “administrator” role. Is the account you’re using an administrator? Note: 1) You should be using an appropriate capability, rather than a user role. Generally, the appropriate capability for editing Theme options is edit_theme_options. 2) There is a known bug with WordPress, in that currently, manage_options is required for … Read more