Wordpress主题...我的循环错误?

时间:2016-01-26 03:29:38

标签: wordpress themes

循环看起来很好而且没有错误,但是当我对循环进行分页不起作用而且没有更改帖子显示但是页面/ 2或页面/ 3显示在网址中并且循环中的这些错误帖子是显示晚了2个小时或更长时间。

在其他地方,我的代码是:

<div class="uk-grid contenido" id="contenido">
    <div class="uk-width-1-6 uk-hidden-small uk-hidden-medium"></div>
    <div class="uk-width-large-2-6 uk-width-small-1-1 uk-width-medium-1-2">
        <button class="uk-button-primary" type="button">Al momento</button>
        <hr class="uk-grid-divider">
        <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

<article class="uk-article">
    <h2 class="uk-article-title"><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    <p class="uk-article-Meta p4d"><?php the_time('l j'); ?> de <?php the_time('F'); ?> de <?php the_time('Y'); ?> - Hace <?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ); ?> | <?php $categories = get_the_category();
    $separator = ','; $output = ''; if ( ! empty( $categories ) ) {foreach( $categories as $category ) {$output .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '"alt="'.esc_attr(sprintf(__('Ver las noticias en %s', 'textdomain' ), $category->name ) ) . '">' . esc_html( $category->name ) . '</a>' . $separator; } echo trim( $output, $separator );} ?> | <?php if(function_exists('the_views')) { the_views(); } ?></p>
    <p class="uk-article-lead"><?php echo substr(get_the_excerpt(), 0,130); ?>...<a class="more" href="<?php the_permalink(); ?>">(+)</a></p>
    <a href="<?php the_permalink(); ?>"><div class="uk-thumbnail uk-thumbnail-large uk-overlay-hover uk-overlay-grayscale"><?php echo get_the_post_thumbnail($post->ID, 'articulo-normal-index'); ?></div></a>
    <p class="uk-article-meta"><?php $categories = get_the_category();
    $separator = ','; $output = ''; if ( ! empty( $categories ) ) {foreach( $categories as $category ) {$output .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '"alt="'.esc_attr(sprintf(__('Ver las noticias en %s', 'textdomain' ), $category->name ) ) . '">' . esc_html( $category->name ) . '</a>' . $separator; } echo trim( $output, $separator );} ?> / <?php the_title(); ?></p>
    <hr class="uk-article-divider">
</article>
            <?php endwhile; ?>
            <?php numeric_posts_nav(); ?>
        <?php else : ?>
                    <p>Disculpa, no hay articulos</p>
            <?php endif; ?>

    </div>
    <div class="separate uk-hidden-small uk-hidden-medium"></div>
    <div class="uk-width-large-1-6 uk-hidden-small uk-width-medium-1-2 uk-block-muted min-padding">
        <button class="uk-button-primary" type="button">Destacadas</button>
        <hr class="uk-grid-divider">

        <article class="uk-article uk-text-center">
            <?php
                global $post;
                $args = array( 'numberposts' => 10, 'category_name' => 'destacada' );
                $posts = get_posts( $args );
                foreach( $posts as $post ): setup_postdata($post);
            ?>

        <h2 class="uk-article-title-small uk-text-center"><a href="<?php the_permalink(); ?>" title="<?php                      the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
        <p class="uk-article-meta uk-text-center"><?php the_time('l j'); ?> de <?php the_time('F'); ?> de <?php the_time('Y'); ?> -            Hace <?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ); ?></p>
        <a href="<?php the_permalink(); ?>"><div class="uk-thumbnail uk-thumbnail-medium uk-container-center"><?php echo get_the_post_thumbnail($post->ID, 'articulo-destacadas-sidebar'); ?></div></a>
            <hr class="uk-article-divider">
        </article>

            <?php
                endforeach;
            ?>

        <div class="uk-text-center data-uk-lightbox"><?php dynamic_sidebar( 'anuncio-destacadas' ); ?></div>

    </div>
    <?php get_sidebar(); ?>
    <div class="uk-width-1-6"></div>
</div>

0 个答案:

没有答案