第一个循环的偏移使第二个循环停止分页

时间:2018-11-01 13:18:41

标签: wordpress loops

面对一个问题,当我将自定义from discord.ext.commands import Bot from collections import Counter bot = Bot(command_prefix='!') @bot.command(pass_context=True) async def listroles(ctx): mentions = [role.mention for role in ctx.message.author.roles if role.mentionable] await bot.say(" ".join(mentions)) @bot.command(pass_context=True) async def countchannels(ctx): counts = Counter(channel.type for channel in ctx.message.server.channels) lines = ["{}: {}".format(k, v) for k, v in counts.items()] await bot.say('\n'.join(lines)) bot.run("token") 的偏移量用于帖子的辅助循环时,它将使其余所有页面停止工作分页,例如所有页面的其余页面都显示相同的帖子。

这是代码。

wp_query

针对第一个精选帖子循环

<?php
    global $wp_query,  $paged;
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
?>

用于保留所有显示后的循环。

<div class="featuredpost">
<?php if ( !is_paged() ) : ?> <!-- Start If Condition to Check for It's Blog's Home Page or not -->

<?php   
    query_posts('showposts=1'); /* Condition Specification for how many Post will be show for Featured Posts */
    while (have_posts()) : the_post(); 
?>  <!-- Generic While Condition for setting up the available posts-->

<div class="one-half margin3">
    <?php if (has_post_thumbnail( $post->ID ) ): ?>
    <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'featuredpost' ); ?>
    <a href="<?php the_permalink() ?>" class="featuredpostimga"><img src="<?php echo $image[0]; ?>" alt="<?php the_title(); ?>" class="featuredpostimg"></a>
    <?php endif; ?>
</div>

<div class="one-half featurepostcontent">

    <p class="featuredposttitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></p>
    <p class="postexrpt">
        <?php echo limit_words(get_the_excerpt(), '25'); ?> ...
    </p>

    <span class="postinfo fl">Posted on <em><?php echo get_the_time('F jS, Y'); ?></em></span>
</div>

<?php endwhile; ?>

<?php endif; ?>
<div class="clr"></div>
</div>
<?php wp_reset_query(); ?>

应该是什么问题?

0 个答案:

没有答案
相关问题