Note that there are some explanatory texts on larger screens.

plurals
  1. POLimit length post wordpress
    primarykey
    data
    text
    <p>Hi all I have a site in wordpress and I want to limit the character of the preview post different from default for example obnly 5 characters.</p> <p>This is the piece of my content-category.php</p> <pre><code>&lt;div class="entry-content"&gt; &lt;?php $excerpt = get_the_excerpt(); if ( $use_excerpt == 'Content' ) { the_content('&lt;a style="margin-left: 5px;text-transform: uppercase;display: inline-block;" href="'. get_permalink($post-&gt;ID) . '"&gt; '. __( 'Leggi Tutto' , 'color-theme-framework' ) .'&lt;/a&gt;',true,''); } else if ( $use_excerpt == 'Excerpt' &amp;&amp; $excerpt != '' ){ the_excerpt('',FALSE,''); echo '&lt;a style="margin-left: 5px;display: inline-block;" href="' . get_permalink($post-&gt;ID) . '"&gt;' . __('Leggi Tutto', 'color-theme-framework') . '&lt;/a&gt;'; } ?&gt; &lt;/div&gt;&lt;!-- entry-content --&gt; </code></pre> <p>And this is the piece of functions.php of the excerpt that I have read is the function to limit the character but I don't have understand how change it to return only 5 characters intothe content for the preview of the news for example</p> <pre><code>/*======================================= 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'); </code></pre> <p>How can Ilimit the character of the preview of my news to 5 characters?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload