Can’t save widget

Thank you all. I just took code from codex, I’ve changed id footerBoxOne to footer-box-1 for all four widgets, and it’s working now. I guess uppercase chars were the problem

How to allow editing of text in sidebar?

There are two ways to see it: Sidebar as a general area of site layout Sidebar as container, filled with WordPress widgets Or maybe combination of the two. The prime reason to use WordPress widgets is that they provide roughly consistent experience, can be easily used multiple times, and can be enhanced with related functionality … Read more

Widget background images missing on second blog excerpt page

If you look at your browser’s error console, you’ll see the 404 errors for your background images, which will point to where the issue is. This URL: ../wp-content/themes/themename/images/cat-party.jpg basically says, “go up one directory from the current directory, then from there look in wp-content, then themes, then images, etc..”. That works fine on the front … Read more

How to save widget settings on field value change?

You’re going to want to use AJAX for this. WordPress provides resources for connecting JS to PHP callbacks which is outlined in detail in the Codex. Basically, you’ll want to take the following steps: Attach a handler to the first category select box using the .change() jQuery method. Use an AJAX function to post that … Read more

Output column number according to active sidebars

Use the array_filter() function, which will remove every array element that has false as the value. Then you can count the array length. So your example would look like this: $sidebars = array( is_active_sidebar( ‘footer-4’ ), is_active_sidebar( ‘footer-3’ ), is_active_sidebar( ‘footer-2’ ), is_active_sidebar( ‘footer-1’ ), ); $active_sidebars = array_filter($sidebars); echo ‘col-‘.count($active_sidebars);

Making jQuery .change() event persistent after widget save

The form reloads itself each time you save returning to the initial state where all are shown. What you can do is this: // Getting the value of the selected field var my_select_value = $(‘#widgets-right select.my-select’).val(); // If there’s no value selected, hide everything. if(my_select_value == 0){ $(‘.widget-test .row’).hide(); } // Otherwise, show the specific … Read more

WordPress Widget Not Saving Instance

The problem is your update function. $old_instance is kind of special variable. The simplest is function update($new_instance, $old_instance) { return $new_instance; } For the safe function update($new_instance, $old_instance) { $instance = array(); $instance[‘name’] = htmlentities($new_instance[‘name’]); $instance[‘divclass’] = htmlentities($new_instance[‘divclass’]); $instance[‘paypal’] = htmlentities($new_instance[‘paypal’]); return $instance; }