我已經創建了自定義模板並使用此模板添加了頁面。 但循環無法正常工作:循環返回文章頁碼(顯然不存在)。 任何人都可以提供一個建議嗎?WordPress的。循環不能在模板文件中工作
的header.php我在自定義模板使用(循環工作正確的index.php文件與此頭):
<head>
<link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_directory'); ?>/css/styles.css" />
<link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_directory'); ?>/css/ptsans.css" />
<link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_directory'); ?>/css/ptserif.css" />
<link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_directory'); ?>/css/neucha.css" />
<script type="text/javascript"></script>
<meta charset="<?php bloginfo('charset'); ?>" />
<meta name="viewport" content="width=device-width" />
<title><?php wp_title(''); ?><?php if(wp_title('', false)) { echo ' |'; } ?> <?php bloginfo('name'); ?></title>
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php wp_head(); ?>
環路是基本太:
<?php while (have_posts()) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="entry-conten clr">
<?php the_content(); ?>
<?php wp_link_pages(array('before' => '<div class="page-links clr">', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>')); ?>
</div><!-- .entry-content -->
<footer class="entry-footer">
<?php edit_post_link(__('Edit Page', 'wpex'), '<span class="edit-link">', '</span>'); ?>
</footer><!-- .entry-footer -->
</article><!-- #post -->
<?php comments_template(); ?>
<?php endwhile; ?>
希望有人可以解釋我做錯了什麼。
你是否在任何地方調用wp_footer()?你真的應該使用wp_enqueue_style,而不是粘貼在文件頂部的css includes中。 –
感謝您的回覆,我將從現在開始使用wp_enqueue_style。是的,我在本頁使用wp_footer() – user1820686