{"id":261,"date":"2012-02-10T23:22:20","date_gmt":"2012-02-10T23:22:20","guid":{"rendered":"https:\/\/theextremewebdesigns.com\/blog\/?p=261"},"modified":"2012-02-10T23:22:20","modified_gmt":"2012-02-10T23:22:20","slug":"wordpress-limit-excerpt-length","status":"publish","type":"post","link":"https:\/\/theextremewebdesigns.com\/blog\/wordpress-limit-excerpt-length\/","title":{"rendered":"WordPress: Limit excerpt length"},"content":{"rendered":"<p>Have you ever thought of showing limited information about an article on the homepage of your blog? This limited information is called &#8220;Excerpt&#8221;. It can also be called as a &#8220;Post summary&#8221; or &#8220;Description of a post&#8221;. Here is a little\u00a0snippet that will let you, in WordPress, limit excerpt length.<!--more--><\/p>\n<h2>How to Limit excerpt length in WordPress<\/h2>\n<p>Simply paste the following function into functions.php file of your WordPress theme:<\/p>\n<pre class=\"lang:php decode:true\">&lt;?php\n\nfunction limit_excerpt_length($string, $word_limit)\n{\n$words = explode(' ', $string);\n\nreturn implode( ' ', array_slice($words, 0, $word_limit) );\n\n}\n\n?&gt;<\/pre>\n<p>Then simply paste the following line of code in your theme, where you want to limit the excerpt length (most commonly used in index.php file)<\/p>\n<pre class=\"lang:php decode:true\">&lt;?php\n\/\/Simply change the number 50 to a number of your choice to limit the excerpt length\n\/\/up to the specified number\necho limit_excerpt_length(get_the_excerpt(),  '50');\n?&gt;<\/pre>\n<h5>Your turn!<\/h5>\n<p>Do you know of any other ways to limit the excerpt length in WordPress? If yes, please feel free to share with us by commenting below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Have you ever thought of showing limited information about an article on the homepage of your blog? This limited information is called &#8220;Excerpt&#8221;. It can also be called as a &#8220;Post summary&#8221; or &#8220;Description of a post&#8221;. Here is a little\u00a0snippet that will let you, in WordPress, limit excerpt length.<\/p>\n","protected":false},"author":1,"featured_media":114,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_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":""},"categories":[6,13,11,8],"tags":[31,30],"class_list":["post-261","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-snippets","category-tips-and-tricks","category-wordpress-tips-and-tricks","category-wordpress","tag-wordpress-snippets","tag-wordpress-tips"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/paBnQX-4d","jetpack_sharing_enabled":true,"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts\/261","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/comments?post=261"}],"version-history":[{"count":0,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts\/261\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/media?parent=261"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/categories?post=261"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/tags?post=261"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}