Title: Using shortcode for sidebar widget
Last modified: July 28, 2023

---

# Using shortcode for sidebar widget

 *  Resolved [AlexisMS](https://wordpress.org/support/users/alexisms/)
 * (@alexisms)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/using-shortcode-for-sidebar-widget/)
 * Hi,
 * Is there a tutorial somewhere on how to configure the shortcode so that the widget
   looks exactly the same as before? I have used the following shortcode inside 
   a text widget. Unfortunately, the widget is now completely wrongly formatted.
   The post title is not exactly next to the thumbnail, uses some weird listing 
   dots, and “views in the last 30 days” is not displayed at all… 🙁
 * I’ve tried this shortcode:
 * [wpp range=’last30days’ limit=5 post_type=’post,page’ thumbnail_width=75 thumbnail_height
   =75 stats_views=30 stats_taxonomy=1]
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fusing-shortcode-for-sidebar-widget%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/using-shortcode-for-sidebar-widget/#post-16930655)
 * Hi [@alexisms](https://wordpress.org/support/users/alexisms/),
 * The closest thing to a tutorial would be [this](https://wordpress.org/support/topic/how-do-i-migrate-from-the-classic-widget-to-the-block-or-the-shortcode/#post-16871820)
   but aside from reading the shortcode’s documentation to learn how it works that’s
   as far as it goes.
 * The shortcode is not as intuitive as the widget for that reason and that’s why
   I’m suggesting people to switch to the [WordPress Popular Posts block](https://www.youtube.com/watch?v=FXUYfkv3228)
   instead which works exactly the same way as the widget but I get it that sometimes
   it’s just not possible. That’s why I’ve been helping people who can’t or won’t
   use the block to migrate to the shortcode instead.
 * Anyways, try this:
 * **#1** Add a Text widget right below your WordPress Popular Posts one.
 * **#2** Set your Text widget’s title to “(Deutsch) Meist gelesene Artikel”
 * **#3** Paste this shortcode into the Text widget:
 *     ```wp-block-code
       [wpp range='last30days' stats_views=1 stats_category=1 post_type='post,page' thumbnail_width=75 thumbnail_height=75 wpp_start='<ul class="wpp-list wpp-list-with-thumbnails">' wpp_end='</ul>']
       ```
   
 * **#4** Save changes.
 * If everything went well you should see the shortcode being properly formatted
   this time.
 *  Thread Starter [AlexisMS](https://wordpress.org/support/users/alexisms/)
 * (@alexisms)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/using-shortcode-for-sidebar-widget/#post-16932043)
 * Hi,
 * thanks for your help. Unfortunately, the new shortcode looks still the same as
   my try. I’m trying to attach a screenshot to show what I mean. There are dots(
   =an unsorted list?) in front of the post titles that don’t belong there. And 
   instead of “views per day”, some other numbers of views are displayed for the
   posts, which are significantly higher (for the most popular post, for example,“
   1800 views” instead of “62 views per day”).
 * Regards,
   Alex
 *  Thread Starter [AlexisMS](https://wordpress.org/support/users/alexisms/)
 * (@alexisms)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/using-shortcode-for-sidebar-widget/#post-16932044)
 * Cannot post an image here, so I’ve uploaded it here: [https://ibb.co/5r5GJXs](https://ibb.co/5r5GJXs)
 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/using-shortcode-for-sidebar-widget/#post-16932046)
 * Can you please add back that “Test Widget” to your sidebar so I can have a look
   at the code?
 * Regarding the views stuff, change your shortcode to this so it sorts posts by
   average views count:
 *     ```wp-block-code
       [wpp range='last30days' order_by='avg' stats_views=1 stats_category=1 post_type='post,page' thumbnail_width=75 thumbnail_height=75 wpp_start='<ul class="wpp-list wpp-list-with-thumbnails">' wpp_end='</ul>']
       ```
   
 *  Thread Starter [AlexisMS](https://wordpress.org/support/users/alexisms/)
 * (@alexisms)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/using-shortcode-for-sidebar-widget/#post-16933116)
 * Hi,
   I’ve put the text widget below the old widget for you to have a look at it
   on the frontend.Regards,Alex
    -  This reply was modified 2 years, 10 months ago by [AlexisMS](https://wordpress.org/support/users/alexisms/).
 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/using-shortcode-for-sidebar-widget/#post-16933746)
 * Thanks!
 * Alright so the bullet list styling and the extra spacing is actually coming from
   Text widget’s CSS rules. The CSS rules below will fix that:
 *     ```wp-block-code
       .widget .textwidget .wpp-list-with-thumbnails {
           padding: 0;
           list-style: none;
       }
   
       .widget .textwidget .wpp-list-with-thumbnails li a {
           margin-bottom: 0;
       }
       ```
   
 * Add these either to your theme’s style.css file or via Appearance > Customize
   > Additional CSS.
 *  Thread Starter [AlexisMS](https://wordpress.org/support/users/alexisms/)
 * (@alexisms)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/using-shortcode-for-sidebar-widget/#post-16935665)
 * It’s working perfectly! Thank you so much! 🙂
 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/using-shortcode-for-sidebar-widget/#post-16935840)
 * That’s great! Glad to know I was able to help 🙂
 * If you have any other comments / questions please let me know.
 * Have a nice week!

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Using shortcode for sidebar widget’ is closed to new replies.

 * ![](https://ps.w.org/wordpress-popular-posts/assets/icon-256x256.png?rev=1232659)
 * [WP Popular Posts](https://wordpress.org/plugins/wordpress-popular-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-popular-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-popular-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-popular-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-popular-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-popular-posts/reviews/)

 * 8 replies
 * 2 participants
 * Last reply from: [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * Last activity: [2 years, 10 months ago](https://wordpress.org/support/topic/using-shortcode-for-sidebar-widget/#post-16935840)
 * Status: resolved