0

I'm doing a php filterable portfolio and also with the Isotop.js library. Having followed a tutorial. I do not understand why my filter system does not work. I created my categories and my projects but nothing works. Do you have solution ?

Here is my functions.php:

function file_js(){
wp_enqueue_script('js_general', get_template_directory_uri().'/js/script.js', array('jquery'),'1.4.1', true);
wp_enqueue_script('isotope', get_template_directory_uri() . '/js/isotope.pkgd.min.js');
wp_enqueue_script('iso', get_template_directory_uri() . '/js/isotope.pkgd.js');}
add_action('wp_enqueue_scripts','file_js');

Here is my script.js:

jQuery(document).ready(function(){
jQuery('.grid').isotope({
itemSelector: '.grid-item',
layoutMode: 'fitRows'
});

jQuery('.filter-button-group').on( 'click', 'button', function() {
var filterValue = $(this).attr('data-filter');
$grid.isotope({ filter: filterValue });
});
});

Here is my archive-projet.php, there is ACF plugin:

<?php $loop = new WP_Query($args);?>
<?php while ($loop -> have_posts()) : $loop-> the_post();?>
<a class="grid-item <?php $categories = get_the_category(get_the_id()); 
      foreach ($categories as $category) {
        echo $category->slug.' ';
      }?>"
href="<?php echo esc_url($link_projet);?>">
<div class="container-gallery">
    <?php $link_projet = get_field('url_page_realisation');?>
    <?php if ($link_projet):?> 


<?php the_post_thumbnail('image_projet');?>
      <div class="overlay-gallery">
          <div class="text-gallery"><?php the_title();?></div>
      </div>


<?php endif;?>
</div></a>
<?php endwhile;?>
3
  • Your archive-projet.php code appears to be incomplete. May 28, 2019 at 12:27
  • My code was misplaced. But I do not think it comes from that ?
    – t.web
    May 28, 2019 at 12:39
  • I know, but it's impossible to help without seeing the code that was missing :) May 28, 2019 at 12:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.