Friday, 22nd Aug 2014

«

»

Print this Post

Graphene Custom Slider Excerpt Length

Sometimes View full post button go out of the Graphene Slider due to increased excerpt length. Default excerpt length in WordPress is 55 words. You can override this by using a plugin or custom excerpt length function. But it affects the excerpt everywhere. So, here is a function which affects only the Graphene Slider excerpt length.

Put this code anywhere between opening <?php and closing ?> php tags in the child theme functions.php file.

function graphene_custom_slider_excerpt_length(){
   graphene_set_excerpt_length( 35 );
}
add_action( 'graphene_before_slider', 'graphene_custom_slider_excerpt_length' );

It limits the slider excerpt length to 35 words. You can change it to make your slider happy! :-)

Thanks Syahir!

Short Link:

About the author

Prasanna SP

Student | WordPress Dev | Tech Blogger | Interested in GNU/Linux, FOSS, PHP, Drupal, WordPress, Ethical hacking, Photography, Painting, Literature etc..

14 comments

Skip to comment form

  1. Ashish

    On which php page do we need to add this function?

    1. Prasanna SP

      In your child theme functions.php file.

  2. Chitaranjan

    How can I disable the Excerpt?

    1. Prasanna SP
      .full-sized .slider-entry-wrap .slider-content-wrap {
      display: none;
      }
  3. Chitaranjan

    Tried this but this disable title also, is it possible to show title?

    1. Prasanna SP

      Try this,

      .full-sized .slider_post_entry p {
      display: none;
      }
  4. Chitaranjan

    That’s works perfectly to show only title & hide excerpts, only thing is…there seems to be little overlay above the title background.

  5. Alek

    Where to insert in which document..??

    1. Prasanna SP

      In your child theme’s functions.php file. If it is blank, add <?php at the beginning of the file and ?> at the end.

  6. Andrea

    Dear, i’m a dummy, newbie at my first site; i have try to apply function graphene_custom_slider_excerpt_length(){
    graphene_set_excerpt_length( 35 );
    }
    add_action( 'graphene_before_slider', 'graphene_custom_slider_excerpt_length' )
    ; i put in In my child theme’s functions.php file, bur result was orrible: cose is visible in the higjer part of page.

    It’s possible to see it without admin permissionn please help
    Thanks
    Andrea

    1. Prasanna SP

      If your child theme’s functions.php file is empty, please add php systan while adding this code. i.e put <?php at the beginning of functions file and close the function with ?>

      Try this,


      <?php
      function graphene_custom_slider_excerpt_length(){
      graphene_set_excerpt_length( 35 );
      }
      add_action( 'graphene_before_slider', 'graphene_custom_slider_excerpt_length' );
      ?>

  7. Chris

    Hi, thanks for your help but your code makes my site totally crashed!
    I must reinstall the site!
    It writes this:

    Warning: Cannot modify header information – headers already sent by (output started at /home/sportmon/public_html/wp-content/themes/graphene/functions.php:68) in /home/sportmon/public_html/wp-includes/pluggable.php on line 881

    And it doesn’t work anymore!

    I just want to keep only titles in the slider!

    Thanks

    1. Prasanna SP

      Replied to this comment through email. The issue is resolved now.

  8. raozkardes

    Hi, How can I improve the length Graphene Slider title? Can you write a function to shorten the title?
    Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *

Please put your code snippet between <code> and </code>. Comment moderation is in use. Please do not submit your comment twice -- it will appear shortly.