Envira Gallery Documentation

Documentation, Reference Materials and Tutorials for Envira Gallery

How to change the Envira breadcrumbs URL

Do you have Breadcrumbs enabled inside of Envira Gallery, and would you like to change the URL of the homepage?

This tutorial will walk you through how to change the default homepage URL to a custom URL for Envira Breadcrumbs with some code tweaks.

Heads up!

This article contains PHP, CSS, and/or JavaScript to customize our plugin. We offer this code as a courtesy but don’t provide support for additional code customizations or 3rd party development.

To change the default Homepage URL to a different URL, 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.

/* Change the Homepage URL inside Envira Breadcrumbs
 * 
 * @link https://enviragallery.com/docs/how-to-change-the-homepage-url-inside-envira-breadcrumbs/
 */
add_filter( 'envira_breadcrumbs_data', 'test_envira_breadcrumbs_data', 10, 5 );

function test_envira_breadcrumbs_data( $breadcrumbs, $album_id, $gallery_id, $separator, $album_post_id ) {

//Change the title and url to your own
    $breadcrumbs[0]['title'] = 'Your Title Here';
    $breadcrumbs[0]['url'] = 'http://www.customurl.com';
    return $breadcrumbs;
}

Customizing the snippet

The following code is set to change the default homepage URL to https://www.enviragallery.com. On lines 8 and 9 below, you will need to add your own custom title and URL.

After adding the code, you will see the homepage URL changed to the URL that was added inside the code.

Change the Homepage URL inside Breadcrumbs

 

That’s it! Would you like to extend Envira further? Check out our tutorial on How to change the Image Counter Image text inside of the Envira Gallery Image Counter.


FAQs

Q: Can I apply a different URL for each gallery?

A: At this time, the text and URL entered in this plugin will be applied to all galleries that have Breadcrumbs enabled.