308 posts
  • Attended a Community Meetup
  • Sold between 10 000 and 50 000 dollars
  • Exclusive Author
  • Bought between 10 and 49 items
  • Has been a member for 2-3 years
  • Referred between 10 and 49 users
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
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Interviewed on the Envato Notes blog
  • Beta Tester
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
+4 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 :)

137 posts Get in the spotlight
  • Author had a File in an Envato Bundle
  • Bought between 1 and 9 items
  • Elite Author
  • Europe
  • Exclusive Author
  • Halloween Competition Winner
  • Has been a member for 4-5 years
  • Most Wanted Bounty Winner
+2 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.

137 posts Get in the spotlight
  • Author had a File in an Envato Bundle
  • Bought between 1 and 9 items
  • Elite Author
  • Europe
  • Exclusive Author
  • Halloween Competition Winner
  • Has been a member for 4-5 years
  • Most Wanted Bounty Winner
+2 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
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Interviewed on the Envato Notes blog
  • Beta Tester
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
+4 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

137 posts Get in the spotlight
  • Author had a File in an Envato Bundle
  • Bought between 1 and 9 items
  • Elite Author
  • Europe
  • Exclusive Author
  • Halloween Competition Winner
  • Has been a member for 4-5 years
  • Most Wanted Bounty Winner
+2 more
FamousThemes says

I understand,

Thanks for this explanations Parker, I really appreciate it.

3256 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Interviewed on the Envato Notes blog
  • Beta Tester
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
+4 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

by
by
by
by
by
by