Envira Gallery Documentation

Documentation, Reference Materials and Tutorials for Envira Gallery

Changing Envira’s Standalone WordPress Template

Envira uses a default template in your WordPress theme for standalone galleries. While you can change this via the backend settings on a gallery by gallery basis – if you’d like to do this on a code level we can help walk you through how to do that!

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 get and potentially alter the standalone template settings, we’ll need to create and upload a basic WordPress plugin.

Creating the Plugin

We’ll begin by creating a custom plugin. Just add the following code to a new file at wp-content/plugins/envira-change-standlone.php.

<?php
/**
* Plugin Name: Envira Gallery - Change Standalone Template
* Plugin URI: https://enviragallery.com
* Version: 1.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Changes the Standalone template.
*/

add_filter( '<span class="pl-s1"><span class="pl-s">envira_standalone_get_custom_template</span></span>', 'test_<span class="pl-s1"><span class="pl-s">envira_standalone_get_custom_template</span></span>', 10, 3 );
function test_envira_pagination_link_args( <span class="pl-s1"><span class="pl-smi">$new_template</span>, <span class="pl-smi">$data</span>, <span class="pl-smi">$post</span></span> ) {
    $<span class="pl-s1"><span class="pl-smi">new_template</span></span> = 'envira-standalone.php';
    return $<span class="pl-s1"><span class="pl-smi">new_template</span></span>;
}

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-change-standalone.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.

Activate the Plugin

Your final step is to activate the plugin you just uploaded. Simply navigate to the Plugins from within your WordPress dashboard and activate the Envira Gallery – Change Standalone Template plugin.

Activate the plugin you just uploaded to remove the pagination truncation

And that’s it!

[i]
[i]