最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to add post thumbnail on posts on sites homepage?

programmeradmin1浏览0评论

I am using 2017 theme and I want to thumbnail to the posts which appears on my site homepage, thumbnail appearing when we visit post but doesn't appear on homepage

I am using 2017 theme and I want to thumbnail to the posts which appears on my site homepage, thumbnail appearing when we visit post but doesn't appear on homepage

Share Improve this question edited Nov 5, 2017 at 13:59 fuxia 107k38 gold badges255 silver badges459 bronze badges asked Nov 5, 2017 at 11:46 Rahul PalveRahul Palve 33 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 0

The best way is to create a child theme so that when changes are made to 2017 theme and you update your theme with repository, your changes are not lost.

How to create a child theme

Then go to the theme folder/template-parts/post/content.php

Approx edit line 54 to add native function get_the_post_thumbnail(); to div.entry-content

below is the code

<div class="entry-content">
        <?php
        get_the_post_thumbnail();
        /* translators: %s: Name of current post */
        the_content( sprintf(
            __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentyseventeen' ),
            get_the_title()
        ) );

        wp_link_pages( array(
            'before'      => '<div class="page-links">' . __( 'Pages:', 'twentyseventeen' ),
            'after'       => '</div>',
            'link_before' => '<span class="page-number">',
            'link_after'  => '</span>',
        ) );
        ?>
    </div><!-- .entry-content -->

This plugin has an option that fixes this problem without needing a child theme https://wordpress/plugins/options-for-twenty-seventeen/

发布评论

评论列表(0)

  1. 暂无评论