Envira Gallery Documentation

Documentation, Reference Materials and Tutorials for Envira Gallery

How to make the gallery titles in your Envira Albums link

Would you like to turn your album gallery titles into links just like the gallery cover image? This tutorial will walk you through the steps needed to do just 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 make your gallery titles links, we’ll need to create and upload a basic WordPress plugin.

Creating the Plugin

To make the titles links, just add the following code to a new file at /wp-content/plugins/envira-gallery-title-link-for-albums.php:

<?php
/*
* Plugin Name: Envira Gallery - Gallery title link for Albums
* Plugin URI: https://enviragallery.com
* Version: 1.0.0
* Author: Envira Gallery Team
* Author URI: https://enviragallery.com
* Description: Includes the gallery title as a link for albums
*/
add_filter( 'envira_albums_album_title', 'example_envira_envira_albums_album_title', 10, 5 );
function example_envira_envira_albums_album_title( $album_title, $id, $item, $data, $i ) {
	/* get the permalink of the gallery, then turn the title into a link */
	$gallery_link = get_permalink( $id );
	$album_title = '<a href="' . $gallery_link . '">' . $album_title . '</a>';
	return $album_title;
}

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 into the file and save the file as envira-gallery-title-link-for-albums.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 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 – Gallery title link for Albums plugin.

Turn your album gallery titles into links

And that’s it! When you activate the plugin, any album that has the gallery titles enabled will appear as links just like the gallery cover image does.

If you would like to extend Envira galleries in other ways, check out this tutorial on how to Change Image Crop Position.

FAQs

Q: Why isn’t my title showing under the gallery cover image?

A: Make sure to check the Config tab of your album. The Display Gallery Titles? must be selected to show either above the gallery image or below.

Turn on the Album setting to display the gallery titles on the Config Tab