为什么下面的代码会导致我的面包屑路径在面包屑中显示相同的post链接,而不管您在站点上的是哪个页面?
我被困在这个问题上已经很久了,我就是想不出.
明白我的意思了,这里。
<!-- Loops through Stories and returns images -->
<ul style="width: 1520px">
<?php
global $post;
$category_id = get_cat_ID('stories');
$args = array( 'numberposts' => 9, 'offset'=> 0, 'category'=> $category_id );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<!-- stories -->
<li>
<figure>
<?php if ( has_post_thumbnail()) : // Check if thumbnail exists ?>
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail(array(64,64)); // Declare pixel size you need inside the array ?></a>
<?php endif; ?>
</figure>
<!-- /post thumbnail -->
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
</li>
<?php endforeach; ?>
</ul>
<!-- /Loops through Stories and returns images -->发布于 2013-09-01 20:26:19
尝试重置后数据,如在这个例子来自“法典”中
<ul>
<?php
global $post;
$args = array( 'numberposts' => 5, 'offset'=> 1, 'category' => 1 );
$myposts = get_posts( $args );
foreach( $myposts as $post ) :
setup_postdata($post); ?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach;
wp_reset_postdata(); ?>
</ul>https://stackoverflow.com/questions/18562368
复制相似问题