{"id":1534,"date":"2015-08-03T07:52:03","date_gmt":"2015-08-03T07:52:03","guid":{"rendered":"http:\/\/www.nikola-breznjak.com\/blog\/?p=1534"},"modified":"2015-08-03T07:52:03","modified_gmt":"2015-08-03T07:52:03","slug":"how-to-add-excerpts-to-your-wordpress-blog-homepage-in-a-twentythirteen-theme-and-not-break-the-codeproject-importer","status":"publish","type":"post","link":"https:\/\/nikola-breznjak.com\/blog\/codeproject\/how-to-add-excerpts-to-your-wordpress-blog-homepage-in-a-twentythirteen-theme-and-not-break-the-codeproject-importer\/","title":{"rendered":"How to add excerpts to your WordPress blog homepage in a TwentyThirteen theme and not break the Codeproject importer"},"content":{"rendered":"<p>As you may know, CodeProject has a thing called <a href=\"http:\/\/www.codeproject.com\/Articles\/66029\/Code-Project-Technical-Blog-FAQ\">Technical blogs<\/a> which lets you publish your post on their site too, and thus widening the range of potential readers.<\/p>\n<p>Thanks to a <a href=\"http:\/\/www.codeproject.com\/Articles\/62235\/Wordpress-Plugin-to-feed-CodeProject-Technical-Blo\">great plugin<\/a> by hjgode you can automatically import your posts.<\/p>\n<p>However, recently I wanted just to show excerpts of the posts on my blog homepage and in the archives. The problem was that that stopped the importer from collecting the posts that are marked with the <a href=\"http:\/\/nikola-breznjak.com\/blog\/category\/codeproject\/\">codeproject\u00a0category<\/a>\u00a0because the posts were too short according to their rules (1000 words minimum).<\/p>\n<p>I solved this in my \u00a0TwentyThirteen theme by doing slight changes in <strong>content.php<\/strong> (around line 33), which by default looks like this:<\/p>\n<pre class=\"lang:default decode:true\">&lt;?php if ( is_search() ) : \/\/ Only display Excerpts for Search ?&gt;<\/pre>\n<p>This line displays excerpts only on a search page, and to show excerpts on\u00a0homepage I did:<\/p>\n<pre class=\"lang:default decode:true\">&lt;?php if ( is_search() || is_home() ) : \u00a0?&gt;<\/pre>\n<p>You just have to make sure that you don&#8217;t include the<\/p>\n<pre class=\"lang:default decode:true \">is_category()<\/pre>\n<p>and you&#8217;re all set.<\/p>\n<p>True, you could further optimize this in a way that you would show excerpts for all other categories except &#8220;codeproject&#8221;.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As you may know, CodeProject has a thing called Technical blogs which lets you publish your post on their site too, and thus widening the range of potential&hellip;<\/p>\n","protected":false},"author":1,"featured_media":2003,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,15,40],"tags":[],"class_list":["post-1534","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-codeproject","category-quick-tips","category-wordpress"],"_links":{"self":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts\/1534","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/comments?post=1534"}],"version-history":[{"count":3,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts\/1534\/revisions"}],"predecessor-version":[{"id":2002,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts\/1534\/revisions\/2002"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/media\/2003"}],"wp:attachment":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/media?parent=1534"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/categories?post=1534"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/tags?post=1534"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}