Support » Plugin: Widget Shortcode » Shortcode not displayed

  • hugohofverberghagman

    (@hugohofverberghagman)


    Hi,

    I have just installed this plugin and added a Widget to the Shortcode Widget. I pasted the shortcode on my front page and it’s not displayed.

    Can you please assist?

    Thanks!

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author shazdeh

    (@shazdeh)

    Hi,

    Do you see the shortcode itself show up in the page or nothing at all?

    – If you see the shortcode text (like [widget id=""] text): that means your theme is not parsing shortcodes in that place, you need to contact your theme author and ask them about that.

    – If you see nothing at all: could be the widget is not showing anything. Try adding the widget to a widget area that shows up on frontend (like the sidebar, or in the footer as most themes have), and check when you add the widget there it actually shows content.

    hugohofverberghagman

    (@hugohofverberghagman)

    Hi,

    I see nothing at all. I added a Widget area to the same container and it’s showing up as it should. You can see at the bottom of the front page, next to the newsletter signup.
    There is a small green heart, that’s the widget in the widget area. On top of it is the Widget Shortcode in a Text element, it shows nothing. I have tried the Widget Shortcode in a Woocommerce Product Tab and it was not showing ther either.

    Plugin Author shazdeh

    (@shazdeh)

    Hi,

    It might be when using the shortcode, the widget is there in the page but its stylesheet is missing. So checking the widget on frontpage, it has only an empty <a> tag as its output, and if its stylesheet is not loading then you wouldn’t see anything at all.
    After you’ve added it to a page right click on the page and select View Source, then search for: <!-- Widget Shortcode -->, see if that is there.

    Might I ask what widget from what plugin are you using? I could try testing it on my local setup and see if I can replicate that issue.

    hugohofverberghagman

    (@hugohofverberghagman)

    Hi,

    I checked and the code is there:

    <div class="e4-17 x-text" >
      <!-- Widget Shortcode --><!-- /Widget Shortcode --></div>
      <div class="e4-18 x-bar-widget-area" >
        <div id="widget_top_wishlist-2" class="widget tinvwl widget_wishlist_products_counter"><a href="https://www.handgjortfabriken.se/onskelista/"
       class="wishlist_products_counter top_wishlist-heart top_wishlist- no-txt wishlist-counter-with-products">
    	<span class="wishlist_products_counter_text"></span>
    			<span class="wishlist_products_counter_number"></span>
    	</a>
    </div>

    The plugin I am using is TI WooCommerce Wishlist Plugin for Woocommerce.
    I tried adding the standard Archive Widget as a Shortcode and that works so at least your plugin is working.

    Thank you!

    Hello, same on my clean test site, using plugin WordPress Popular Posts..
    WPP has its own widget, if its normal used, its working. When I try to use it in WS, nothing is displayed..

    Hi everyone,

    Developer of the WordPress Popular Posts plugin here.

    I found a possible solution to the issue:

    1. (Optional but highly recommended) download a fresh version of the Widget Shortcode plugin in case you need to rollback these changes. Also, FTP access credentials to your server (or access to cPanel) is a must so you can actually do the rollback.
    2. Go to Plugins > Plugin Editor and select Widget Shortcode to edit it.
    3. Click on includes/class-widget-shortcode.php to edit this file.
    4. Find (around line 155):
      
      $class = get_class( $wp_registered_widgets[ $id ]['callback'][0] );
      

      … and change it to:

      
      //$class = get_class( $wp_registered_widgets[ $id ]['callback'][0] );
      
      global $wp_widget_factory;
      $_registered_widgets = $wp_widget_factory->widgets;
      
      foreach ($_registered_widgets as $class_name => $obj) {
          if ( $obj->id == $id ) {
              $class = $class_name;
              break;
          }
      }
      
    5. Click on the Update File button to save changes.

    With this, WordPress Popular Posts version 5.0 was able to load normally (FYI @martascz). Other widgets are loading fine as well so there are no apparent side effects to this modification.

    @shazdeh please have a look at the code whenever you have the time just to make sure it doesn’t break anything.

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