Envira Gallery Documentation

Documentation, Reference Materials and Tutorials for Envira Gallery

How to Create a Custom Template for Galleries

Would you like to create a custom template to display your Envira galleries? You can create your own PHP page templates on your theme for Envira. This tutorial will walk you through how to create a custom page template for your Envira galleries.

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 create a custom template to display your Envira galleries on a standalone link you’ll first need to create a child theme for your WordPress theme.

Create a Child Theme

The first step will be to create a child theme.

We recommend using a child theme for any edits you wish to make to your theme. This ensures that if the theme pushes out an update, you’ll not lose any changes you’ve made to your theme.

To create a child theme, follow the instructions here from our friends at WP Beginner.

Activate the Child Theme

Next, navigate to Appearance » Themes and activate your new child theme.

Activate the child theme to begin creating your custom template

Create the Custom Template

Now that your child theme is activated, we can create our custom page template.

In this example, we’re going to copy the page.php inside the WordPress Twenty Seventeen theme and use this for our Envira galleries custom template following these steps:

  1. Open the /wp-content/themes/twentyseventeen theme directory.
  2. Open the page.php template from the parent’s theme directory using any code editor you choose.
  3. We’ll need to remove the comments from the top of that page template and replace it with:
    /* Template Name: Envira Gallery Page Template */
    Example Before:
    Envira's custom template header before

    Example After:
    Envira's custom template header after
  4. Finally, just save the file using this name single-envira.php.

Your Standalone galleries will now use your custom template automatically!

Would you like to do the same for Envira Albums? Check out our tutorial on How to Create a Custom Template for Albums!


How Can I Make My Custom Page Template Fullwidth?

A: You can do this with CSS to hide any sidebars for that particular page template. If you need any assistance, reach out to support to inquire about some assistance with this.

Do I Really Need a Custom Template?

A: Not necessarily! This will depend on the theme you’re using and if your theme has provided any custom templates. You can read more about that on our How to Use the Standalone Feature in Envira Gallery.