Я пытаюсь настроить длину выдержки в сообщениях. Я использую эту функцию на function.php
:
function get_excerpt(){
$excerpt = get_the_content();
$excerpt = preg_replace(" ([.*?])",'',$excerpt);
$excerpt = strip_shortcodes($excerpt);
$excerpt = strip_tags($excerpt);
$excerpt = substr($excerpt, 0, 25);
$excerpt = substr($excerpt, 0, strripos($excerpt, " "));
$excerpt = trim(preg_replace( '/s+/', ' ', $excerpt));
$excerpt = $excerpt.'... <a href="'.$permalink.'">[...]</a>';
return $excerpt;
}
и использование его в этом теге
<article class="secundary">
<div class="mini">
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('large', array('class' => 'img-responsive')); ?></a>
</div>
<h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
<p>por <span><?php the_author_posts_link(); ?></span> em <span><?php the_category(' '); ?></span> <?php the_tags('Tags: ', ', '); ?></p>
<p><?php echo get_the_date(); ?></p>
<p><?php get_excerpt(); ?></p>
</article>
Кто-нибудь может мне помочь? Это не сработало ... почему?
Спасибо! :)