Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/247.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Wordpress旧帖页错误_Php_Wordpress - Fatal编程技术网

Php Wordpress旧帖页错误

Php Wordpress旧帖页错误,php,wordpress,Php,Wordpress,我对自定义wordpress模板有问题 我做了一个分类页面。在冷杉景观上效果很好。 但是当我在第二页上点击较旧的帖子时,浏览器显示404错误 我认为我的查询需要更多的东西,但我不知道是什么问题,或者这是否是问题所在 有人能帮忙吗 这是我的代码: <?php /** * The template for displaying Category pages */ ?> <?php get_header(); ?> <?php get_template_part(

我对自定义wordpress模板有问题

我做了一个分类页面。在冷杉景观上效果很好。 但是当我在第二页上点击较旧的帖子时,浏览器显示404错误

我认为我的查询需要更多的东西,但我不知道是什么问题,或者这是否是问题所在

有人能帮忙吗

这是我的代码:

<?php
/**
 * The template for displaying Category pages
 */
?>
<?php get_header(); ?>

<?php get_template_part( 'partials/linea-content', 'page' ); ?>

<div class="index categories">
    <div class="col-xs-12 pre-content">
        <div class="container">
            <?php //Para añadir contenido se interesa ?>
        </div>
    </div>
    <div class="container">
        <div class="row">
            <div class="col-xs-12 categories-title">
                <h2>Categoria: <span><?php echo get_category(get_query_var('cat'))->name; ?></span></h2>
            </div>
            <div id="posts" class="col-xs-12 col-sm-9">
                <?php
                    // set the "paged" parameter (use 'page' if the query is on a static front page)
                    $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;

                    // Cambiamos los argumentos para buscar desde la última
                    $args = array(
                                    'posts_per_page' => 2,
                                    'orderby' => 'date',
                                    'order' => ASC,
                                    'category__in' => get_category(get_query_var('cat'))->cat_ID,
                                    'paged' => $paged
                                );
                    // '&orderby=date&order=ASC&category=' . get_category(get_query_var('cat'))->cat_ID;

                    // volvemos a crear la consulta principal
                    $aux = query_posts( $args );

                    $cont_items = 1;
                ?>
                <?php if ( have_posts() ) : ?>
                    <div class="row items-row">
                        <div class="col-xs-12">
                        <?php while ( have_posts() ) : the_post(); ?>

                            <!-- post -->                            
                            <div id="post-id-<?php echo $post->ID; ?>" class="item col-xs-12 col-sm-6">
                                <div class="row">
                                    <div class="col-xs-12 text-center item-content">
                                        <span class="meta-category">
                                            <span class="meta-category-inner">
                                                <?php
                                                    $cat = get_the_category($post->ID);
                                                ?>
                                                <a href="<?php echo get_category_link($cat[0]->cat_ID); ?>" rel="category tag"><?php echo $cat[0]->name; ?></a>
                                            </span>
                                        </span>

                                        <?php
                                            global $wpdb;
                                            $ppbv_tablename = $wpdb->prefix . 'popular_by_views';
                                            $currentRow = $wpdb->get_row("SELECT * FROM {$ppbv_tablename} WHERE post_id = {$post->ID}");
                                            $curView = 0;

                                            if(isset($currentRow))
                                            {
                                                $curView = $currentRow->views;
                                            }
                                        ?>
                                        <div class="item-title-content">
                                            <a href="<?php the_permalink(); ?>" title="Popsicase">
                                                <h2 class="item-title col-xs-10 col-xs-offset-1"><?php the_title(); ?></h2>
                                            </a>
                                        </div>
                                        <p class="date-cat">
                                            <small class="col-xs-12">
                                                <a href="<?php the_author(); ?>" title=""><i class="fa fa-link"></i> <strong><?php the_author(); ?></strong></a>&nbsp;|&nbsp;<span><i class="fa fa-calendar"></i> <?php echo get_the_date();?>&nbsp;|&nbsp;<i class="fa fa-eye"></i> <?php echo $curView; ?></span>
                                            </small>
                                        </p>

                                        <?php
                                            $img_url = get_template_directory_uri() . '/assets/img/podcast.jpg';

                                            if (get_the_post_thumbnail())
                                            {
                                                $img_url = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
                                            }
                                        ?>
                                        <a href="<?php the_permalink(); ?>" title="Popsicase">
                                            <div class="item-thumbnail" style="background:url(<?php echo $img_url; ?>) no-repeat center center;">
                                            </div>
                                        </a>

                                        <div class="row">
                                            <div class="col-xs-6 text-right">
                                                <?php /*<span class="comment"> Comentarios: <?php comments_number( '0','1','%'); ?></span>*/ ?>
                                            </div>
                                        </div>
                                        <div class="item-excerpt text-left">
                                            <div class="col-xs-12">
                                                <?php the_excerpt(); ?>
                                            </div>  
                                        </div>
                                    </div>
                                </div>
                            </div>

                    <?php if ($cont_items % 2 == 0) : ?>
                            </div>
                        </div>
                        <div class="row items-row">
                            <div class="col-xs-12">
                    <?php
                            endif;

                            $cont_items++;
                        ?>
                        <?php endwhile; ?>
                        </div>
                    </div>
                <!-- End of the main loop -->

                <!-- Add the pagination functions here. -->
                <?php
                    the_posts_pagination( array(
                        'mid_size' => 4,
                        'prev_text' => __( 'Artículos antiguos', 'textdomain' ),
                        'next_text' => __( 'Artículos nuevos', 'textdomain' ),
                    ) );
                ?>

                <?php /*
                <div class="nav-previous alignleft"><?php next_posts_link( 'Artículos antiguos' ); ?></div>
                <div class="nav-next alignright"><?php previous_posts_link( 'Artículos nuevos' ); ?></div>
                */ ?>

                <?php else : ?>
                <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
                <?php endif; ?>
            </div>
            <div class="hidden-xs col-sm-3 sidebar">
                <div class="row">
                    <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('main-sidebar')) : ?>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </div>
    <div class="col-xs-12 pos-content">
        <div class="container">
            <?php //Para añadir contenido se interesa ?>
        </div>
    </div>
    <div class="clearfix"></div>
</div>

类别:

| |

*/ ?> */ ?>


您能更详细地解释一下“老文章的第二页”是什么意思吗?是的,在页面底部,在所有相同类别的文章之后,我有一些链接可以找到第一次查看时并没有出现的文章。这是第二页、第三页等的链接。有些链接是这样的:“12…56篇老文章”你明白吗?