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 7 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

Marqué : 

Ce sujet contient 1 réponse, a 1 voix.

Dernière mise à jour par Alan Il y a 8 années et 7 mois.



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: lien caché

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



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 🙂

Ce ticket est maintenant fermé. Si vous êtes un client de Toolset et que vous avez besoin d'aide, veuillez ouvrir un nouveau ticket d'assistance