我正在查询具有特定类别的博客帖子(根据模板页面slug,并希望每篇帖子都输出一个滑块、标题和内容。我正在使用wordpress插件Anythingslider for wordpress。我正在创建与帖子slug具有相同类别的幻灯片,以便所有内容都是自动化的,并且更少的复制和粘贴-但是,当我添加do\\u短代码行时,它会复制相同的帖子(因为有很多帖子),而不是显示每个帖子!
有人有什么想法吗?
<?php
$args = array(
\'post_type\' => \'post\',
\'category_name\' => $post->post_name,
\'showposts\' => 20,
);
$the_query = new WP_Query( $args );
$page_id = get_the_ID();
$page_object = get_page( $page_id ); ?>
<div class="project-column">
<h4><?php echo $page_object->post_content; ?></h4>
<h1>Title</h1>
<div id="navigation">
<?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<a href="#<?php echo $post->post_name; ?>"><?php the_title(); ?></a>
<?php endwhile; wp_reset_postdata(); ?>
<?php endif; ?>
</div>
</div>
<?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<div id="<?php echo $post->post_name; ?>"></div>
<div class="entry-container">
<div class="slider-container">
<?php $shortcode = do_shortcode(\'[anything_slides cat=\'.$post->post_name.\']\');
echo apply_filters(\'my_new_filter\',$shortcode); ?>
</div>
<div class="project-column">
<h2><?php the_title(); ?></h2>
<?php echo the_content(); ?>
<hr>
</div>
</div>
<?php endwhile; wp_reset_postdata(); ?>
<?php endif; ?>