{"id":834,"date":"2020-03-02T02:01:54","date_gmt":"1999-01-01T00:00:00","guid":{"rendered":"https:\/\/2020.facekungfu.com\/?p=834"},"modified":"2020-05-22T15:02:31","modified_gmt":"2020-05-22T07:02:31","slug":"how-to-show-only-excerpts-in-blog-post-list-page","status":"publish","type":"post","link":"https:\/\/facekungfu.com\/en\/how-to-show-only-excerpts-in-blog-post-list-page\/","title":{"rendered":"How to show only excerpts in blog (post list) page?"},"content":{"rendered":"\n<p>There are two ways I got this done (any of these will work):<\/p>\n\n\n\n<p>1.<br>content.php is the file that controls this aspect, you should look to that file to change the_content to the_excerpt (for the right conditional tags).<\/p>\n\n\n\n<p>PS: If this affect the main post\/page display, then you need a condition to be added, such as:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if ( is_singular() ) {\n        the_content();\n   } else { the_excerpt(); }<\/code><\/pre>\n\n\n\n<p>As you\u2019ll have to change the theme\u2019s code, make sure you\u2019re working in a child theme.<\/p>\n\n\n\n<p>2.<br>You can edit the theme OR the child theme functions.php file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/* Replace the content with excerpts on home page *\/\nadd_filter( 'the_content', 'replace_content_with_excerpt', 100 );\n\/\/http:\/\/wordpress.stackexchange.com\/a\/77947\/25187\n\n\/**\n * Return excerpt if we are not on a singular post view.\n *\n * @param  string $content\n * @return string\n *\/\nfunction replace_content_with_excerpt( $content ) {\n   if ( is_singular() ) {\n        return $content;\n   }\n\n   \/\/ remove our filter temporarily.\n   \/\/ Otherwise we run into a infinite loop in wp_trim_excerpt().\n   remove_filter( 'the_content', __FUNCTION__, 100 );\n   $excerpt = apply_filters( 'the_excerpt', get_the_excerpt() );\n   add_filter( 'the_content', __FUNCTION__, 100 );\n   return $excerpt;\n}<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Ref: <a href=\"https:\/\/wordpress.org\/support\/topic\/how-do-i-show-only-excerpts-in-twenty-seventeen-theme\/#post-9965481\">https:\/\/wordpress.org\/support\/topic\/how-do-i-show-only-excerpts-in-twenty-seventeen-theme\/#post-9965481<\/a><\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>There are two ways I got this done (any of these will work):<br \/>\n1. content.php is the file that controls this aspect<br \/>\n2. You can edit the theme OR the child theme functions.php file:<\/p>\n","protected":false},"author":1,"featured_media":25120,"comment_status":"open","ping_status":"open","sticky":false,"template":"templates\/template-cover.php","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[588],"tags":[827,826,828],"class_list":["post-834","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","tag-coding","tag-php","tag-template"],"jetpack_publicize_connections":[],"featured_image_src":"https:\/\/facekungfu.com\/wp-content\/uploads\/2020\/04\/Facekungfu-Studio-1200x630-1-600x400.png","featured_image_src_square":"https:\/\/facekungfu.com\/wp-content\/uploads\/2020\/04\/Facekungfu-Studio-1200x630-1.png","author_info":{"display_name":"Green","author_link":"https:\/\/facekungfu.com\/en\/author\/yanggh\/"},"jetpack_featured_media_url":"https:\/\/facekungfu.com\/wp-content\/uploads\/2020\/04\/Facekungfu-Studio-1200x630-1.png","jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/facekungfu.com\/en\/wp-json\/wp\/v2\/posts\/834","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/facekungfu.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/facekungfu.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/facekungfu.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/facekungfu.com\/en\/wp-json\/wp\/v2\/comments?post=834"}],"version-history":[{"count":0,"href":"https:\/\/facekungfu.com\/en\/wp-json\/wp\/v2\/posts\/834\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/facekungfu.com\/en\/wp-json\/wp\/v2\/media\/25120"}],"wp:attachment":[{"href":"https:\/\/facekungfu.com\/en\/wp-json\/wp\/v2\/media?parent=834"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/facekungfu.com\/en\/wp-json\/wp\/v2\/categories?post=834"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/facekungfu.com\/en\/wp-json\/wp\/v2\/tags?post=834"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}