Featured Plugin - HYPERCHILD

Beautiful Design, create Child Themes in a single click!

Latest Posts

Divi Hype - Visual Builder Dropdown Navigation Menu - Blog Cover

How to create an Awesome Divi Builder dropdown Navigation Menu

Speed up your website development workflow with our amazing Divi Builder dropdown navigation menu!

DiviHype - How to install Facebook Messenger Chat on your Divi Website

How to add Facebook Messenger Chat to your Divi Website

Introduction It's well known that having a direct method for your website visitors to...
Divi Hype - mobile-parallax

How to add mobile Parallax to your Divi website

IntroductionIf you've landed here, you are probably using Divi to design websites and...
Divi Hype - How to Redirect Divi Filtered Portfolio Items to Custome URLs

How to Redirect Divi Filterable Portfolio items to custom URLs

** UPDATE 25/07/2019 ** I had several requests to update this code so it worked with later...
Divi Hype - How to Create a Divi Child Theme

How to Create a Divi Child Theme

Creating a child theme for Divi or Wordpress is essential if you want to make your own...
Divi Hype - How to create a cool Typewriter Effect in Divi

How to Create a Cool Typewriter Effect in Divi

A recent question was posted up on the Divi Web Designers Facebook group asking how to...
Divi Hype - How to Reveal Divi Content on clicking a Button

How to Reveal Divi Content on Clicking a Button

I recently saw a request on the Divi Web Designers Facebook group asking how to reveal...
Divi Hype - How to create a slide-in mobile menu for Divi

How to create a slide-in Mobile Menu for Divi

Most Divi designers will tell you the one thing that usually gives away a Divi site is the menu....
Divi Hype-How to add an email link to the Divi Person Module

How to add an email link to the Divi Person Module

People often ask how you can add an email link to the Divi Person module. It seems an obvious...

** UPDATE 25/07/2019 **

I had several requests to update this code so it worked with later versions of Divi. That’s now been done and tested on version 3.26.3. I’ve also simplified the process so you simply download the custom file now instead of copying a load of code.

Elegant Themes could change the original Filterable Portfolio code at any point and cause this custom code to break. If you upgrade and notice any issues, please let me know and I’ll update the code again.

If you’re running a significantly older version, you can download and try my old version of the code here.

If the old or new versions of my code don’t work for you and you are desperate to sort it, email me and attach the following file:
/wp-content/themes/Divi/includes/builder/module/FilterablePortfolio.php

When I get time, I can then create a version that will work.

Divi is an awesome theme, but the way some of the modules work doesn’t always fit with what you want to do on your website.

One issue I’ve had in the past is the way the Filterable Portfolio module works. By default, the project items listed by the module automatically link back to the main project page.
So what happens if you want to change these links to take you somewhere else like a product in your shop, or another page on your site?

The filterable grid is built using some core PHP in the Divi theme and it’s extremely difficult finding out how to override this, but don’t worry, I’ll show you how 🙂

In this tutorial we’ll be creating a customised version of the Divi Filterable Portfolio module that lets you add custom fields to your project entries as follows:
1) url: Sets the url you want to open when the project item is clicked in the grid
2) target: Sets the url target (e.g. ‘_self’ or ‘_blank’), allowing you to redirect the link to a new browser tab if you want

The changes we are making are written in a safe manner, so if you do NOT set either of the custom fields above the grid will still work as normal.

DISCLAIMER

The code is tested on Divi version 3.26.2. It may not work correctly on older versions and also newer versions, if Divi change the code for the module again.

If the functionality doesn’t work for you, send me an email and include your specific FilterablePortfolio.php file from your version of Divi. You can find it in this folder:
/wp-content/themes/Divi/includes/builder/module

When I get chance, I’ll create a custom file that works with your version of Divi and send it back to you 🙂

PRE-REQUISITES

To implement this, it’s essential that you are using a CHILD THEME as we will need to create a copy of one of the Divi core PHP files. If you’re not using a child theme, it’s easy to do.
Here’s our article explaining how to create a Divi Child Theme

You will also need file-level (or FTP) access to your web server to create/upload some files.

DEMO

I’ve created a quick demo showing three project items listed in a filterable portfolio:
View the Demo

Each has a custom URL it links to. The first item opens the DiviHype Blog in the same tab, the 2nd opens our custom modules page in a new window and the 3rd opens the Elegant Themese website in a new tab.

HOW TO IMPLEMENT THE CODE

1) Create a new subfolder

Under your child theme folder, create a new subfolder named custom-modules.

2) Create the custom PHP file

Download this zip file, unzip it and upload the FilterablePortfolio.php file inside to your new custom-modules folder

3) Add Code to your functions.php file

Paste the code below into your child theme functions.php file. This code tells wordpress to ignore the standard Filterable Portfolio and use our custom version instead:

// Replace the existing filterable portfolio with our customised version
function divi_custom_filterable_portfolio_setup() {
    if ( ! class_exists('ET_Builder_Module_Type_PostBased') ) {
        return;
    }
    get_template_part( 'custom-modules/FilterablePortfolio' );
    $cfwpm = new Custom_ET_Builder_Module_Filterable_Portfolio();
    remove_shortcode( 'et_pb_filterable_portfolio' );
    add_shortcode( 'et_pb_filterable_portfolio', array($cfwpm, '_shortcode_callback') );
}
add_action( 'wp', 'divi_custom_filterable_portfolio_setup', 9999 );

 

HOW TO SET THE CUSTOM LINKS

  • To set a URL for a Project: Add a custom field called url and set the value to the url you want
  • To make the link open in a new window: Add a second custom field called target and set the value to _blank

Note: The target will be ‘_self’ by default, so if you don’t add the target custom field, the URL will open in the same window.

An example of these two custom fields added for a Project is shown below:
Divi Hype - How to make Divi Filterable Portfolio items link to a custom URL - Custom fields

 

Rounding Up

Wow! You’ve customised one of the Divi modules, how awesome is that? You’re new Divi Filterable Portfolio grid will work exactly as before, but you can now add custom fields to redirect entries to any URL you want!

If you found this tutorial useful, leave a comment!

About the Author

Divi Hype - Ed Solman Avatar Large

Ed Solman

Entrepreneur, Blogger and Website Developer/Designer. Passionate about helping people and businesses develop and grow. Daredevil sportsbike enthusiast.

Divi Hype favicon light

Get the Hype

Join our mailing list for all the latest Hype and get our massive Freebie bundle, with all our Custom module layouts and the HyperChild plugin for FREE!

You have Successfully Subscribed!