How Do I Add a Scrolling Gallery in WordPress?

Adding a scrolling gallery in WordPress is a fairly simple process. First, you will need to add a widget to your sidebar. Then, you will need to add a few lines of code to your theme’s functions.php file.

Finally, you will need to add a few lines of code to your gallery’s index.

To add a widget to your sidebar, first locate the widgets area in your WordPress admin area. Then, locate the Scrolling Gallery widget and click on it to add it to your sidebar.

To add a few lines of code to your theme’s functions.php file, locate the theme’s functions.php file and add the following lines of code:

add_action( ‘init’, ‘mygallery_init’); function mygallery_init() { register_sidebar( ‘scrolling-gallery’, ‘My Gallery’, array( ‘title’ => __( ‘Scrolling Gallery’, ‘mygallery’ ), ‘id’ => ‘scrolling-gallery’, ‘description’ => __( ‘A gallery of images that can be scrolled through.’, ‘mygallery’ ), ‘before_widget’ => ‘

  • View
  • ‘, ‘after_widget’ => ‘

    ‘ ) ); }

    To add a few lines of code to your gallery’s index.php file, locate the gallery’s index.php file and add the following lines of code:

    __( ‘Scrolling Gallery’, ‘mygallery’ ), ‘id’ => ‘scrolling-gallery’, ‘description’ => __( ‘A gallery of images that can be scrolled through.’, ‘mygallery’ ), ‘before_widget’ => ‘

  • View
  • ‘, ‘after_widget’ => ‘

    ‘ ) ); } // Add the gallery. add_image_gallery( ‘gallery’, ‘images’, array( ‘title’ => __( ‘My Gallery’, ‘mygallery’ ), ‘id’ => ‘gallery’, ‘items’ => array( ‘image’ => array( ‘src’ => ‘images/1.

    jpg’, ‘alt’ => ‘Thumbnail 1′, ‘class’ => ‘media-item media-large’ ), ‘image-large’ => array( ‘src’ => ‘images/2.jpg’, ‘alt’ => ‘Thumbnail 2′, ‘class’ => ‘media-item media-large’ ), ‘image-medium’ => array( ‘src’ => ‘images/3.jpg’, ‘alt’ => ‘Thumbnail 3′, ‘class’ => ‘media-item media-medium’ ), ‘image-small’ => array( ‘src’ => ‘images/4.jpg’, ‘alt’ => ‘Thumbnail 4′, ‘class’ => ‘media-item media-small’ ), ‘thumbnail’ => array( ‘src’ => ‘images/5.jpg’, ‘alt’ => ‘Thumbnail 5′, ‘class’ => ‘media-item media-thumbnail’ ), ), ‘gallery_class’ => ‘media-gallery media-large media-item’ ); } ?>.

    Conclusion.