{"id":59941,"date":"2016-04-27T14:10:12","date_gmt":"2016-04-27T14:10:12","guid":{"rendered":"https:\/\/br.wordpress.org\/support\/topic\/mantendo-tags-e-shortcodes-no-excerpt\/"},"modified":"2016-08-06T01:46:05","modified_gmt":"2016-08-06T01:46:05","slug":"mantendo-tags-e-shortcodes-no-excerpt","status":"publish","type":"topic","link":"https:\/\/br.wordpress.org\/support\/topic\/mantendo-tags-e-shortcodes-no-excerpt\/","title":{"rendered":"Mantendo Tags e Shortcodes no excerpt"},"content":{"rendered":"<p>Bom dia Pessoal, preciso manter as tags e shortcodes no excerpt dos posts na home, mas o meu tema n\u00e3o permite mesmo com o uso do aplicativo, segue o c\u00f3digo php do excerpt do meu tema:<\/p>\n<p>&lt;?php<br \/>\n\/**<br \/>\n * Functions for loading template parts.<br \/>\n *<br \/>\n * @package    BetterTemplate<br \/>\n * @author     BetterStudio &lt;info@betterstudio.com&gt;<br \/>\n * @copyright  Copyright (c) 2015, BetterStudio<br \/>\n *\/<\/p>\n<p>if( ! function_exists( &#8216;better_get_content_template&#8217; ) ){<br \/>\n\t\/**<br \/>\n\t * Loads a post content template based off the post type and\/or the post format.<br \/>\n\t *<br \/>\n\t * @since  1.0.0<br \/>\n\t * @access public<br \/>\n\t * @return string<br \/>\n\t *\/<br \/>\n\tfunction better_get_content_template(){<\/p>\n<p>\t\t\/\/ Set up an empty array and get the post type.<br \/>\n\t\t$templates = array();<br \/>\n\t\t$post_type = get_post_type();<\/p>\n<p>\t\t$style = better_get_style();<\/p>\n<p>\t\t\/\/ Template based on the format if post type supports the post format.<br \/>\n\t\tif( post_type_supports( $post_type, &#8216;post-formats&#8217; ) ){<\/p>\n<p>\t\t\t$post_format = get_post_format() ? get_post_format() : &#8216;standard&#8217;;<\/p>\n<p>\t\t\t\/\/ Template based off the post format.<br \/>\n\t\t\t$templates[] = &#8220;views\/{$style}\/{$post_type}\/content-{$post_format}.php&#8221;;<\/p>\n<p>\t\t\t\/\/ Fallback to general template<br \/>\n\t\t\tif( $style != &#8216;general&#8217; )<br \/>\n\t\t\t\t$templates[] = &#8220;views\/general\/{$post_type}\/content-{$post_format}.php&#8221;;<\/p>\n<p>\t\t}<\/p>\n<p>\t\t\/\/ Fallback to &#8216;content.php&#8217; template.<br \/>\n\t\t$templates[] = &#8220;views\/{$style}\/{$post_type}\/content.php&#8221;;<\/p>\n<p>\t\tif( $style != &#8216;general&#8217; )<br \/>\n\t\t\t$templates[] = &#8216;views\/general\/post\/content.php&#8217;;<\/p>\n<p>\t\t\/\/ Allow developers to filter the content template hierarchy.<br \/>\n\t\t$templates = apply_filters( &#8216;better-template\/content&#8217;, $templates );<\/p>\n<p>\t\t\/\/ Return the found content template.<br \/>\n\t\tinclude( locate_template( $templates, false, false ) );<br \/>\n\t} \/\/ better_get_content_template<br \/>\n} \/\/ if<\/p>\n<p>if( ! function_exists( &#8216;better_the_excerpt&#8217; ) ){<br \/>\n\t\/**<br \/>\n\t * Used to get excerpt of post, Supports word truncation on custom excerpts<br \/>\n\t *<br \/>\n\t * @param   integer|null $length        Length of final excerpt words<br \/>\n\t * @param   string|null  $text          Excerpt manual text<br \/>\n\t * @param   bool         $echo          Echo or return<br \/>\n\t * @param   bool         $post_formats  Exception handler to show full content of post formats<br \/>\n\t *<br \/>\n\t * @return string<br \/>\n\t *\/<br \/>\n\tfunction better_the_excerpt( $length = 55, $text = NULL, $echo = true, $post_formats = true ){<\/p>\n<p>\t\t\/\/ Post format exception to show post full content<br \/>\n\t\tif( $post_formats ){<\/p>\n<p>\t\t\tif( in_array( get_post_format(), array( &#8216;quote&#8217;, &#8216;chat&#8217; ) ) ){<\/p>\n<p>\t\t\t\tif( $echo ){<br \/>\n\t\t\t\t\tthe_content( &#8221; );<br \/>\n\t\t\t\t\treturn;<br \/>\n\t\t\t\t}<br \/>\n\t\t\t\telse{<br \/>\n\t\t\t\t\tob_start();<br \/>\n\t\t\t\t\tthe_content( &#8221; );<br \/>\n\t\t\t\t\treturn ob_get_clean();<br \/>\n\t\t\t\t}<\/p>\n<p>\t\t\t}<\/p>\n<p>\t\t}<\/p>\n<p>\t\t\/\/ If text not defined get excerpt<br \/>\n\t\tif( ! $text ){<\/p>\n<p>\t\t\t\/\/ Have a manual excerpt?<br \/>\n\t\t\tif( has_excerpt( get_the_ID() ) ){<\/p>\n<p>\t\t\t\t\/\/ Manual excerpt should be contracted or not?<br \/>\n\t\t\t\tif( is_null( $length ) ){<\/p>\n<p>\t\t\t\t\tif( $echo ){<\/p>\n<p>\t\t\t\t\t\techo apply_filters( &#8216;the_excerpt&#8217;, get_the_excerpt() );<br \/>\n\t\t\t\t\t\treturn;<\/p>\n<p>\t\t\t\t\t}else{<\/p>\n<p>\t\t\t\t\t\treturn apply_filters( &#8216;the_excerpt&#8217;, get_the_excerpt() );<\/p>\n<p>\t\t\t\t\t}<\/p>\n<p>\t\t\t\t}else{<br \/>\n\t\t\t\t\t$text = get_the_excerpt();<br \/>\n\t\t\t\t}<\/p>\n<p>\t\t\t}else{<br \/>\n\t\t\t\t$text = get_the_content( &#8221; );<br \/>\n\t\t\t}<\/p>\n<p>\t\t}<\/p>\n<p>\t\t\/\/ Remove shortcodes<br \/>\n\t\t$text = strip_shortcodes( $text );<br \/>\n\t\t$text = str_replace( &#8216;]]&gt;&#8217;, &#8216;]]&gt;&#8217;, $text );<\/p>\n<p>\t\t\/\/ get plaintext excerpt trimmed to right length<br \/>\n\t\t$excerpt = wp_trim_words( $text, $length, &#8216;&hellip;&#8217; );<\/p>\n<p>\t\t\/\/ fix extra spaces<br \/>\n\t\t$excerpt = trim( str_replace(&#8216;&nbsp;&#8216;, &#8216; &#8216;, $excerpt ) );<\/p>\n<p>\t\tif( $echo )<br \/>\n\t\t\techo wpautop( $excerpt );<br \/>\n\t\telse<br \/>\n\t\t\treturn wpautop( $excerpt );<br \/>\n\t} \/\/ better_the_excerpt<br \/>\n} \/\/ if<\/p>\n<p>if( ! function_exists( &#8216;better_the_content&#8217; ) ){<br \/>\n\t\/**<br \/>\n\t * Used to get excerpt of post, Supports word truncation on custom excerpts<br \/>\n\t *<br \/>\n\t * @param   string  $more_link_text     Optional. Content for when there is more text.<br \/>\n\t * @param   bool    $strip_teaser       Optional. Strip teaser content before the more text. Default is false.<br \/>\n\t * @param   bool    $echo               Echo or return<br \/>\n\t *<br \/>\n\t * @return string<br \/>\n\t *\/<br \/>\n\tfunction better_the_content( $more_link_text = null, $strip_teaser = false, $echo = true ){<\/p>\n<p>\t\t\/\/ Post Links<br \/>\n\t\t$post_links_attr = array(<br \/>\n\t\t\t&#8216;before&#8217;        =&gt; &#8216;&lt;div class=&#8221;pagination bs-numbered-pagination&#8221; itemprop=&#8221;pagination&#8221;&gt;&lt;span class=&#8221;span&#8221;&gt;&#8217; . ( function_exists( &#8216;Better_Translation&#8217; )  ? Better_Translation()-&gt;_get( &#8216;post_pages&#8217; ) : __( &#8216;Post pages:&#8217;, &#8216;better-studio&#8217; ) ) . &#8216; &lt;\/span&gt;&#8217;,<br \/>\n\t\t\t&#8216;after&#8217;         =&gt; &#8216;&lt;\/div&gt;&#8217;,<br \/>\n\t\t\t&#8216;echo&#8217;          =&gt;  0,<br \/>\n\t\t\t&#8216;pagelink&#8217;      =&gt; &#8216;&lt;span&gt;%&lt;\/span&gt;&#8217;,<br \/>\n\t\t);<\/p>\n<p>\t\t\/\/ Gallery post format<br \/>\n\t\tif( get_post_format() == &#8216;gallery&#8217; ){<\/p>\n<p>\t\t\t$content = get_the_content( $more_link_text, $strip_teaser );<\/p>\n<p>\t\t\t$content = better_strip_first_shortcode_gallery( $content );<\/p>\n<p>\t\t\t$content = str_replace(&#8216;]]&gt;&#8217;, &#8216;]]&gt;&#8217;, apply_filters( &#8216;the_content&#8217;, $content ) );<\/p>\n<p>\t\t\t$content .= wp_link_pages( $post_links_attr );<\/p>\n<p>\t\t}<br \/>\n\t\t\/\/ All Post Formats<br \/>\n\t\telse{<br \/>\n\t\t\t$content = apply_filters( &#8216;the_content&#8217;, get_the_content( $more_link_text, $strip_teaser ) ) . wp_link_pages( $post_links_attr );<br \/>\n\t\t}<\/p>\n<p>\t\tif( $echo )<br \/>\n\t\t\techo $content;<br \/>\n\t\telse<br \/>\n\t\t\treturn $content;<br \/>\n\t} \/\/ better_the_content<br \/>\n} \/\/ if<\/p>\n<p>if( ! function_exists( &#8216;better_get_related_posts_args&#8217; ) ){<br \/>\n\t\/**<br \/>\n\t * Get Related Posts<br \/>\n\t *<br \/>\n\t * @param integer      $count number of posts to return<br \/>\n\t * @param string       $type<br \/>\n\t * @param integer|null $post_id<br \/>\n\t *<br \/>\n\t * @return WP_Query<br \/>\n\t *\/<br \/>\n\tfunction better_get_related_posts_args( $count = 5, $type = &#8216;cat&#8217;, $post_id = NULL ) {<\/p>\n<p>\t\tglobal $post;<\/p>\n<p>\t\tif( ! $post_id ){<br \/>\n\t\t\t$post_id = $post-&gt;ID;<br \/>\n\t\t}<\/p>\n<p>\t\t$args = array(<br \/>\n\t\t\t&#8216;posts_per_page&#8217; =&gt; $count,<br \/>\n\t\t\t&#8216;post__not_in&#8217;   =&gt; array( $post_id )<br \/>\n\t\t);<\/p>\n<p>\t\tswitch( $type ) {<\/p>\n<p>\t\t\tcase &#8216;cat&#8217;:<br \/>\n\t\t\t\t$args[&#8216;category__in&#8217;] = wp_get_post_categories( $post_id );<br \/>\n\t\t\t\tbreak;<\/p>\n<p>\t\t\tcase &#8216;tag&#8217;:<br \/>\n\t\t\t\t$args[&#8216;tag__in&#8217;] = wp_get_object_terms( $post_id, &#8216;post_tag&#8217;, array( &#8216;fields&#8217; =&gt; &#8216;ids&#8217; ) );<br \/>\n\t\t\t\tbreak;<\/p>\n<p>\t\t\tcase &#8216;author&#8217;:<br \/>\n\t\t\t\t$args[&#8216;author&#8217;] = $post-&gt;post_author;<br \/>\n\t\t\t\tbreak;<\/p>\n<p>\t\t\tcase &#8216;cat-tag&#8217;:<br \/>\n\t\t\t\t$args[&#8216;category__in&#8217;] = wp_get_post_categories( $post_id );<br \/>\n\t\t\t\t$args[&#8216;tag__in&#8217;]      = wp_get_object_terms( $post_id, &#8216;post_tag&#8217;, array( &#8216;fields&#8217; =&gt; &#8216;ids&#8217; ) );<br \/>\n\t\t\t\tbreak;<\/p>\n<p>\t\t\tcase &#8216;cat-tag-author&#8217;:<br \/>\n\t\t\t\t$args[&#8216;author&#8217;]       = $post-&gt;post_author;<br \/>\n\t\t\t\t$args[&#8216;category__in&#8217;] = wp_get_post_categories( $post_id );<br \/>\n\t\t\t\t$args[&#8216;tag__in&#8217;]      = wp_get_object_terms( $post_id, &#8216;post_tag&#8217;, array( &#8216;fields&#8217; =&gt; &#8216;ids&#8217; ) );<br \/>\n\t\t\t\tbreak;<\/p>\n<p>\t\t}<\/p>\n<p>\t\treturn apply_filters( &#8216;better-template\/related-posts\/args&#8217;, $args );<\/p>\n<p>\t} \/\/ better_get_related_posts_args<br \/>\n} \/\/ if<\/p>\n<p>if( ! function_exists( &#8216;better_get_post_primary_cat&#8217; ) ){<br \/>\n\t\/**<br \/>\n\t * Returns post main category object<br \/>\n\t *<br \/>\n\t * @return array|mixed|null|object|WP_Error<br \/>\n\t *\/<br \/>\n\tfunction better_get_post_primary_cat() {<\/p>\n<p>\t\t\/\/ Fix for in category archive page and having multiple category<br \/>\n\t\tif( is_category() ){<br \/>\n\t\t\tif( has_category( get_query_var( &#8216;cat&#8217; ) ) ){<br \/>\n\t\t\t\t$category = get_category( get_query_var( &#8216;cat&#8217; ) );<br \/>\n\t\t\t} else {<br \/>\n\t\t\t\t$category = current( get_the_category() );<br \/>\n\t\t\t}<br \/>\n\t\t} \/\/ Primary category for singles<br \/>\n\t\telse {<\/p>\n<p>\t\t\t$prim_cat = bf_get_post_meta( &#8216;_bs_primary_category&#8217;, NULL, &#8216;auto-detect&#8217; );<\/p>\n<p>\t\t\tif( $prim_cat === &#8216;auto-detect&#8217; ){<br \/>\n\t\t\t\t$category = current( get_the_category() );<br \/>\n\t\t\t} else {<br \/>\n\t\t\t\t$category = get_category( $prim_cat );<br \/>\n\t\t\t}<\/p>\n<p>\t\t}<\/p>\n<p>\t\treturn $category;<br \/>\n\t} \/\/ better_get_post_primary_cat<br \/>\n} \/\/ if<\/p>\n<p>if( ! function_exists( &#8216;better_cats_badge_code&#8217; ) ){<br \/>\n\t\/**<br \/>\n\t * Handy function used to get post category badge<br \/>\n\t *<br \/>\n\t * @param   integer $cats_count Categories count, Default only primary or first cat<br \/>\n\t * @param   string  $sep        Separator for categories<br \/>\n\t * @param   bool    $show_format<br \/>\n\t * @param   bool    $echo       Echo or return<br \/>\n\t * @param   string  $class<br \/>\n\t *<br \/>\n\t * @return string<br \/>\n\t *\/<br \/>\n\tfunction better_cats_badge_code( $cats_count = 1, $sep = &#8221;, $show_format = false, $echo = true, $class = &#8221; ){<\/p>\n<p>\t\tif( get_post_type() == &#8216;post&#8217; ){<\/p>\n<p>\t\t\t$output = &#8216;&lt;div class=&#8221;term-badges &#8216; . $class .'&#8221;&gt;&#8217;; \/\/ temp<\/p>\n<p>\t\t\t$cat_code = array(); \/\/ temp<\/p>\n<p>\t\t\t\/\/ Add post format icon<br \/>\n\t\t\tif( $show_format ){<\/p>\n<p>\t\t\t\t$format = get_post_format();<\/p>\n<p>\t\t\t\tif( $format ){<\/p>\n<p>\t\t\t\t\t$cat_code[] = better_format_badge_code( false );<\/p>\n<p>\t\t\t\t}<\/p>\n<p>\t\t\t} \/\/ show format if<\/p>\n<p>\t\t\t\/\/ All Cats<br \/>\n\t\t\tif( $cats_count == -1 ){<\/p>\n<p>\t\t\t\t$cats = get_the_category();<\/p>\n<p>\t\t\t\t$prim_cat = better_get_post_primary_cat();<\/p>\n<p>\t\t\t\t\/\/ Show prim cat at first<br \/>\n\t\t\t\tif( has_category( $prim_cat ) ){<br \/>\n\t\t\t\t\t$prim_category = get_term( $prim_cat, &#8216;category&#8217; );<br \/>\n\t\t\t\t\t$cat_code[] = &#8216;&lt;span class=&#8221;term-badge term-&#8216; . $prim_category-&gt;term_id . &#8216;&#8221;&gt;<a href=\"' . esc_url( get_category_link( $prim_category ) ) . '\">&#8216; . esc_html( $prim_category-&gt;name ) . &#8216;<\/a>&lt;\/span&gt;&#8217;;<br \/>\n\t\t\t\t}<\/p>\n<p>\t\t\t\tforeach( $cats as $cat_id =&gt; $cat ){<\/p>\n<p>\t\t\t\t\t\/\/ remove prim cat<br \/>\n\t\t\t\t\tif( $cat-&gt;cat_ID == $prim_cat-&gt;cat_ID ){<br \/>\n\t\t\t\t\t\tcontinue;<br \/>\n\t\t\t\t\t}<\/p>\n<p>\t\t\t\t\t$cat_code[] = &#8216;&lt;span class=&#8221;term-badge term-&#8216; . $cat-&gt;cat_ID . &#8216;&#8221;&gt;<a href=\"' . esc_url( get_category_link( $cat ) ) . '\">&#8216; . esc_html( $cat-&gt;name ) . &#8216;<\/a>&lt;\/span&gt;&#8217;;<br \/>\n\t\t\t\t}<\/p>\n<p>\t\t\t}<\/p>\n<p>\t\t\t\/\/ Specific Count<br \/>\n\t\t\telseif( $cats_count &gt; 1 ){<\/p>\n<p>\t\t\t\t$cats = get_the_category();<\/p>\n<p>\t\t\t\t$prim_cat = better_get_post_primary_cat();<\/p>\n<p>\t\t\t\t\/\/ Show prim cat at first<br \/>\n\t\t\t\tif( has_category( $prim_cat ) ){<br \/>\n\t\t\t\t\t$prim_category = get_term( $prim_cat, &#8216;category&#8217; );<br \/>\n\t\t\t\t\t$cat_code[] = &#8216;&lt;span class=&#8221;term-badge term-&#8216; . $prim_category-&gt;term_id . &#8216;&#8221;&gt;<a href=\"' . esc_url( get_category_link( $prim_category ) ) . '\">&#8216; . esc_html( $prim_category-&gt;name ) . &#8216;<\/a>&lt;\/span&gt;&#8217;;<br \/>\n\t\t\t\t\t$cats_count -= 1;<br \/>\n\t\t\t\t}<\/p>\n<p>\t\t\t\t$counter = 1;<\/p>\n<p>\t\t\t\tif( $counter &lt; $cats_count &amp;&amp; count( $cats ) &gt; $cats_count ){<br \/>\n\t\t\t\t\tforeach( $cats as $cat_id =&gt; $cat ){<\/p>\n<p>\t\t\t\t\t\tif( $counter &gt; $cats_count )<br \/>\n\t\t\t\t\t\t\tbreak;<\/p>\n<p>\t\t\t\t\t\tif( $cat-&gt;cat_ID == $prim_cat-&gt;cat_ID ){<br \/>\n\t\t\t\t\t\t\tcontinue;<br \/>\n\t\t\t\t\t\t}<\/p>\n<p>\t\t\t\t\t\t$cat_code[] = &#8216;&lt;span class=&#8221;term-badge term-&#8216; . $cat-&gt;cat_ID . &#8216;&#8221;&gt;<a href=\"' . esc_url( get_category_link( $cat ) ) . '\">&#8216; . esc_html( $cat-&gt;name ) . &#8216;<\/a>&lt;\/span&gt;&#8217;;<\/p>\n<p>\t\t\t\t\t\t$counter++;<br \/>\n\t\t\t\t\t}<br \/>\n\t\t\t\t}<\/p>\n<p>\t\t\t}<\/p>\n<p>\t\t\t\/\/ Only Primary Category<br \/>\n\t\t\telseif( $cats_count == 1 ){<\/p>\n<p>\t\t\t\t\/\/ Post primary category<br \/>\n\t\t\t\t$category = better_get_post_primary_cat();<\/p>\n<p>\t\t\t\tif( ! is_wp_error( $category ) )<br \/>\n\t\t\t\t\t$cat_code[] = &#8216;&lt;span class=&#8221;term-badge term-&#8216; . $category-&gt;cat_ID . &#8216;&#8221;&gt;<a href=\"' . esc_url( get_category_link( $category ) ) . '\">&#8216; . esc_html( $category-&gt;name ) . &#8216;<\/a>&lt;\/span&gt;&#8217;;<\/p>\n<p>\t\t\t}<\/p>\n<p>\t\t\t$output .= implode( $sep, $cat_code ) . &#8216;&lt;\/div&gt;&#8217;;<\/p>\n<p>\t\t\tif( $echo ){<br \/>\n\t\t\t\techo $output;<br \/>\n\t\t\t}else{<br \/>\n\t\t\t\treturn $output;<br \/>\n\t\t\t}<br \/>\n\t\t}<\/p>\n<p>\t} \/\/ better_cats_badge_code<\/p>\n<p>} \/\/ if<\/p>\n<p>if( ! function_exists( &#8216;better_format_badge_code&#8217; ) ){<br \/>\n\t\/**<br \/>\n\t * Handy function used to get post format badge<br \/>\n\t *<br \/>\n\t * @param   bool        $echo           Echo or return<br \/>\n\t *<br \/>\n\t * @return string<br \/>\n\t *\/<br \/>\n\tfunction better_format_badge_code( $echo = true ){<\/p>\n<p>\t\t$output = &#8221;;<\/p>\n<p>\t\tif( get_post_type() == &#8216;post&#8217; ){<\/p>\n<p>\t\t\t$format = get_post_format();<\/p>\n<p>\t\t\tif( $format ){<\/p>\n<p>\t\t\t\tswitch( $format ){<\/p>\n<p>\t\t\t\t\tcase &#8216;video&#8217;:<br \/>\n\t\t\t\t\t\t$output = &#8216;&lt;span class=&#8221;format-badge format-&#8216; . $format . &#8216;&#8221;&gt;<a href=\"' . get_post_format_link( $format ) . '\">&lt;i class=&#8221;fa fa-video-camera&#8221;&gt;&lt;\/i&gt; &#8216; . Better_Translation()-&gt;_get( &#8216;format_video&#8217; ) . &#8216;<\/a>&lt;\/span&gt;&#8217;;<br \/>\n\t\t\t\t\t\tbreak;<\/p>\n<p>\t\t\t\t\tcase &#8216;aside&#8217;:<br \/>\n\t\t\t\t\t\t$output = &#8216;&lt;span class=&#8221;format-badge format-&#8216; . $format . &#8216;&#8221;&gt;<a href=\"' . get_post_format_link( $format ) . '\">&lt;i class=&#8221;fa fa-pencil&#8221;&gt;&lt;\/i&gt; &#8216; . Better_Translation()-&gt;_get( &#8216;format_aside&#8217; ) . &#8216;<\/a>&lt;\/span&gt;&#8217;;<br \/>\n\t\t\t\t\t\tbreak;<\/p>\n<p>\t\t\t\t\tcase &#8216;quote&#8217;:<br \/>\n\t\t\t\t\t\t$output = &#8216;&lt;span class=&#8221;format-badge format-&#8216; . $format . &#8216;&#8221;&gt;<a href=\"' . get_post_format_link( $format ) . '\">&lt;i class=&#8221;fa fa-quote-left&#8221;&gt;&lt;\/i&gt; &#8216; . Better_Translation()-&gt;_get( &#8216;format_quote&#8217; ) . &#8216;<\/a>&lt;\/span&gt;&#8217;;<br \/>\n\t\t\t\t\t\tbreak;<\/p>\n<p>\t\t\t\t\tcase &#8216;gallery&#8217;:<br \/>\n\t\t\t\t\t\t$output = &#8216;&lt;span class=&#8221;format-badge format-&#8216; . $format . &#8216;&#8221;&gt;<a href=\"' . get_post_format_link( $format ) . '\">&lt;i class=&#8221;fa fa-camera&#8221;&gt;&lt;\/i&gt; &#8216; . Better_Translation()-&gt;_get( &#8216;format_gallery&#8217; ) . &#8216;<\/a>&lt;\/span&gt;&#8217;;<br \/>\n\t\t\t\t\t\tbreak;<\/p>\n<p>\t\t\t\t\tcase &#8216;image&#8217;:<br \/>\n\t\t\t\t\t\t$output = &#8216;&lt;span class=&#8221;format-badge format-&#8216; . $format . &#8216;&#8221;&gt;<a href=\"' . get_post_format_link( $format ) . '\">&lt;i class=&#8221;fa fa-camera&#8221;&gt;&lt;\/i&gt; &#8216; . Better_Translation()-&gt;_get( &#8216;format_image&#8217; ) . &#8216;<\/a>&lt;\/span&gt;&#8217;;<br \/>\n\t\t\t\t\t\tbreak;<\/p>\n<p>\t\t\t\t\tcase &#8216;status&#8217;:<br \/>\n\t\t\t\t\t\t$output = &#8216;&lt;span class=&#8221;format-badge format-&#8216; . $format . &#8216;&#8221;&gt;<a href=\"' . get_post_format_link( $format ) . '\">&lt;i class=&#8221;fa fa-refresh&#8221;&gt;&lt;\/i&gt; &#8216; . Better_Translation()-&gt;_get( &#8216;format_status&#8217; ) . &#8216;<\/a>&lt;\/span&gt;&#8217;;<br \/>\n\t\t\t\t\t\tbreak;<\/p>\n<p>\t\t\t\t\tcase &#8216;audio&#8217;:<br \/>\n\t\t\t\t\t\t$output = &#8216;&lt;span class=&#8221;format-badge format-&#8216; . $format . &#8216;&#8221;&gt;<a href=\"' . get_post_format_link( $format ) . '\">&lt;i class=&#8221;fa fa-music&#8221;&gt;&lt;\/i&gt; &#8216; . Better_Translation()-&gt;_get( &#8216;format_music&#8217; ) . &#8216;<\/a>&lt;\/span&gt;&#8217;;<br \/>\n\t\t\t\t\t\tbreak;<\/p>\n<p>\t\t\t\t\tcase &#8216;chat&#8217;:<br \/>\n\t\t\t\t\t\t$output = &#8216;&lt;span class=&#8221;format-badge format-&#8216; . $format . &#8216;&#8221;&gt;<a href=\"' . get_post_format_link( $format ) . '\">&lt;i class=&#8221;fa fa-coffee&#8221;&gt;&lt;\/i&gt; &#8216; . Better_Translation()-&gt;_get( &#8216;format_chat&#8217; ) . &#8216;<\/a>&lt;\/span&gt;&#8217;;<br \/>\n\t\t\t\t\t\tbreak;<\/p>\n<p>\t\t\t\t\tcase &#8216;link&#8217;:<br \/>\n\t\t\t\t\t\t$output = &#8216;&lt;span class=&#8221;format-badge format-&#8216; . $format . &#8216;&#8221;&gt;<a href=\"' . get_post_format_link( $format ) . '\">&lt;i class=&#8221;fa fa-link&#8221;&gt;&lt;\/i&gt; &#8216; . Better_Translation()-&gt;_get( &#8216;format_link&#8217; ) . &#8216;<\/a>&lt;\/span&gt;&#8217;;<br \/>\n\t\t\t\t\t\tbreak;<\/p>\n<p>\t\t\t\t}<\/p>\n<p>\t\t\t}<\/p>\n<p>\t\t}<\/p>\n<p>\t\tif( $echo ){<br \/>\n\t\t\techo $output;<br \/>\n\t\t}else{<br \/>\n\t\t\treturn $output;<br \/>\n\t\t}<\/p>\n<p>\t} \/\/ better_format_badge_code<br \/>\n} \/\/ if<\/p>\n<p>add_filter( &#8216;human_time_diff&#8217;, &#8216;better_human_time_diff_filter&#8217;, 99 , 2 );<\/p>\n<p>if( ! function_exists( &#8216;better_human_time_diff_filter&#8217; ) ){<br \/>\n\t\/**<br \/>\n\t * Function to get readable time of current post with translation panel support<br \/>\n\t *<br \/>\n\t * @param $since<br \/>\n\t * @param $diff<br \/>\n\t *<br \/>\n\t * @return string<br \/>\n\t *\/<br \/>\n\tfunction better_human_time_diff_filter( $since,  $diff ) {<\/p>\n<p>\t\tif ( $diff &lt; HOUR_IN_SECONDS ) {<br \/>\n\t\t\t$mins = round( $diff \/ MINUTE_IN_SECONDS );<br \/>\n\t\t\tif ( $mins &lt;= 1 )<br \/>\n\t\t\t\t$mins = 1;<br \/>\n\t\t\t\/* translators: min=minute *\/<br \/>\n\t\t\t$since = sprintf( _n( Better_Translation()-&gt;_get( &#8216;readable_time_min&#8217; ), Better_Translation()-&gt;_get( &#8216;readable_time_mins&#8217; ), $mins ), $mins );<br \/>\n\t\t} elseif ( $diff &lt; DAY_IN_SECONDS &amp;&amp; $diff &gt;= HOUR_IN_SECONDS ) {<br \/>\n\t\t\t$hours = round( $diff \/ HOUR_IN_SECONDS );<br \/>\n\t\t\tif ( $hours &lt;= 1 )<br \/>\n\t\t\t\t$hours = 1;<br \/>\n\t\t\t$since = sprintf( _n( Better_Translation()-&gt;_get( &#8216;readable_time_hour&#8217; ), Better_Translation()-&gt;_get( &#8216;readable_time_hours&#8217; ), $hours ), $hours );<br \/>\n\t\t} elseif ( $diff &lt; WEEK_IN_SECONDS &amp;&amp; $diff &gt;= DAY_IN_SECONDS ) {<br \/>\n\t\t\t$days = round( $diff \/ DAY_IN_SECONDS );<br \/>\n\t\t\tif ( $days &lt;= 1 )<br \/>\n\t\t\t\t$days = 1;<br \/>\n\t\t\t$since = sprintf( _n( Better_Translation()-&gt;_get( &#8216;readable_time_day&#8217; ), Better_Translation()-&gt;_get( &#8216;readable_time_days&#8217; ), $days ), $days );<br \/>\n\t\t} elseif ( $diff &lt; 30 * DAY_IN_SECONDS &amp;&amp; $diff &gt;= WEEK_IN_SECONDS ) {<br \/>\n\t\t\t$weeks = round( $diff \/ WEEK_IN_SECONDS );<br \/>\n\t\t\tif ( $weeks &lt;= 1 )<br \/>\n\t\t\t\t$weeks = 1;<br \/>\n\t\t\t$since = sprintf( _n( Better_Translation()-&gt;_get( &#8216;readable_time_week&#8217; ), Better_Translation()-&gt;_get( &#8216;readable_time_weeks&#8217; ), $weeks ), $weeks );<br \/>\n\t\t} elseif ( $diff &lt; YEAR_IN_SECONDS &amp;&amp; $diff &gt;= 30 * DAY_IN_SECONDS ) {<br \/>\n\t\t\t$months = round( $diff \/ ( 30 * DAY_IN_SECONDS ) );<br \/>\n\t\t\tif ( $months &lt;= 1 )<br \/>\n\t\t\t\t$months = 1;<br \/>\n\t\t\t$since = sprintf( _n( Better_Translation()-&gt;_get( &#8216;readable_time_month&#8217; ), Better_Translation()-&gt;_get( &#8216;readable_time_months&#8217; ), $months ), $months );<br \/>\n\t\t} elseif ( $diff &gt;= YEAR_IN_SECONDS ) {<br \/>\n\t\t\t$years = round( $diff \/ YEAR_IN_SECONDS );<br \/>\n\t\t\tif ( $years &lt;= 1 )<br \/>\n\t\t\t\t$years = 1;<br \/>\n\t\t\t$since = sprintf( _n( Better_Translation()-&gt;_get( &#8216;readable_time_year&#8217; ), Better_Translation()-&gt;_get( &#8216;readable_time_years&#8217; ), $years ), $years );<br \/>\n\t\t}<\/p>\n<p>\t\treturn $since;<br \/>\n\t} \/\/ better_human_time_diff_filter<\/p>\n<p>} \/\/ if<\/p>\n<p>if( ! function_exists( &#8216;better_get_readable_date&#8217; ) ){<br \/>\n\t\/**<br \/>\n\t * Used to get readable time<br \/>\n\t *<br \/>\n\t * @return string<br \/>\n\t *\/<br \/>\n\tfunction better_get_readable_date(){<br \/>\n\t\treturn sprintf( Better_Translation()-&gt;_get( &#8216;readable_time_ago&#8217; ), human_time_diff( get_the_time( &#8216;U&#8217; ) ) );<br \/>\n\t} \/\/ better_get_readable_date<br \/>\n} \/\/ if<\/p>\n<p>if( ! function_exists( &#8216;better_get_first_gallery_ids&#8217; ) ){<br \/>\n\t\/**<br \/>\n\t * Used For Retrieving Post First Gallery and Return Attachment IDs<br \/>\n\t *<br \/>\n\t * @param null $content<br \/>\n\t * @return array|bool<br \/>\n\t *\/<br \/>\n\tfunction better_get_first_gallery_ids( $content = null ){<\/p>\n<p>\t\t\/\/ whn current not defined<br \/>\n\t\tif( ! $content ){<br \/>\n\t\t\tglobal $post;<\/p>\n<p>\t\t\t$content = $post-&gt;post_content;<br \/>\n\t\t}<\/p>\n<p>\t\tpreg_match_all(&#8216;\/&#8217;. get_shortcode_regex() .&#8217;\/s&#8217;, $content, $matches, PREG_SET_ORDER);<\/p>\n<p>\t\tif( ! empty($matches) ){<\/p>\n<p>\t\t\tforeach( $matches as $shortcode ){<\/p>\n<p>\t\t\t\tif( &#8216;gallery&#8217; === $shortcode[2] ){<\/p>\n<p>\t\t\t\t\t$atts = shortcode_parse_atts($shortcode[3]);<\/p>\n<p>\t\t\t\t\tif( ! empty( $atts[&#8216;ids&#8217;] ) ){<br \/>\n\t\t\t\t\t\t$ids = explode(&#8216;,&#8217;, $atts[&#8216;ids&#8217;]);<\/p>\n<p>\t\t\t\t\t\treturn $ids;<br \/>\n\t\t\t\t\t}<br \/>\n\t\t\t\t}<br \/>\n\t\t\t}<br \/>\n\t\t}<\/p>\n<p>\t\treturn false;<br \/>\n\t} \/\/ better_get_first_gallery_ids<br \/>\n} \/\/ if<\/p>\n<p>if( ! function_exists( &#8216;better_strip_first_shortcode_gallery&#8217; ) ){<br \/>\n\t\/**<br \/>\n\t * Deletes First Gallery Shortcode and Returns Content<br \/>\n\t *<br \/>\n\t * @param string $content<br \/>\n\t *<br \/>\n\t * @return mixed|string<br \/>\n\t *\/<br \/>\n\tfunction better_strip_first_shortcode_gallery( $content = &#8221; ){<\/p>\n<p>\t\tpreg_match_all( &#8216;\/&#8217; . get_shortcode_regex() . &#8216;\/s&#8217;, $content, $matches, PREG_SET_ORDER );<\/p>\n<p>\t\tif( ! empty( $matches ) ){<\/p>\n<p>\t\t\tforeach( $matches as $shortcode ){<\/p>\n<p>\t\t\t\tif( $shortcode[2] === &#8216;gallery&#8217; ){<\/p>\n<p>\t\t\t\t\t$pos = strpos( $content, $shortcode[0] );<\/p>\n<p>\t\t\t\t\tif( $pos !== false ){<br \/>\n\t\t\t\t\t\treturn substr_replace( $content, &#8221;, $pos, strlen( $shortcode[0] ) );<br \/>\n\t\t\t\t\t}<br \/>\n\t\t\t\t}<br \/>\n\t\t\t}<br \/>\n\t\t}<\/p>\n<p>\t\treturn $content;<\/p>\n<p>\t} \/\/ better_strip_first_shortcode_gallery<br \/>\n} \/\/ if<\/p>\n<p>if( ! function_exists( &#8216;better_get_post_thumbnail_src&#8217; ) ){<br \/>\n\t\/**<br \/>\n\t * Handy function to get post thumbnail src<br \/>\n\t *<br \/>\n\t * @param null   $post_id   Post ID<br \/>\n\t * @param string $size      Featured image size<br \/>\n\t *<br \/>\n\t * @return array|mixed|null|object|\\WP_Error<br \/>\n\t *\/<br \/>\n\tfunction better_get_post_thumbnail_src( $size = &#8216;thumbnail&#8217;, $post_id = NULL ) {<\/p>\n<p>\t\t$post_id = ( NULL === $post_id ) ? get_the_ID() : $post_id;<\/p>\n<p>\t\t$attachment = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), $size );<\/p>\n<p>\t\treturn $attachment[0];<br \/>\n\t} \/\/ better_get_post_thumbnail_src<br \/>\n} \/\/ if<\/p>\n<p>O que alterar para manter as tags e shortcodes ativos no excerpt, j\u00e1 tentei v\u00e1rios testes e as shortcodes ficaram aparecendo como texto mas n\u00e3o funcionavam.<\/p>\n<p>Obrigada!<\/p>\n","protected":false},"template":"","class_list":["post-59941","topic","type-topic","status-publish","hentry","topic-tag-excerpt","topic-tag-php","topic-tag-shortcodes","topic-tag-tags"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/br.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/59941","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/br.wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/br.wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/br.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/59941\/revisions"}],"wp:attachment":[{"href":"https:\/\/br.wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=59941"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}