Skip Navigation

[Résolu] isotope filtering works in 2015 theme but not in my genesis theme

This support ticket is created Il y a 8 années et 6 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Marqué : 

This topic contains 1 réponse, has 1 voix.

Last updated by Alan Il y a 8 années et 6 mois.

Auteur
Publications
#342044

Hello,

I followed some advice given by Waqas in another thread to start using the isotope javascript to produce some nice filtering and sorting effects.

I got a basic test version working on this test site: hidden link

However, when I change the theme to one of my Genesis themes, the functionality stops working.
I have added this to the Genesis > theme settings > header section

<script src="<?php echo get_template_directory_uri() ?>/isotope.pkgd.min.js" type="text/javascript"></script>

(This is the same code as I added to the header.php file of the Twenty Fifteen theme, and it works there.
The js file exists in both theme folders.

I've also tried adding this to my functions.php file, with no effect.

function add_isotope_js() {
    wp_enqueue_script( "isotope-js", get_template_directory_uri() . '/isotope.pkgd.min.js');
 
}
add_action('wp_enqueue_scripts', 'add_isotope_js');

Grateful if you can possibly advise.

Many thanks
Alan

#342226

Hello

I discovered the solution after lots of digging around in various forums.
As is often the case, it's stupidly simple. I'll post it here in case it benefits anyone else.

The issue was that on Genesis, you're using a child theme, and so the code in functions.php needs to be amended to use get_stylesheet_directory_uri() instead of get_template_directory_uri()

function add_isotope_js() {
    wp_enqueue_script( "isotope-js", get_stylesheet_directory_uri() . '/isotope.pkgd.min.js');
  
}
add_action('wp_enqueue_scripts', 'add_isotope_js');

Always learning 🙂

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.