Envira Gallery Documentation

Documentation, Reference Materials and Tutorials for Envira Gallery

How to Enable Comments for Standalone

Would you like to enable comments for standalone links in Envira Gallery? You can easily do this by creating a custom plugin. This documentation will help walk you through the steps needed to enable comments for standalone links in Envira Gallery.

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

When you want to enable a comment form at the bottom of your gallery on the standalone link, just add the following code to a new file at wp-content/plugins/envira-standalone-enable-comments.php.

<?php
/**
* Plugin Name: Envira Gallery - Enable Comments
* Plugin URI: https://enviragallery.com
* Version: 1.0.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Enables comments for Envira CPT
*/

function envira_standalone_enable_comments( $post_args ) {
	
	$post_args['supports'][] = 'comments';
	return $post_args;
}
add_filter( 'envira_gallery_post_type_args', 'envira_standalone_enable_comments' );

function envira_standalone_comments_metabox( $ids ) {
	$ids[] = 'commentstatusdiv';
	return $ids;
}
add_filter( 'envira_gallery_metabox_ids', 'envira_standalone_comments_metabox' );

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 and save the file as envira-standalone-enable-comments.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 – Standalone Feature – Enable Archives plugin.

Activate the custom plugin to enable comments for standalone links

Your last step is to make sure you’ve set up your gallery to allow comments on your standalone link.

Click the Screen Options panel and enable the Discussions option.

Click the box to enable discussion from Screen Options and Enable Comments from the bottom of the gallery's admin screen

Also be sure to click the checkbox to Enable Comments that will show under the gallery’s configuration information.

And that’s it! You’ve now enabled comments for standalone links on Envira galleries!

You can extend Envira further with other such changes. Take a look at our tutorial on How to make the gallery titles in your Envira Albums link.


A: Absolutely! To enable this for albums as well as galleries, use the code shown below instead of the code above and follow the same steps for creating the plugin and activating the plugin.

<?php
/**
* Plugin Name: Envira Gallery - Enable Comments
* Plugin URI: https://enviragallery.com
* Version: 1.0.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Enables comments for Envira galleries and albums
*/
function envira_standalone_enable_comments( $post_args ) {
     
    $post_args['supports'][] = 'comments';
    return $post_args;
}
add_filter( 'envira_gallery_post_type_args', 'envira_standalone_enable_comments' );
add_filter( 'envira_albums_post_type_args', 'envira_standalone_enable_comments' );


function envira_standalone_comments_metabox( $ids ) {
    $ids[] = 'commentstatusdiv';
    return $ids;
}
add_filter( 'envira_gallery_metabox_ids', 'envira_standalone_comments_metabox' );
add_filter( 'envira_albums_metabox_ids', 'envira_standalone_comments_metabox' );
[i]
[i]