Envira Gallery Documentation

Documentation, Reference Materials and Tutorials for Envira Gallery

How to Disable Keyboard and Mousewheel Navigation

Would you like to disable keyboard and mousewheel navigation for your galleries or albums? Envira can help you do just that! This guide will show you how.

This tutorial is a bit more technical than our other docs, but we’ll walk you through the process step by step. In order to disable keyboard and mousewheel navigation, we’ll need to create and upload a basic WordPress plugin.

To disable keyboard and mousewheel navigation, just add the following code to a new file at wp-content/plugins/envira-keyboard-mousewheel-navigation.php.

<?php
/*
 * Plugin Name: Envira Gallery - Disable Keyboard and Mousewheel Navigation
 * Plugin URI:  http://enviragallery.com
 * Description: Plugin that disables keyboard and mousewheel navigation for Albums and Galleries
 * Author:      Envira Gallery Team
 * Author URI:  http://enviragallery.com
 * Version:     1.0
 */

// Disable for Albums
add_filter( 'envira_albums_pre_data', 'my_envira_album_pre_data', 10, 2 );
function my_envira_album_pre_data( $data, $album_id ) {
	$data['config']['keyboard'] = 0; // 0 for disable, 1 to enable
	$data['config']['mousewheel'] = 0; // 0 for disable, 1 to enable
	return $data;
}

// Disable for Galleries
add_filter( 'envira_gallery_pre_data', 'my_envira_gallery_pre_data', 10, 2 );
function my_envira_gallery_pre_data( $data, $gallery_id ) {
	$data['config']['keyboard'] = 0; // 0 for disable, 1 to enable
	$data['config']['mousewheel'] = 0; // 0 for disable, 1 to enable
	return $data;
}

If you’re unsure how to create a plugin file, follow these steps below:

  1. Open a text file and make sure that it is a plain text document. You can use a plain text editor like Notepad or a code editor of your choice.
  2. Next, copy and paste the code shown above into the file and save the file as envira-keyboard-mousewheel-navigation.php.
  3. Once you’ve saved the file, you can easily upload this directly to your /plugins directory on your server using FTP, or you can right-click on the text document and zip (or compress).
  4. Finally, log in to your WordPress dashboard and go to Plugins » Add New » Upload Plugin and upload the .zip file you just created in the previous step.

Your next step is to activate the plugin you just uploaded. Simply navigate to the Plugins from within your WordPress dashboard and activate the Envira Gallery – Disable Keyboard and Mousewheel Navigation plugin.

Disable Keyboard and Mousewheel Navigation

That’s it! Would you like to extend Envira further? Check out our tutorial on how to Display Adsense Ads in Lightbox.


[i]
[i]