Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #615316

    I have tried many times but this feature doesn’t work.

    URL: http://www.fabiofrau.it
    wordpress version: 4.3.1
    theme version: X 4.1.1
    shortcode plugin version: I have Cornerstone and so I have canceled it. (but I had the same problem with the short code plugin activated)

    #615371

    Prasant Rai
    Moderator

    Hello Fabio,

    Thanks for writing in!

    In my local setup blog excerpt length is working as expected by changing the excerpt length values under Customizer > Blog > Excerpt Length. Having said that you can change the excerpt length by adding following code in your child theme function.php file:

    if ( ! function_exists( 'x_excerpt_length' ) ) :
      function x_excerpt_length( $length ) {
    
        return x_get_option( 'x_blog_excerpt_length', '60' );
    
      }
      add_filter( 'excerpt_length', 'x_excerpt_length' );
    endif;

    Note: As per your requirement change value 60 that will modify excerpt length.

    If that does not help would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:

    – Link to your site
    – WordPress Admin username / password
    – FTP credentials

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

    Thanks.

    #615465
    This reply has been marked as private.
    #615680

    I have an update. I have adjusted my blog by myself, and I have the x child properly installed, but I have the same old problem : I can’t set up the excerpt lenght. Now you have all my info. Can you solve this problem, please?

    (I’m not a programmer and I don’t want to make another disaster).

    Thank you very much,

    Fabio 🙂

    #615765

    Friech
    Moderator

    Hi Fabio,

    Thanks for the credentials, but where is your login page? I’ve try both http://www.fabiofrau.it/wp-admin and http://www.fabiofrau.it/wp-login.php but its not found.

    In the mean time, Customizer has the Excerpt Length option under the Blog panel.


    screenshot

    Hope it helps, Cheers!

    #616323
    This reply has been marked as private.
    #616380

    Jack
    Keymaster

    Hi Fabio!

    Thanks for writing back.

    I’ve logged into like you said and have added the code we supplied in the child theme directory. Which is /blog/wp-content/themes/x-child/functions.php, if you open that file you should see the code. 🙂

    Unfortunately I still couldn’t access your WordPress website dashboard, how do you access it? Both wp-admin and wp-login.php return a 404.

    We’re here to help! 🙂

    Thanks.

    #616393
    This reply has been marked as private.
    #616559

    Jack
    Keymaster

    Hi there Fabio!

    Thanks! I’ve checked your posts in the admin and they don’t have a excerpt set.

    Under “Screen options” on each post, make sure “Riassunto” is checked, which is the excerpt and add your custom excerpt you want to display and it should work perfectly. 🙂

    Thank you!

    #616727

    Hi Staff,

    now excerpt (under screen option) is checked and I have added manually a 12-15 lines excerpt for every article.
    My problem is that “excerpt length” (in Cornerstone> blog> content) doesn’t work.
    At the moment I have an excerpt length of 55, but when I change this value, for example 5, nothing happens. The length of my excerpts doesn’t change at all.

    #616995

    Nabeel A
    Moderator

    Hi there,

    I’ve done some testing on my local setup and excerpt length works fine. For this to work you need to remove the manual excerpt from your post, somehow it’s not working on your site. Please try testing for a plugin conflict. You can do this by deactivating all third party plugins, and seeing if the problem remains. If it’s fixed, you’ll know a plugin caused the problem, and you can narrow down which one by reactivating them one at a time.

    Since you’re using manual excerpt, you can add the following code in your child theme’s functions.php file to limit the length of your manual excerpt.

    function wp_trim_all_excerpt($text) {
    // Creates an excerpt if needed; and shortens the manual excerpt as well
    global $post;
      $raw_excerpt = $text;
      if ( '' == $text ) {
        $text = get_the_content('');
        $text = strip_shortcodes( $text );
        $text = apply_filters('the_content', $text);
        $text = str_replace(']]>', ']]>', $text);
      }
     
    $text = strip_tags($text);
    $excerpt_length = apply_filters('excerpt_length', 55);
    $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
    $text = wp_trim_words( $text, $excerpt_length, $excerpt_more ); //since wp3.3
    return apply_filters('wp_trim_excerpt', $text, $raw_excerpt); //since wp3.3
    }
     
    remove_filter('get_the_excerpt', 'wp_trim_excerpt');
    add_filter('get_the_excerpt', 'wp_trim_all_excerpt');

    Cheers!