316 posts
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Has been part of the Envato Community for over 3 years
+2 more
SyamilMJ says

If I’m not mistaken WP will keep the widgets from the last theme as long as the ‘id’ is not used by another theme you’re activating. You don’t need 3.3 for this functionality.

You can’t however ‘export’ your current widgets onto another sidebar with different id’s on another theme, if that makes sense.

3256 posts
  • Has referred 100+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+9 more
ParkerAndKent says
FamousThemes said
Just downloaded the Wordpress 3.3 beta 4 and tested.

And things seems to be amazing.

I have the default theme installed with his custom widgets and areas. Then I deactivate it, activate a custom premium theme, setup his own widgets in his own areas.

And then activate again the old theme, and all his widgets are keeped. Also reactivating again the premium theme he got his own widgets keeped in his own areas.

PK: It seems that things are working also for premium themes, and custom widgets. You where not sure about this one :P

So my question finally have a solution :) I am so happy I will continue with the work I have done.

Cheers.

Well, I guess that’s already possible without the need of WP 3 .3 (but with the presence of particular conditions)... if you deactivate a theme and then reactivate it the widgets should be kept in their position.

What I was saying is that if you install a premium theme and use all its widgets and then you activate another theme, you will never be able to use the widgets you were using on the previous theme on the new one.

For my understanding this is not what you meant, unless your goal was to keep widgets when switching themes to try them… otherwise I don’t see any useful usage of this.

I’m still sure about what I say :)

152 posts Get in the spotlight
  • Has been part of the Envato Community for over 4 years
  • Has sold $250,000+ on Envato Market
  • Had an item featured in an Envato Bundle
  • Has collected 10+ items on Envato Market
+6 more
FamousThemes says
Well, I guess that’s already possible without the need of WP 3 .3 (but with the presence of particular conditions)... if you deactivate a theme and then reactivate it the widgets should be kept in their position.

What I was saying is that if you install a premium theme and use all its widgets and then you activate another theme, you will never be able to use the widgets you were using on the previous theme on the new one.

For my understanding this is not what you meant, unless your goal was to keep widgets when switching themes to try them… otherwise I don’t see any useful usage of this.

I’m still sure about what I say :)

Oh, I think we have understood 2 different things.

Yes you are right and sure about :) “What I was saying is that if you install a premium theme and use all its widgets and then you activate another theme, you will never be able to use the widgets you were using on the previous theme on the new one.”

And yes my goal is to keep widgets when switching themes.

Cheers.

152 posts Get in the spotlight
  • Has been part of the Envato Community for over 4 years
  • Has sold $250,000+ on Envato Market
  • Had an item featured in an Envato Bundle
  • Has collected 10+ items on Envato Market
+6 more
FamousThemes says
sy4mil said
You don’t need 3.3 for this functionality.
But they announce this will be an option available in WP 3 .3 just a couple of days ago. http://wordpress.org/news/2011/11/wherefore-art-thou-widgets/

I have tested with 3.2 and things didn’t work the way I wanted.

Anyway, thing are going great with the new version, and this is what is important :)

Thanks.

3256 posts
  • Has referred 100+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+9 more
ParkerAndKent says
FamousThemes said
Well, I guess that’s already possible without the need of WP 3 .3 (but with the presence of particular conditions)... if you deactivate a theme and then reactivate it the widgets should be kept in their position.

What I was saying is that if you install a premium theme and use all its widgets and then you activate another theme, you will never be able to use the widgets you were using on the previous theme on the new one.

For my understanding this is not what you meant, unless your goal was to keep widgets when switching themes to try them… otherwise I don’t see any useful usage of this.

I’m still sure about what I say :)

Oh, I think we have understood 2 different things.

Yes you are right and sure about :) “What I was saying is that if you install a premium theme and use all its widgets and then you activate another theme, you will never be able to use the widgets you were using on the previous theme on the new one.”

And yes my goal is to keep widgets when switching themes.

Cheers.

Ok :)

In any case consider that widgets locations and widgets contents are saved into 2 db options, being 2 simple multidimensional arrays.

In fact, for my themes, I simply bundle these 2 options with my theme options to activate all the widgets of the preview when my users install the demo contents, otherwise by only importing the WordPress WXR file all the widgets would be missing.

Again, also if the widgets can be kept when swtching and reactivating the old theme, in some cases this can fail… both for sidebars and widgets ids conflicts… if you use WP 3 .3 or not, this can always happen.

A safe option for authors and in general is always to add an unique namespace to sidebars and widgets when registering them, just to avoid conflicts with other themes…

Parker

152 posts Get in the spotlight
  • Has been part of the Envato Community for over 4 years
  • Has sold $250,000+ on Envato Market
  • Had an item featured in an Envato Bundle
  • Has collected 10+ items on Envato Market
+6 more
FamousThemes says

I understand,

Thanks for this explanations Parker, I really appreciate it.

3256 posts
  • Has referred 100+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+9 more
ParkerAndKent says
FamousThemes said
I understand, Thanks for this explanations Parker, I really appreciate it.

You’re welcome. If you look at the options table of the WP db, you’ll find these options:

'sidebars_widgets',
'widget_text',
'widget_tag_cloud',
'widget_search',
'widget_rss',
'widget_recent-posts',
'widget_recent-comments',
'widget_pages',
'widget_nav_menu',
'widget_meta',
'widget_links',
'widget_categories',
'widget_calendar',
'widget_archives'

The sidebars_widgets option saves all the sidebars registered. Then, each widget option saves all the settings and content of each widget of that type.

Additionally, if you register custom widgets, you’ll find an option for each of them, named with the id of the registered widget.

Now, knowing this, you could for example save all these options somewhere on deactivation and restore them on activation.

Playing with hooks you can do almost everything you need. I use to save all these options in a multidimensional array (in conjunction with the theme options) that I then put in a custom global option… then when needed I use it to restore all the widgets and all the other data I might need (eg for demo contents).

Parker

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by