Envira Gallery Documentation

Documentation, Reference Materials and Tutorials for Envira Gallery

How to Enable Archives for Standalone Feature

Would you like to enable archives for standalone links in Envira Gallery? Enabling archives creates a list of all the galleries or albums you’ve created as a link to the gallery or album standalone link. To do so, you’ll need to create a custom plugin. This documentation will help walk you through the steps needed to enable archives for standalone links in Envira Gallery.

This tutorial is a bit more technical than our other docs. In order to use enable archives for Envira, please review the steps below.

To enable archives for standalone galleries in Envira, just add the following code to a new file at wp-content/plugins/envira-standalone-archive-support.php.

<?php
/**
* Plugin Name: Envira Gallery - Standalone Feature - Enable Archives
* Plugin URI: https://enviragallery.com
* Version: 1.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Enables archives for Envira Custom Post Type
*/
 
/**
* Enable archives and featured image capabilities on Envira Galleries
*/
function envira_standalone_enable_archives( $post_args ) {
     
    $post_args['has_archive'] = true;
    $post_args['supports'] = array( 'title', 'thumbnail' );
    return $post_args;
 
}
add_filter('envira_gallery_post_type_args', 'envira_standalone_enable_archives');

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 below that matches the page builder you’re using into the file, then save the file as envira-standalone-archive-support.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. 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 – Standalone Feature – Enable Archives plugin.

Activate the custom plugin to enable archives for standalone gallery links

Enable Archives for Standalone Albums

Enabling archives for standalone albums follows the same process as enabling archives for standalone galleries with a few changes to the plugin’s code. To enable archives for standalone albums in Envira, just add the following code to a new file at wp-content/plugins/envira-standalone-archive-support.php.

<?php
/**
* Plugin Name: Envira Gallery - Standalone Feature - Enable Archives and Featured Image
* Plugin URI: https://enviragallery.com
* Version: 1.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Enables archives for Envira Custom Post Type
*/

/**
* Enable archives and featured image capabilities on Envira Galleries
*/
function envira_standalone_enable_archives( $post_args ) {

$post_args['has_archive'] = true;
$post_args['supports'] = array( 'title', 'thumbnail' );
return $post_args;

}
add_filter('envira_albums_post_type_args', 'envira_standalone_enable_archives');

Enable Archives for Both Standalone Galleries and Albums

To enable archives for standalone galleries and albums in Envira, add the code below to a new file at wp-content/plugins/envira-standalone-archive-support.php.

<?php
/**
* Plugin Name: Envira Gallery - Standalone Feature - Enable Archives and Featured Image
* Plugin URI: https://enviragallery.com
* Version: 1.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Enables archives for Envira Custom Post Type
*/
 
/**
* Enable archives and featured image capabilities on Envira Galleries
*/
function envira_standalone_enable_archives( $post_args ) {
     
    $post_args['has_archive'] = true;
    $post_args['supports'] = array( 'title', 'thumbnail' );
    return $post_args;
 
}
add_filter('envira_albums_post_type_args', 'envira_standalone_enable_archives');
add_filter('envira_gallery_post_type_args', 'envira_standalone_enable_archives');

And that’s it! If you’ve set a featured image on your Envira gallery or album, then the title of the gallery or album and the featured image will show on your archive page.

If you’d like to extend Envira further, check out our tutorial on How to Load Your Gallery Lightbox from a Text Link.


A: The archive pages uses the slug of the galleries and albums you’ve specified in the WordPress Admin » Envira Gallery » Settings » Standalone tab view.

Find the standalone slug name to access your archives

For example, if you’ve set your Standalone Gallery slug to “my_gallery”, then you can view the archive at http://yourwebsite.com/my_gallery/.


A: You may need to navigate to the WordPress Admin » Settings » Permalinks and re-save your site’s permalink settings.


A: This is designed for developers only.

To style your archives, you’ll need to create a new child theme template file named archive-envira.php and create the HTML and CSS to suit your needs. If you’re not sure where to start, you may want to work with a developer to achieve your goals.