ThemeShaper Forums » ThemeShaper WordPress Themes

[closed]

Widgets disappearing ?

(18 posts)
  • Started 5 years ago by journeyer
  • Latest reply from jonnycj
  • This topic is resolved
  1. journeyer
    Member

    Hi,

    Themeshaper is great and also Ian's series of explanations about creating child themes is brilliant. I have one problem though, I was using a theme earlier which was using some sidebar widgets. But all of them disappear when I use themeshaper (actually a child theme of it). If I use other theme, they reappear (e.g. Tarski).

    Is the treatment of widgets different somehow from the "standard way" ?

    Thanks!

    Posted 5 years ago #
  2. Jamie Mitchell
    Member

    not that i know of, i was building themes before i discovered thematic, and looking in thematic it registers the sidebar and widgets the same way as i used to do them...

    have you tried testing the wp default widgets to see if they work.

    Posted 5 years ago #
  3. journeyer
    Member

    Don't know what you mean by that Jamie. The widgets appear when I use sandbox theme or Tarski theme. But they go away in Thematic's child theme (or even the Thematic base theme)

    Posted 5 years ago #
  4. Hi,

    this is a 'feature' :-)

    .. let me explain a bit. Normally the theme developers register the sidebars dynamically. This means that WP uses numbers to identify a sidebar. There are certain plugins that register a hidden sidebar with the id 0. In this case all widgets registered to the sidebars will be moved up one sidebar id. So you have to reorder everything again.

    We implemented something like static sidebars using the sidebar name for the id. This will prevent the afore mentioned effect. But you can't switch themes like before keeping the widgets registered to a certain numeric id.

    Anyway .. WP 2.8 will change the whole thing. As far as I can remember it'll de-register all widgets while changing themes.

    There's one major reason for this. Imagine you run a theme with 6 sidebars all equipped with widgets. Now you're going to change the theme to something with only 4 sidebars. In this case all non-multiple widgets connected to the 5th and the 6th sidebar from the older theme are gone / blocked.

    You can only switch back to the old theme, manually de-register the widgets from the higher sidebars, switch back to the new theme, register the widgets to the available sidebars ... not funny .. this is why we have a 'Reset Widgets' button.

    Hope this helps.

    Cheers,

    Chris

    Posted 5 years ago #
  5. Is there a way to save widgets so they remain the same across Themeatic child themes?

    I am trying to show a client 2 possible designs, using 2 different Thematic child themes. Every time I switch between the 2, I have to re-create the sidebars manually (drag and drop.)

    I am using WidgetLogic and am wondering if this is responsible for widgets disappearing when changing between Thematic child themes.

    Can anyone help make Widgets "sticky" between Thematic children?

    Posted 4 years ago #
  6. Hi bluejpro,

    I feel your pain on this one ther has been some effort to try and deal with this in a better way. Until that is worked out you could edit Thematic's thematic_widgets_init() function which can be found in thematic/extensions/widgets-extensions.php

    search for :

    if ( isset( $_GET['activated'] ) ) {
      		update_option( 'sidebars_widgets', apply_filters('thematic_preset_widgets',$preset_widgets ));
      	}

    and replace with :

    if ( isset( $_GET['activated'] ) && get_bloginfo( 'stylesheet_directory', FALSE ) == get_bloginfo( 'template_directory', FALSE ) ) {
    		update_option( 'sidebars_widgets',
    		apply_filters('thematic_preset_widgets',$preset_widgets ));
    	}

    - Gene

    Posted 4 years ago #
  7. Just wondering: how would I go about defining which widgets are to be registered as default in a given childtheme? and given that some widgets might be parts of plugins - do you have to perform a check to see if these plugins are activated to avoid error messages?

    Posted 4 years ago #
  8. peterhol,

    As far as changing the preset widgets for your child theme look here:
    http://forums.themeshaper.com/topic/how-do-i-set-the-default-widgets-in-my-child-theme
    and if you're needing to presewt a widget supplied by a plugin you could use function_exists to test for a function specific to the plugin before adding it's widget to the array.

    -Gene

    Posted 4 years ago #
  9. @em_hr those lines are different in 0.9.7.7

    This still happens in switching between thematic family themes there is a call to thematic_presetwidgets how would you modify this now or is there another fix more suitable

    I'm using WP 3.0.1

    Posted 4 years ago #
  10. Yeah, this is an accepted behavior at this point.

    Try using this plugin: http://wordpress.org/extend/plugins/widget-saver/

    -Gene

    Posted 4 years ago #
  11. Just found that in another thread you are in.

    I think there should be a (moderated) forum area or a sticky thread listing resources such as this and other things such as the w3schools colorpicker etc.

    Posted 4 years ago #
  12. DavyB,

    Try here:

    http://forums.themeshaper.com/topic/useful-tools

    Posted 4 years ago #
  13. jonnycj
    Member

    Is there any update on this issue ?

    I am developing a site using Thematic and a child theme. I have created four custom widget areas which all work fine. Then the widget areas disappear because the widgets have been reset back to the Thematic default. The widget panel stores the content of my widget areas in unused widgets but I have to manually restore them. This is NOT happening because I am switching between themes (I have not) and does not appear to be related to any plugins that are running (all deactivated).

    An example of my code is here:

    function luminal_abovecont_aside_one() {
    register_sidebar(array(
    'name' => 'First Above Container Aside',
    'id' => 'abovecont-aside-one',
    'description' => __('A widget area in the main div, aligned left above the content.', 'luminal'),
    'before_widget' => thematic_before_widget(),
    'after_widget' => thematic_after_widget(),
    'before_title' => thematic_before_title(),
    'after_title' => thematic_after_title(), )
    );
    }
    add_action('init', 'luminal_abovecont_aside_one');

    // Add above container aside 1
    function add_luminal_abovecont_aside_one() {
    if (is_sidebar_active('abovecont-aside-one')) {
    echo thematic_before_widget_area('abovecont-aside-one');
    dynamic_sidebar('abovecont-aside-one');
    echo thematic_after_widget_area('abovecont-aside-one');
    }
    }
    add_action('thematic_abovecontainer','add_luminal_abovecont_aside_one', 10);

    Is this related to sidebar identifiers ?
    Is it related to priority order ?
    Do I have to use 'Helga's method' ?

    Any help greatly appreciated

    Posted 3 years ago #
  14. jonnycj
    Member

    Ok - so I have discovered that even clicking on 'Appearance' in the Admin Panel, which takes you to the Themes page by default, is enough to kick off my widgets and reset them to the Thematic default. You do not have to switch themes therefore to recreate this behaviour.

    Not really a great state of affairs !

    Anyway I have used the code graciously provided by Gene above (thanks Gene !) and this works a treat.
    Just have to remember to add it back in whenever I update Thematic, unless the issue gets sorted first....

    Posted 3 years ago #
  15. i don't follow: "Then the widget areas disappear because the widgets have been reset back to the Thematic default."

    the widget AREAS disappear? in the backend the new areas you've registered go away? if so, what steps do you take to see this happen?

    please describe your problem in more detail b/c the only time i have the thematic default widgets appear is when i activate my theme.. which is standard behavior unless I define my own default widgets which you can do using:

    function preset_child_widgets() {
    	$child_preset_widgets = array (
    		'primary-aside'  => array( ),
    	);
    return $child_preset_widgets;
    }
    add_filter('thematic_preset_widgets','preset_child_widgets' );
    Posted 3 years ago #
  16. jonnycj
    Member

    sorry Helga, what I meant was the widgets themselves are reset to the Thematic default, therefore my new custom widget areas disappear from the front-end because they have no content (no active widget inside them).
    My custom widget areas remain defined and available in the 'Widgets' admin panel, and the widgets that were displaced from these widget areas are available in the 'Inactive widgets' area.
    Until I added the code provided by Gene (above) the widgets were reset every time I even clicked on Appearance. So as I say above even clicking on 'Appearance' in the Admin Panel, which takes you to the Themes page by default, was enough to kick off my widgets and reset them to the Thematic default. You do not have to switch themes to recreate this behaviour.
    I like the idea of registering my preset child widgets using your code. Given I have four custom widget areas, (plus I am making use of 'primary aside, secondary aside, 1st, 2nd & 3rd subsidiary asides) how do I apply your function preset_child_widgets above ?

    and thanks for your input !

    Posted 3 years ago #
  17. ok i understand your problem better now, but am baffled by it. i've never experienced this problem. i might try reinstalled thematic and then clearing out your functions.php to see if you are still experiencing this.

    then add the pieces back into functions.php until you find what is causing the problem.

    i think you'd expand the above snippet like this... with the widget names in the arrays

    function preset_child_widgets() {
    	$child_preset_widgets = array (
    		'primary-aside'  => array('search' ),
                    'secondary-aside'  => array( ),
                    'header-aside'  => array( ),
    	);
    return $child_preset_widgets;
    }
    add_filter('thematic_preset_widgets','preset_child_widgets' );
    Posted 3 years ago #
  18. jonnycj
    Member

    thanks Helga for being so generous with your time - I will give it a go :-)

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.