• I am aware that there is a plugin for this, but it’s not 2.2 compatible yet and regardless it seems funny to me that you can’t duplicate instances of widgets by default.

    Especially in the case of someone who has multiple sidebars (eg I would like to have the search widget available on all my sidebars).

    Is there something I’m missing out on, or is it currently not possible?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter alexleonard

    (@alexleonard)

    I might have answered my own question on this one.. taking lead from the default text widget bundled in widgets.php I noticed the “How many text widgets would you like?” question.

    So I suppose it is just down to me creating/editing current widgets using:

    function wp_widget_text_page() {
    	$options = $newoptions = get_option('widget_text');
    ?>
    	<div class="wrap">
    		<form method="POST">
    			<h2><?php _e('Text Widgets'); ?></h2>
    			<p style="line-height: 30px;"><?php _e('How many text widgets would you like?'); ?>
    			<select id="text-number" name="text-number" value="<?php echo $options['number']; ?>">
    <?php for ( $i = 1; $i < 10; ++$i ) echo "<option value='$i' ".($options['number']==$i ? "selected='selected'" : '').">$i</option>"; ?>
    			</select>
    			<span class="submit"><input type="submit" name="text-number-submit" id="text-number-submit" value="<?php echo attribute_escape(__('Save')); ?>" /></span></p>
    		</form>
    	</div>
    <?php
    }

    and a little more…!

    Still it seems like a lot of coding, I wonder is this something that couldn’t be built in by default. Instead of people having to work out their for loops etc ??

    I agree, I think I can figure it out using the current system, but WordPress should have built-in functionality to easily let users have multiple instances of any widget, and there should be a simple way for developers to take advantage of this.

    Can we get this into the next release please!

    Thread Starter alexleonard

    (@alexleonard)

    I’ve actually temporarily given up on widgets altogether. I found that it was taking me far too long to get them working, when I could quickly just set up a few lines of code in my sidebar instead.

    My main problem has been that there is no error reporting. All I get from Word Press is a message saying that the plugin can’t be activated. If only they had a developer mode that reported php/mysql errors. That would make life a little easier.

    alexleonard,

    I haven’t had any real trouble working with widgets yet (and I’ve done a few now), but I’m mostly just ‘wigitizing’ old features. In that case, it’s pretty simple.

    So for you, I’d suggest doing the hard work of developing your functionality when your tool is still just a regular old plugin working in the sidebar, and once you’ve got it working well, it’s a piece of cake to just dump it in a widget. That way, you get the best of both.

    Thread Starter alexleonard

    (@alexleonard)

    I have gotten the feeling in the last few days that I really need to learn more about PHP.. I just don’t think I fully understand it yet.

    I’m self taught and have generally just been using it for useful tweaks and templating.

    I’m so used to being corrected by the system telling me what line I’ve made an error on, and when the plugin fails to activate I feel a little like a blind child stumbling around in a dark forest…. well, maybe it’s not that bad, but you know what I mean.

    I can definitely see that Widgets make way more sense from the point of view of reusable code, easier adjustments in the future, and the option of letting non-coders change their sidebars easily. I think I just have a bit of a way to go yet. Time to talk to zend?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Duplicate Widgets’ is closed to new replies.