Buy All 121 Premium WordPress Themes for $59.99
No Additional Fees, Pay Once and Use Unlimited Time for Unlimited Domains, Free Lifetime Updates

How to Add Widgets inside Slides

How to Add Widgets inside Slides

By default our themes comes with Customizer options for Slides content such as Slide Background Image, Title, Text, Link URL, etc. In some cases you may want to insert widgets as slide content. Here is a guide how it can be done:

Login to your Admin Panel and navigate to Left Menu -> Appearance -> Editor, then open functions.php for editing.

Below the following code:

// II. Register Widget Areas


// II. Register Widget Areas

for ($i = 1; $i <= 5; ++$i) {

  // Add Slide #i Widget
  register_sidebar( array (
   'name' =>
  sprintf( esc_html__( 'Slide #%s',
              'tishonator' ), $i ),
   'id'    =>  'slide-'.$i.'-widget-area',
   'description'   => 
sprintf( esc_html__( 'The Slide #%s widget area',
'tishonator' ), $i ),
        'before_widget'  =>  '',
        'after_widget'   =>  '',
        'before_title'   =>  '<h2>',
        'after_title'   =>  '</h2>',
      ) );      

Then below the following code:

<h2><?php echo $slideTitle; ?></h2>


<h2><?php echo $slideTitle; ?></h2>

<?php dynamic_sidebar( 'slide-'.$i.'-widget-area' ); ?>

Then Navigate to Left Menu -> Appearance -> Widgets and Insert widget you want in some of the available Slide # widget areas:

insert widget in slide

and Save changes.

Leave a Reply