This jQuery plugin will transform all of your WordPress galleries into fully responsive sliders!
- Add the JavaScript file to the js folder (make it if it doesn't exist already) inside your theme directory.
- Enqueue the script with the folowing code inside functions.php:
wp_enqueue_script(
'galleryslider', //handle
get_template_directory_uri() . '/js/galleryslider.js', //source
array( 'jquery', 'plugins' ), //dependencies
null, // version number
true //load in footer
);
- Add the following code to your functions.php file:
remove_shortcode('gallery');
add_shortcode('gallery', 'custom_size_gallery');
function custom_size_gallery($attr) {
// Change size here - medium, large, full
$attr['size'] = 'large';
return gallery_shortcode($attr);
}
- jQuery - This should already be part of your WordPress theme unless you've removed it.
- Font Awesome - Because it's awesome!
The slider can be styled with CSS. Since the default styles are inline styles, you'll likely need to add !important
to your rules to override them. Default gallery styles are