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;?>
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745456773a4628522.html
评论列表(0条)