我正在使用一个脚本,其中页面的postid已通过脚本include重置。如何通过脚本更改实际的真实帖子ID并重置其值?
这是我所指的脚本。在某处,正在重置postid,以便页面的the_content()调用不再拉动正在查看的当前页面。
我很好,因为这是脚本需要的,但是,一旦这个脚本完成了它,我需要重新设置它。
<?php
//$featpages = get_option('woo_slider_pages_landing');
$featpages = '579,584,537';
$featarr=split(",",$featpages);
$featarr = array_diff($featarr, array(""));
$i = 1;
foreach ( $featarr as $featured_tab ) {
query_posts('page_id=' . $featured_tab); while (have_posts()) : the_post();
?>
<div class="featured-slide" id="slide-<?php echo $i; $i++; ?>" <?php if($i >=3 ){echo 'style="display:none"';} ?>>
<div class="text">
<h2><?php if ( get_post_meta($post->ID, "page_desc", $single = true) <> "" ) { echo get_post_meta($post->ID, "page_desc", $single = true); } else { the_title(); } ?></h2>
<p><?php if ( get_post_meta($post->ID, "page_excerpt", $single = true) <> "" ) { echo get_post_meta($post->ID, "page_excerpt", $single = true); } else { the_excerpt(); } ?></p>
<?php if ( get_post_meta($post->ID, "link_text", $single = true) <> "" and get_post_meta($post->ID, "link_link", $single = true) <> "" ) { ?>
<p><a href="<?php echo get_post_meta($post->ID, "link_link", $single = true); ?>" title="<?php echo get_post_meta($post->ID, "link_text", $single = true); ?>"><?php echo get_post_meta($post->ID, "link_text", $single = true); ?></a></p>
<?php } ?>
</div><!-- /.text -->
<?php if ( get_post_meta($post->ID, "image", $single = true) <> "" ) { ?>
<div class="image">
<img src="<?php echo get_post_meta($post->ID, "image", $single = true); ?>" alt="<?php the_title(); ?>" class="featured" />
</div><!-- /.image -->
<?php } ?>
</div><!-- /.featured-slide -->
<?php endwhile; } //endforeach ?>
答案 0 :(得分:0)
我假设你意味着重置循环?如果是这样你只需添加:
<? wp_reset_query(); ?>
位于脚本底部(结束之后)