【发布时间】:2020-10-21 08:54:54
【问题描述】:
我只是在我的网站中手动设置同位素,然后我在 get_terms 和 get_ther_terms 条件的帮助下对其进行动态处理,这是完整代码
<div class="main_page">
<div class="portfolio_section">
<div class="controls">
<button type="button" class="control" data-filter="all">All</button>
<?php
$cat_list = get_terms('filters');
foreach ($cat_list as $cat) :
?>
<button type="button" class="control" data-filter=".<?php echo $cat->slug;?>"><?php echo $cat->name; ?></button>
<?php endforeach; ?>
</div>
<div class="container pasresnt">
<?php
$mixitup = new WP_Query(array(
'post_type' => 'portfolio',
'posts_per_page' => -1,
));
?>
<?php while ($mixitup->have_posts()) : $mixitup->the_post() ; ?>
<div class="mix <?php
$cat_slug = get_the_terms($post->ID, 'filters');
foreach ($cat_slug as $cat_sl) {
echo $cat_sl->slug;
}
?>">
<a href="<?php the_post_thumbnail('portfolio-small'); ?>" target="_blank"><?php the_post_thumbnail('portfolio-small'); ?> </a>
</div>
<?php endwhile; ?>
<div class="mix green">
<a href="<?php echo get_template_directory_uri(); ?>/img/mahi.jpg"><img src="<?php echo get_template_directory_uri(); ?>/img/mahi.jpg"
alt=""></a>
</div>
</div>
</div>
</div>
这是正常静态图像弹出窗口中的亮点,此代码正确
<a href="<?php echo get_template_directory_uri(); ?>/img/mahi.jpg"><img src="<?php echo get_template_directory_uri(); ?>/img/mahi.jpg"
alt=""></a>
但是在动态中,此图像弹出窗口对我不起作用。最后一个静态图像作为示例,它可以完美运行,但是作为图像的行代码来自投资组合自定义帖子选项,此弹出窗口不起作用
<a href="<?php echo $for_img; ?>" target="_blank"><?php the_post_thumbnail('portfolio-small'); ?> </a>
`
【问题讨论】:
-
您是否尝试过将
target="_blank"从不工作的邮箱中删除? -
是的,我试过postimg.cc/NymxMh7v
-
有这个和没有这个 target="_blank" 图片弹出不显示
-
这个静态代码有效` /img/mahi.jpg" alt=""> ` 但这项工作不像我之前解释的那样 ` `
-
嗯
target是它们之间的唯一区别。 “不工作”是什么意思?这并不能说明什么。你有错误吗?根本不显示吗?它是否在单独的标签中打开?
标签: php wordpress jquery-isotope magnific-popup mixitup