WordPress.org

Ready to get started?Download WordPress

Forums

amr shortcode any widget
[resolved] Sidebar and Widget Problems - any capitals in sidebar id? (13 posts)

  1. anmari
    Member
    Plugin Author

    Posted 6 months ago #

    Hi all,

    I see a number of posts related to sidebars impacted by latest update. Update was tested on the last 4 wordpress 'twenty' themes with all their different sidebars, including updating from prior releases. Plugin HAD to change it's id (previously had a capital letter) due to funnies being experienced when switching themes and of course 'losing' the widgets and having to re-add them each time you switched a theme.

    Possible Fix:

    If it is a custom sidebar and you have capitals or anything else, try change the custom id in your functions.php and setup your widgets again:

    From wordpress trac:

    If possible, you should only use lowercase letters and numbers with the _ or - and the ID can only start with a letter: [a-z][a-z0-9_-]+

    https://core.trac.wordpress.org/ticket/11160 is an 'old ticket' but the last post says "future release", so I think there are still known issues there.

    IF that sorts you out PLEASE do post back here or on your post so we know.

    https://wordpress.org/plugins/amr-shortcode-any-widget/

  2. anmari
    Member
    Plugin Author

    Posted 6 months ago #

    Temporarily you can revert to version 1.8

    http://wordpress.org/plugins/amr-shortcode-any-widget/developers/

    HOWEVER if you can at least advise your situation we can figure out whether it is a theme sidebar naming issue falling foul of the wp naming anomalies.

  3. NL-UK
    Member
    Posted 6 months ago #

    I'm using a twenty-eleven child theme. The live widget areas are all in the standard parent theme twenty-eleven theme functions.php Code is below.

    The issue is that one widget area (in my case the last of three footer widget areas, which is also the last widget area in the list registered in functions.php) gets knocked out by AMR after the v.2 update.

    /**
     * Register sidebars and widgetized areas.
     *
     * Also register the default Epherma widget.
     *
     * @since Twenty Eleven 1.0
     */
    function twentyeleven_widgets_init() {
    
    	register_widget( 'Twenty_Eleven_Ephemera_Widget' );
    
    	register_sidebar( array(
    		'name' => __( 'Main Sidebar', 'twentyeleven' ),
    		'id' => 'sidebar-1',
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget' => "</aside>",
    		'before_title' => '<h3 class="widget-title">',
    		'after_title' => '</h3>',
    	) );
    
    register_sidebar( array(
    		'name' => __( 'Showcase Sidebar', 'twentyeleven' ),
    		'id' => 'sidebar-2',
    		'description' => __( 'The sidebar for the optional Showcase Template', 'twentyeleven' ),
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget' => "</aside>",
    		'before_title' => '<h3 class="widget-title">',
    		'after_title' => '</h3>',
    	) );
    
    	register_sidebar( array(
    		'name' => __( 'Footer Area One', 'twentyeleven' ),
    		'id' => 'sidebar-3',
    		'description' => __( 'An optional widget area for your site footer', 'twentyeleven' ),
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget' => "</aside>",
    		'before_title' => '<h3 class="widget-title">',
    		'after_title' => '</h3>',
    	) );
    
    	register_sidebar( array(
    		'name' => __( 'Footer Area Two', 'twentyeleven' ),
    		'id' => 'sidebar-4',
    		'description' => __( 'An optional widget area for your site footer', 'twentyeleven' ),
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget' => "</aside>",
    		'before_title' => '<h3 class="widget-title">',
    		'after_title' => '</h3>',
    	) );
    
    	register_sidebar( array(
    		'name' => __( 'Footer Area Three', 'twentyeleven' ),
    		'id' => 'sidebar-5',
    		'description' => __( 'An optional widget area for your site footer', 'twentyeleven' ),
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget' => "</aside>",
    		'before_title' => '<h3 class="widget-title">',
    		'after_title' => '</h3>',
    	) );
    }
    add_action( 'widgets_init', 'twentyeleven_widgets_init' );
  4. Branden Silva
    Member
    Posted 6 months ago #

    I'm also experiencing the same issue as NL-UK.

    The entire last widget area (which was titled Header) I had defined in my functions.php file disappeared. I tried doing an entirely different name for the widget area, recreating it, etc without any luck.

    I also had my last particular widget stop working that was listed in the appropriate widget area so it could be referenced. I tried changing to an ID from what was a title to see if that would bring the widget back but it did not.

    I've since reverted to 1.8 and its back to normal. Hopefully these issues get fixed soon.

  5. Branden Silva
    Member
    Posted 6 months ago #

    By the way anmari, to answer your question for this post the ID field for the created widget sidebar is not capital. I keep all my IDs in lowercase for the reasons you listened in your first post. Only the title itself is capitalized like the following example.

    register_sidebar(array(
        'name'          => __('Secondary', 'roots'),
        'id'            => 'sidebar-secondary',
        'before_widget' => '<section class="widget %1$s %2$s">',
        'after_widget'  => '</section>',
        'before_title'  => '<h3>',
        'after_title'   => '</h3>',
      ));

    If I were to plug this in at the end of my registered widgets with version 2 of your plugin, it would disappear.

  6. WMEric
    Member
    Posted 6 months ago #

    I to have the same issue with the last footer sidebar disappearing. I am using Boilerplate and making my own theme. All IDs are lowercase.

  7. anmari
    Member
    Plugin Author

    Posted 6 months ago #

    Thanks for info guys, I'll have to dig deeper to see why this happens. Sounds like it's the 'last' one that gets knocked. Weird.

  8. anmari
    Member
    Plugin Author

    Posted 6 months ago #

    It's puzzling folks. If i put the exact same register sidebar code at the end of the functions.php set of sidebars, then all is fine.

    However if I put it in a separate action (also called on widget_init) then it replaces the last one an shoves the last one's widgets into an 'inactive sidebar'.

    Changing ids to go in sequence doesn't help.

    Have to dig into the wp code to find out why.

  9. anmari
    Member
    Plugin Author

    Posted 6 months ago #

    found it - fixed it

  10. NL-UK
    Member
    Posted 6 months ago #

    Great. Thank you.

  11. Branden Silva
    Member
    Posted 6 months ago #

    Anmari that appears to have fixed the issue with the side disappearing.

    It didn't fix the widget I was having troubles getting to work with though with the newer version.

    If you download, "Multi Social Widget" and throw it into the Shortcodes area and reference it with the proper ID it doesn't appear to work in 2.0+ versions. It could be Multi Social Widget's problem, but it works in 1.8. Any thoughts?

    You can use username: brandensilva from Social network Dribbble to test it out if you like.

  12. dharma3d
    Member
    Posted 4 months ago #

    I have a problem with 2.2

    On a post where I put the shortcode, my sidebar doesn't show on the right side as it should but goes all the way down below the text.

    So I uninstalled and installed 1.8 and the side bar is OK.

    But now the problem is that I can't align the shortcode to be on the left and text of the post to go to the right of the newly created widget. In 2.2 it was automatically aligned to the left.

  13. anmari
    Member
    Plugin Author

    Posted 4 months ago #

    sounds like a css clash with your theme.
    The new version default setting uses the theme's html from the themes first sidebar to try have the widget look like it belongs in the theme.

    Depending how your theme does things, this usually works. If not, then
    please read the description of parameters etc here (you can change the html):
    http://wordpress.org/plugins/amr-shortcode-any-widget/

    also read this sticky post:
    http://wordpress.org/support/topic/your-theme-your-sidebars-and-the-plugin-overriding?replies=10

Reply

You must log in to post.

About this Plugin

About this Topic