Support » Plugin: amr shortcode any widget » “before_widget” class from custom sidebar added to AMR widgets unexpectedly

  • Resolved cromagrickman

    (@cromagrickman)


    Hey there, I was hoping to have some help troubleshooting an issue with amr shortcode any widget and my own custom sidebar. Here’s the situation:

    I created a sidebar for widgetizing an area of the home page. Here is my code to register the sidebar (in a plugin):

    * Register our sidebars and widgetized areas. */
    function drick_featured_widget() {
    
    	register_sidebar( array(
    		'name'          => 'Home Page Featured Properties',
    		'id'            => 'drick_home_feat_prop',
    		'before_widget' => '<div class="home-feat-prop">',
    		'after_widget'  => '</div>',
    		'before_title'  => '<h2 class="home-feat-prop-title">',
    		'after_title'   => '</h2>',
    	) );
    
    }
    add_action( 'widgets_init', 'drick_featured_widget' );

    It all looks and works fine. However, I noticed that on all the amr shortcode any widget widgets, on every page that has one, also has the “home-feat-prop” div added. This is messing up the styling. I’m wondering if I registered my sidebar incorrectly, or if the amr shortcode any widget conflicts somehow with other registered sidebars?

    Here’s how the custom sidebar I created is added to the home page:

    <?php if ( is_active_sidebar( 'drick_home_feat_prop' ) ) : ?>
          <div class="home-featured-widget-bg">
           <div class="home-featured-widget-wrapper">
              <?php dynamic_sidebar( 'drick_home_feat_prop' ); ?>
           </div><!-- home-featured-widget-wrapper -->
           </div><!-- home-featured-widget-bg -->
        <?php endif; ?>

    Can you see in my code any reason why the widget area class from my custom sidebar is getting added to all the amr shortcode widgets? Thank you in advance for your time!

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author anmari

    (@anmari)

    Hi please see https://wordpress.org/plugins/amr-shortcode-any-widget/ (also linked from the “please read this before posting” support post 😉 ) – the installation section, in particular the sections html tags and css classes. Depending on css of their theme & widgets, some folks want the same html tags & classes & others don’t. Playing with these normally enables one to achieve something sensible.

    cromagrickman

    (@cromagrickman)

    Appreciate the help very much Anmari, thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.