Envira Gallery Documentation

Documentation, Reference Materials and Tutorials for Envira Gallery

How to enable archives for Standalone galleries

Would you like to enable archives for standalone links in the 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.

This tutorial will walk you through the steps needed to enable archives for standalone links in Envira Gallery with some code tweaks.

Heads up!

This article contains PHP, CSS, and JavaScript code and is intended for developers. We offer this code as a courtesy but don’t provide support for code customizations or 3rd party development.

Adding the Code Snippet

To enable archives for standalone links, you’ll need to add the following code.

If you need help adding custom code to your site, please check out our guide on adding custom PHP or JavaScript to your site.

/* Envira - Standalone Feature - Enable Archives
* 
* @link https://enviragallery.com/docs/how-to-enable-archives-for-standalone-feature/
*/

function envira_standalone_enable_archives( $post_args ) {

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

}
//Enables archive for the standalone albums
add_filter('envira_albums_post_type_args', 'envira_standalone_enable_archives');

//Enables archive for the standalone galleries
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.