doudi7782 2013-12-07 12:41
浏览 17

too long

I am working with wordpress and think I may have made a big mistake along the line somewhere. Initially I noticed that when browsing to my archive.php page I was getting a set of post but the pagination wasn't working. So for example I browsed to an athour archive, the author has 10 posts but my site limit is set to display 5 posts on a page. I see the 5 posts and a link to the next page, but clicking on the link takes me to a 404.

I have altered the WP Query at the top of the archive page, so I figured it was a problem with that...

Anyway, to cut a long story short I stripped back the entire archive page to the very bare example below. Using this as the code for the archive.php page always returns the 'there is no post' text, even though I am viewing the same author's archive page.

Help!

<?php get_header(); ?>

<?php if ( have_posts() ) : ?>

        <h1>We have posts!</h1>

        <?php while ( have_posts() ) : the_post(); ?>

            <p>There is a post here</p>

        <?php endwhile; ?>

    <?php else : ?>
        <p>there is no post here</p>
    <?php endif; ?>

<div><?php posts_nav_link(' ','Previous Page','Next Page'); ?></div>
<div><?php posts_nav_link(' ','Go Back','Go Back'); ?></div>

My header.php looks like:

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/reset.css" />
    <link rel="stylesheet" href="<?php echo get_stylesheet_uri(); ?>" />
    <?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<section id="content" role="main">
  • 写回答

2条回答 默认 最新

  • dtv55860 2013-12-07 13:25
    关注

    There are no errors in your code according to wordpress. These must be an error in your header file or somewhere else.

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题