wordpress博客主页定制

wordpress blog homepage customization

请不要像往常一样给出负面反馈,而是告诉我错误。

我有一个博客。

我可以让主页显示一篇文章的摘要而不是整篇文章吗?

如果是,那么我在哪里或如何做?

我在我的一个 WordPress 网站中预设了这个。这是它的样子,它在 Appearance/Editor/Posts 页 (home.php)

    <div class="post-content">
        <?php $content = get_the_content(); ?>
        <?php echo wp_trim_words(strip_tags($content), 30); ?>
    </div>

<a class="blog-post-read-more" href="<?php echo esc_url( get_the_permalink( get_the_ID() ) ); ?>"><?php echo esc_html( get_theme_mod( 'relia_blog_read_more', __( 'Read More', 'relia' ) ) ); ?></a>

   </div>

所以它的作用是将单词最多删除 30 个,wp_trim_words。下面是如何插入阅读更多。

这里有一些链接供您查看: https://codex.wordpress.org/Excerpt https://codex.wordpress.org/Customizing_the_Read_More

Create one custom template that template you can assign your home page

    /*
    Template Name: Blog
    */
        query_posts( array( 'post_type' => 'post', 'posts_per_page' => 6, 'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1 ) ) );

<?php if ( have_posts() ) : ?>
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
        <?php get_template_part( 'content', get_post_format());  ?>
<?php endwhile; ?>
<?php the_posts_navigation(); ?>
<?php else : ?>
<?php get_template_part( 'content', 'none' ); ?>
<?php endif; ?>
wp_reset_postdata();