我知道有一个标题相同的类似主题,但我的问题不一样。Fancybox在我的html模板中工作得很好,但在将其转换为wordpress后,图像不会显示在弹出框中,我只能看到一个方形的白色框
这是我的代码:
<?php $args = array( \'post_type\' => \'portfolio\' );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div class="portfolio-item">
<a class="project-img-container">
<?php the_post_thumbnail(); ?>
</a>
<div class="overlay">
<a href="<?php the_permalink(); ?>" class="project-title"><?php the_title(); ?></a>
<a href="<?php get_the_post_thumbnail(); ?>" class="project-img fancybox"></a>
<a href="<?php the_permalink(); ?>" class="project-link"></a>
</div>
</div>
<?php endwhile; ?>
&;以下是js:$(".fancybox").fancybox({
padding : 0,
margin : 100,
openEffect : \'elastic\',
closeEffect : \'elastic\',
openSpeed : 400,
closeSpeed : 400,
helpers : {
overlay : {
css : {
\'background\' : \'rgba(0, 0, 0, 0.75)\'
}
}
}
});
我不是职业选手。所以我自己找不到错误。我该怎么办?