我是WordPress主题开发的新手,我在显示帖子时遇到以下问题。
您很容易理解我打开此链接的意思:http://lnx.asper-eritrea.com/25-ottobre-2013-roma-manifestazione-per-le-vittime-di-lampedusa-piazza-montecitorio-ore-10/
正如您所看到的,这是一篇文章,但它没有显示整个文章内容,而是仅显示整个文章内容的大约3行(然后打印[…]我认为这意味着还有其他文本)。
所以进入我的single.php 我找到的文件(显示单个帖子内容的文件):
<header class="header-sezione">
<?php
// Start the Loop.
while ( have_posts() ) : the_post();
/*
* Include the post format-specific template for the content. If you want to
* use this in a child theme, then include a file called called content-___.php
* (where ___ is the post format) and that will be used instead.
*/
get_template_part( \'content\', get_post_format() );
// Previous/next post navigation.
//twentyfourteen_post_nav();
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) {
comments_template();
}
endwhile;
?>
</header>
这是
content.php 文件(显示帖子内容的文件):
<?php
/**
* The default template for displaying content
*
* Used for both single and index/archive/search.
*
* @package WordPress
* @subpackage AsperTheme
* @since AsperTheme 1.0
*/
?>
<!-- Create a div with a unique ID thanks to the_ID() and semantic classes with post_class()
the_ID(): Print the numeric ID of the current post
post_class(): Print out and add various post-related classes to the div tag
-->
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header>
<h2 class="entry-title">
<a href="<?php the_permalink(); ?>"
title="<?php printf(__(\'Permalink to %s\', \'your-theme\'), the_title_attribute(\'echo=0\')); ?>"
rel="bookmark"><?php the_title(); ?>
</a>
</h2>
<div class="entry-meta">
<span class="meta-prep meta-prep-author"><?php _e(\'By \', \'your-theme\'); ?></span>
<span class="author vcard">
<a class="url fn n" href="<?php echo get_author_link(false, $authordata -> ID, $authordata -> user_nicename); ?>"
title="<?php printf(__(\'View all posts by %s\', \'your-theme\'), $authordata -> display_name); ?>"><?php the_author(); ?>
</a>
</span>
<span class="meta-sep"> | </span>
<span class="meta-prep meta-prep-entry-date"><?php _e(\'Published \', \'your-theme\'); ?></span>
<span class="entry-date">
<abbr class="published" title="<?php the_time(\'Y-m-d\\TH:i:sO\') ?>"><?php the_time(get_option(\'date_format\')); ?></abbr>
</span>
<?php edit_post_link( __( \'Edit\', \'your-theme\' ), "<span class=\\"meta-sep\\">|</span>\\n\\t\\t\\t\\t\\t\\t<span class=\\"edit-link\\">", "</span>\\n\\t\\t\\t\\t\\t" ) ?>
</div> <!-- .entry-meta -->
</header>
<div class="entry-content">
<!--<?php the_content(__(\'Continue reading <span class="meta-nav">»</span>\', \'your-theme\')); ?>-->
<?php the_excerpt(); ?>
<?php wp_link_pages(\'before=<div class="page-link">\' . __( \'Pages:\', \'your-theme\' ) . \'&after=</div>\') ?>
</div> <!-- .entry-content -->
<div class="entry-utility">
<span class="cat-links">
<span class="entry-utility-prep entry-utility-prep-cat-links"><?php _e(\'Posted in \', \'your-theme\'); ?></span>
<?php echo get_the_category_list(\', \'); ?>
</span>
<span class="meta-sep"> | </span>
<?php the_tags( \'<span class="tag-links"><span class="entry-utility-prep entry-utility-prep-tag-links">\' . __(\'Tagged \', \'your-theme\' ) . \'</span>\', ", ", "</span>\\n\\t\\t\\t\\t\\t\\t<span class=\\"meta-sep\\">|</span>\\n" ) ?>
<span class="comments-link"><?php comments_popup_link( __( \'Leave a comment\', \'your-theme\' ), __( \'1 Comment\', \'your-theme\' ), __( \'% Comments\', \'your-theme\' ) ) ?></span>
<?php edit_post_link( __( \'Edit\', \'your-theme\' ), "<span class=\\"meta-sep\\">|</span>\\n\\t\\t\\t\\t\\t\\t<span class=\\"edit-link\\">", "</span>\\n\\t\\t\\t\\t\\t\\n" ) ?>
</div> <!-- #entry-utility -->
</article> <!-- #post-<?php the_ID(); ?> -->
所以我认为,当我打开一篇帖子时,我只看到它的开头部分,这取决于
content.php 我有:
<?php the_excerpt(); ?>
是这样吗?如何显示整个帖子,而不仅仅是它的开头部分?
最合适的回答,由SO网友:Robert hue 整理而成
在内容中。php更改<?php the_excerpt(); ?>
具有
<?php the_content(); ?>
或使用此内容。改为php文件。我对您的内容进行了更改。php
<?php
/**
* The default template for displaying content
*
* Used for both single and index/archive/search.
*
* @package WordPress
* @subpackage AsperTheme
* @since AsperTheme 1.0
*/
?>
<!-- Create a div with a unique ID thanks to the_ID() and semantic classes with post_class()
the_ID(): Print the numeric ID of the current post
post_class(): Print out and add various post-related classes to the div tag
-->
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header>
<h2 class="entry-title">
<a href="<?php the_permalink(); ?>"
title="<?php printf(__(\'Permalink to %s\', \'your-theme\'), the_title_attribute(\'echo=0\')); ?>"
rel="bookmark"><?php the_title(); ?>
</a>
</h2>
<div class="entry-meta">
<span class="meta-prep meta-prep-author"><?php _e(\'By \', \'your-theme\'); ?></span>
<span class="author vcard">
<a class="url fn n" href="<?php echo get_author_link(false, $authordata -> ID, $authordata -> user_nicename); ?>"
title="<?php printf(__(\'View all posts by %s\', \'your-theme\'), $authordata -> display_name); ?>"><?php the_author(); ?>
</a>
</span>
<span class="meta-sep"> | </span>
<span class="meta-prep meta-prep-entry-date"><?php _e(\'Published \', \'your-theme\'); ?></span>
<span class="entry-date">
<abbr class="published" title="<?php the_time(\'Y-m-d\\TH:i:sO\') ?>"><?php the_time(get_option(\'date_format\')); ?></abbr>
</span>
<?php edit_post_link( __( \'Edit\', \'your-theme\' ), "<span class=\\"meta-sep\\">|</span>\\n\\t\\t\\t\\t\\t\\t<span class=\\"edit-link\\">", "</span>\\n\\t\\t\\t\\t\\t" ) ?>
</div> <!-- .entry-meta -->
</header>
<div class="entry-content">
<?php the_content(__(\'Continue reading <span class="meta-nav">»</span>\', \'your-theme\')); ?>
<?php // the_excerpt(); ?>
<?php wp_link_pages(\'before=<div class="page-link">\' . __( \'Pages:\', \'your-theme\' ) . \'&after=</div>\') ?>
</div> <!-- .entry-content -->
<div class="entry-utility">
<span class="cat-links">
<span class="entry-utility-prep entry-utility-prep-cat-links"><?php _e(\'Posted in \', \'your-theme\'); ?></span>
<?php echo get_the_category_list(\', \'); ?>
</span>
<span class="meta-sep"> | </span>
<?php the_tags( \'<span class="tag-links"><span class="entry-utility-prep entry-utility-prep-tag-links">\' . __(\'Tagged \', \'your-theme\' ) . \'</span>\', ", ", "</span>\\n\\t\\t\\t\\t\\t\\t<span class=\\"meta-sep\\">|</span>\\n" ) ?>
<span class="comments-link"><?php comments_popup_link( __( \'Leave a comment\', \'your-theme\' ), __( \'1 Comment\', \'your-theme\' ), __( \'% Comments\', \'your-theme\' ) ) ?></span>
<?php edit_post_link( __( \'Edit\', \'your-theme\' ), "<span class=\\"meta-sep\\">|</span>\\n\\t\\t\\t\\t\\t\\t<span class=\\"edit-link\\">", "</span>\\n\\t\\t\\t\\t\\t\\n" ) ?>
</div> <!-- #entry-utility -->
</article> <!-- #post-<?php the_ID(); ?> -->