我想这很容易做到:只需把索引中的所有内容都取下来。php。添加
<?php
/*
Template Name: Blog
*/
?>
在顶端,你们都准备好了,但在我的情况下,它不起作用。我复制了索引中的所有内容。php,创建模板博客。php并通过新页面添加为“new”。这是我得到的结果:
http://bellated.us.lt/new/ (测试页)
看起来博客的循环正在开始,但它并没有像应该的那样通过。任何帮助都将不胜感激。谢谢
<?php
/*
Template Name: Blog
*/
?>
<?php get_header(); ?>
<!-- BEGIN #content-wrap -->
<div id="content-wrap" class="clearfix">
<div id="content-top"> </div>
<!--BEGIN #primary .hfeed-->
<div id="primary" class="hfeed">
<?php if (have_posts()) : ?>
<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
<?php /* If this is a category archive */ if (is_category()) { ?>
<h1 class="page-title"><?php printf(__(\'Visi įrašai iš %s\', \'framework\'), single_cat_title(\'\',false)); ?></h1>
<?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
<h1 class="page-title"><?php printf(__(\'Įrašų ėymĖs %s\', \'framework\'), single_tag_title(\'\',false)); ?></h1>
<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
<h1 class="page-title"><?php _e(\'Archyvas\', \'framework\') ?> <?php the_time(\'F jS, Y\'); ?></h1>
<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
<h1 class="page-title"><?php _e(\'Archyvas\', \'framework\') ?> <?php the_time(\'F, Y\'); ?></h1>
<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
<h1 class="page-title"><?php _e(\'Archyvas\', \'framework\') ?> <?php the_time(\'Y\'); ?></h1>
<?php /* If this is an author archive */ } elseif (is_author()) { ?>
<h1 class="page-title"><?php _e(\'Visi įrašai pagal\', \'framework\') ?> <?php echo $curauth->display_name; ?></h1>
<?php /* If this is a category archive */} elseif (is_search()) { ?>
<h1 class="page-title"><?php _e(\'Paieškos rezultatai: \', \'framework\'); echo \'"\'.$_GET[\'s\'].\'"\'; ?></h1>
<?php } ?>
<?php while (have_posts()) : the_post(); ?>
<!--BEGIN .hentry -->
<div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
<h2 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php printf(__(\'Permanent Link to %s\', \'framework\'), get_the_title()); ?>"> <?php the_title(); ?></a></h2>
<!--BEGIN .entry-meta .entry-header-->
<div class="entry-meta entry-header">
<span><?php _e(\'pagal\', \'framework\') ?></span> <?php the_author(); ?> <span><?php _e(\'·\', \'framework\') ?></span> <?php the_time(\'Y/m/j H:i\'); ?> <span><?php _e(\'·\', \'framework\') ?></span> <?php the_category(\', \') ?> <span><?php _e(\'·\', \'framework\') ?></span> <?php comments_popup_link(__(\'Komentarų nėra\', \'framework\'), __(\'1 Komentaras\', \'framework\'), __(\'% Komentarai\', \'framework\')); ?> <?php edit_post_link( __(\'\', \'framework\'), \'<span class="edit-post">[\', \']</span>\' ); ?><a href="http://twitter.com/share" class="twitter-share-button" data-url="<?php the_permalink(); ?>" data-text="<?php bloginfo(\'name\'); ?>: <?php the_title(); ?>," data-count="horizontal">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
</div>
<?php /* if the post has a WP 2.9+ Thumbnail */
if ( (function_exists(\'has_post_thumbnail\')) && (has_post_thumbnail()) ) : ?>
<div class="post-thumb post-lead">
<a title="<?php printf(__(\'Permanent Link to %s\', \'framework\'), get_the_title()); ?>" href="<?php the_permalink(); ?>"><?php the_post_thumbnail(\'archive-thumb\'); /* post thumbnail settings configured in functions.php */ ?></a>
</div>
<?php endif; ?>
<!--BEGIN .entry-content -->
<div class="entry-content">
<?php the_content(__(\'Skaityti toliau →\', \'framework\')); ?>
<!--END .entry-content -->
</div>
<!--END .hentry-->
</div>
<?php endwhile; ?>
<!--BEGIN .navigation .page-navigation -->
<div class="navigation page-navigation clearfix">
<?php if(function_exists(\'wp_pagenavi\')) { wp_pagenavi(); } else { ?>
<div class="nav-next"><?php next_posts_link(__(\'← Senesni įrašai\', \'framework\')) ?></div>
<div class="nav-previous"><?php previous_posts_link(__(\'Naujesni įrašai →\', \'framework\')) ?></div>
<?php } ?>
<!--END .navigation ,page-navigation -->
</div>
<?php else : ?>
<!--BEGIN #post-0-->
<div id="post-0" <?php post_class(); ?>>
<h2 class="entry-title"><?php _e(\'Ups, puslapis nerastas\', \'framework\') ?></h2>
<!--BEGIN .entry-content-->
<div class="entry-content">
<p><?php _e("Atsiprašome, bet puslapis, kurio ieškote nerastas.", "framework") ?></p>
<?php get_search_form(); ?>
<!--END .entry-content-->
</div>
<!--END #post-0-->
</div>
<?php endif; ?>
<!--END #primary .hfeed-->
</div>
<div id="content-btm"> </div>
<!-- END #content-wrap -->
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>