WordPress Tips & Tricks

Create your custom sidebar in WordPress admin side (“my-custom-widget”) and paste the below code where you want to show the widget

<?php if( is_active_sidebar('my-custom-widget') ):  //check if sidebar is not empty ?>  
     <div class="sidebar pr-0" id="sidebar" role="navigation">
         <?php dynamic_sidebar('my-custom-widget'); ?>
     </div>
<?php endif; ?>

Note: Don’t forget to change the custom sidebar name

2 COMMENTS

  1. You are so cool! I do not think I have read through something like this before. So wonderful to find someone with some genuine thoughts on this topic. Seriously.. thanks for starting this up. This web site is one thing that’s needed on the web, someone with a bit of originality!