Improved spacing for Graphene Slider

  • yeager200


    I love this Theme, but there is one thing that annoyed me. When a title of a blog article is too long, when displayed in the slider, it wraps and pushes the “View full post” button down out of view. So I’ve modified the Theme and wonder if you want to put this back into your main source… I edited one file.


    At the top I added a function to take the excerpt and shorten but keep full words.

    function truncateString($string, $limit, $break=".", $pad="...")
    // return with no change if string is shorter than $limit
    if(strlen($string) <= $limit) return $string;
    // is $break present between $limit and the end of the string?
    if(false !== ($breakpoint = strpos($string, $break, $limit))) {
    if($breakpoint < strlen($string) - 1) {
    $string = substr($string, 0, $breakpoint) . $pad;
    return $string;

    Then I modified the Excerpt display section..

    <?php /* The slider post's excerpt */ ?>
    <div class="slider_post_entry clearfix">
    if ( $graphene_settings['slider_display_style'] != 'full-post' ){
    if ( strlen(the_title('','',false)) > 40 ) {
    echo truncateString(get_the_excerpt(), 250, " ");
    } else {

    Now I never get the “View full post” button disappearing off the slider. You may wish to implement better logic, but this works for me now and would love this to be in the main source so that I don’t have to keep editing it back in after each update.



    Oh and for reference, my blog is here.


    Kenneth John Odle


    Yes, that is slightly annoying. What really bugs me is the fact that the “view full post” button hops around.

    If you don’t want to hack core theme files in the meantime, you can also lock the slider button in place by adding this to your child theme stylesheet or custom CSS:

    .slider_items .block-button {
    position: absolute;
    right: 10px;
    bottom: 10px;

    It may interfere with a slightly longer excerpt, but you can adjust for that by changing the slider height.


    Syahir Hakim


    You can add this to your child theme’s functions.php file to modify the excerpt length for the slider:

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

    Kenneth John Odle


    Cool! Thanks!

Viewing 5 posts - 1 through 5 (of 5 total)

  • You must be logged in to reply to this topic.
Graphene Themes Forum