{"id":953,"date":"2017-11-21T12:47:10","date_gmt":"2017-11-21T17:47:10","guid":{"rendered":"http:\/\/bluegalaxy.info\/codewalk\/?p=953"},"modified":"2017-11-21T12:47:10","modified_gmt":"2017-11-21T17:47:10","slug":"wordpress-how-to-display-excerpts-instead-of-full-posts-on-archive-pages","status":"publish","type":"post","link":"https:\/\/bluegalaxy.info\/codewalk\/2017\/11\/21\/wordpress-how-to-display-excerpts-instead-of-full-posts-on-archive-pages\/","title":{"rendered":"WordPress: How to display excerpts instead of full posts on archive pages"},"content":{"rendered":"<p>In the WordPress dashboard under Settings &#8211;&gt; Reading, there is an option that appears as if it would show summaries of each post on the main page, instead of full posts. Next to &#8220;For each article in a feed, show&#8221;, there are options for &#8220;Full text&#8221; and &#8220;Summary&#8221;.\u00a0 This does not do what I thought it should. It turns out that WordPress does have a way of creating post excerpts, but you have to go into the PHP code in order to enable this.<\/p>\n<p>According to this article on <a href=\"http:\/\/www.wpbeginner.com\/wp-themes\/how-to-display-post-excerpts-in-wordpress-themes\/\">wpbeginner.com<\/a>, the PHP edit would need to occur in index.php, archive.php, or category.php.<\/p>\n<p>They recommend replacing this PHP code:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\">&lt;?php the_content(); ?&gt;<\/pre>\n<p>with this:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\">&lt;?php the_excerpt(); ?&gt;<\/pre>\n<p>However, for my theme I found that the file I actually needed to update was called content.php, found in the theme folder. In order to get excerpts instead of full posts on the main page I changed this line:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\">&lt;?php the_content( __( 'Continue reading &lt;span class=\"meta-nav\"&gt;&amp;rarr;&lt;\/span&gt;', 'hemingway-rewritten' ) ); ?&gt;<\/pre>\n<p>to:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\">&lt;?php the_excerpt( __( 'Continue reading &lt;span class=\"meta-nav\"&gt;&amp;rarr;&lt;\/span&gt;', 'hemingway-rewritten' ) ); ?&gt;<\/pre>\n<p>Now excerpts can be seen on the main &#8220;Home&#8221; page:<br \/>\n<a href=\"http:\/\/bluegalaxy.info\/codewalk\/\">http:\/\/bluegalaxy.info\/codewalk\/<\/a><\/p>\n<p>And on any other archive, such as the month of October:<br \/>\n<a href=\"http:\/\/bluegalaxy.info\/codewalk\/2017\/10\/\">http:\/\/bluegalaxy.info\/codewalk\/2017\/10\/<\/a><\/p>\n<p>Category archive:<br \/>\n<a href=\"http:\/\/bluegalaxy.info\/codewalk\/category\/pandas\/\">http:\/\/bluegalaxy.info\/codewalk\/category\/pandas\/<\/a><\/p>\n<p>Tag archive:<br \/>\n<a href=\"http:\/\/bluegalaxy.info\/codewalk\/tag\/iframe\/\">http:\/\/bluegalaxy.info\/codewalk\/tag\/iframe\/<\/a><\/p>\n<p>And search results:<br \/>\n<a href=\"http:\/\/bluegalaxy.info\/codewalk\/?s=Ubuntu\">http:\/\/bluegalaxy.info\/codewalk\/?s=Ubuntu<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the WordPress dashboard under Settings &#8211;&gt; Reading, there is an option that appears as if it would show summaries of each post on the main page, instead of full posts. Next to &#8220;For each article in a feed, show&#8221;, there are options for &#8220;Full text&#8221; and &#8220;Summary&#8221;.\u00a0 This does not do what I thought &hellip; <a href=\"https:\/\/bluegalaxy.info\/codewalk\/2017\/11\/21\/wordpress-how-to-display-excerpts-instead-of-full-posts-on-archive-pages\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">WordPress: How to display excerpts instead of full posts on archive pages<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[69,9],"class_list":["post-953","post","type-post","status-publish","format-standard","hentry","category-wordpress","tag-php","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/posts\/953","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/comments?post=953"}],"version-history":[{"count":4,"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/posts\/953\/revisions"}],"predecessor-version":[{"id":957,"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/posts\/953\/revisions\/957"}],"wp:attachment":[{"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/media?parent=953"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/categories?post=953"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/tags?post=953"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}