Elementor会将同样的短代码显示两次,一次在放置短代码的位置,另一次在头部右侧。这个问题只在编辑器中出现,在页面上它可以正常显示。请帮忙解决该问题,如何修复呢?
function display_grid_func ( $atts ){
echo '<div class="post-grid">';
$args = array(
'post_type' => 'realizacje',
'post_status' => 'publish',
'posts_per_page' => 9,
'cat' => 5
);
$loop = new WP_Query($args);
while ($loop->have_posts()) : $loop->the_post(); ?>
<div class="post-tile home">
<a href="<?php the_permalink(); ?>">
<img src="<?php the_post_thumbnail_url('tile-foto'); ?>" />
</a>
<a class="button-zobacz home" href="<?php the_permalink(); ?>">Zobacz →</a>
</div>
<?php endwhile;
wp_reset_postdata();?><?php
echo '</div>';
}
add_shortcode('post_grid', 'display_grid_func');
我尝试过的方法: - 更改主题 - 关闭所有插件 - 我在谷歌上搜索了一下