Привет всем У меня есть сайт в wordpress, и я хочу ограничить характер сообщения предварительного просмотра отличным от значения по умолчанию, например, всего 5 символов.Limit length post wordpress
Это часть моего содержимого category.php
<div class="entry-content">
<?php
$excerpt = get_the_excerpt();
if ($use_excerpt == 'Content') {
the_content('<a style="margin-left: 5px;text-transform: uppercase;display: inline-block;" href="'. get_permalink($post->ID) . '"> '. __('Leggi Tutto' , 'color-theme-framework') .'</a>',true,'');
}
else if ($use_excerpt == 'Excerpt' && $excerpt != ''){
the_excerpt('',FALSE,'');
echo '<a style="margin-left: 5px;display: inline-block;" href="' . get_permalink($post->ID) . '">' . __('Leggi Tutto', 'color-theme-framework') . '</a>';
} ?>
</div><!-- entry-content -->
И это кусок functions.php отрывка, что я прочитал это функция, чтобы ограничить характер, но я не есть понять, как изменить его, чтобы вернуть только 5 символов intothe контента для просмотра новостей, например
/*=======================================
Content Width and Excerpt Redeclared
=======================================*/
if (!isset($content_width))
$content_width = 980;
// Remove rel attribute from the category list
function remove_category_list_rel($output)
{
$output = str_replace(' rel="category"', '', $output);
return $output;
}
add_filter('wp_list_categories', 'remove_category_list_rel');
add_filter('the_category', 'remove_category_list_rel');
remove_action('wp_head', 'feed_links_extra', 3);
remove_action('wp_head', 'feed_links', 2);
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'index_rel_link');
remove_action('wp_head', 'parent_post_rel_link', 10, 0);
remove_action('wp_head', 'start_post_rel_link', 10, 0);
remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0);
remove_action('wp_head', 'wp_generator');
add_theme_support('automatic-feed-links');
function new_excerpt_length($length) {
return 30;
}
add_filter('excerpt_length', 'new_excerpt_length');
function new_excerpt_more($more) {
return '...';
}
add_filter('excerpt_more', 'new_excerpt_more');
Как Ilimit характер предварительного просмотра моих новостей 5 символов?
Если я изменяю от 30 до 1, например, результат тот же ... почему? –
Согласно http://core.trac.wordpress.org/ticket/17190, он работает только для автоматически генерируемых выдержек. Создана ли ваша выдержка вручную? – user850010
Спасибо, я нашел решение в этой ссылке, спасибо большое +1 –