Envira Gallery Documentation

Documentation, Reference Materials and Tutorials for Envira Gallery

Enable Archives for Standalone Feature

To enable archives (lists of Galleries and Albums) with the Standalone feature enabled, and Featured Images for your Envira Galleries, add the following code to a new file at wp-content/plugins/envira-standalone-enable-archives.php and activate it in your Plugins screen:

<?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_gallery_post_type_args', 'envira_standalone_enable_archives');

/**
* Enables the Featured Image Metabox on Envira Galleries
*/
function envira_standalone_enable_featured_image_metabox( $pass_over ) {

	$pass_over[] = 'postimagediv';
	return $pass_over;

}
add_filter( 'envira_gallery_metabox_ids', 'envira_standalone_enable_featured_image_metabox' );

FAQs

Q: How do I find the archive pages for my Galleries and Albums?

A: The archive pages use the slug of your Galleries (and Albums if using the Albums Addon) you’ve specified in the WordPress Admin » Envira Gallery » Settings » Standalone tab view.

You can set the slugs for your Standalone Galleries and Albums in the Envira Gallery » Settings screen.

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/


Q: I’ve installed/activated this plugin but it isn’t working, why?

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


Q: How do I change the default appearance of the archives?

A: This is designed for developers only. To style your list of Envira Galleries, you’ll need to create a new theme template file named archive-envira.php, and create HTML + 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.


Q: I don’t want to display a featured image, how do I remove this metabox from the Gallery and/or Albums edit screen?

A: To disable Featured Image functionality, remove lines 24 onwards, as well as removing $post_args['supports'] = array( 'title', 'thumbnail' );.