WordPress.org

Ready to get started?Download WordPress

Forums

Inove theme postnavi line overlaps (2 posts)

  1. aajkaal
    Member
    Posted 5 years ago #

    <div id="postnavi">
            <span class="prev"><?php substr(next_post_link('%link'), 0, 40) ?></span>
            <span class="next"><?php substr(previous_post_link('%link'), 0, 40) ?></span>
            <div class="fixed"></div>
    </div>

    In Inove theme, if the title of prev or next blog is too long, the prev and next entries at the bottom of the comment overlap. I tried substr as given above; but didn't work.
    Any ideas ?

  2. Christian Schenk
    Member
    Posted 5 years ago #

    I've not tested this but adding the following to your theme's functions.php should work:

    function my_trimmed_post_links($format, $link) {
    return substr($link, 0, 40);
    }
    if (function_exists('add_filter')) {
    add_filter('next_post_link', 'my_trimmed_post_links', 10, 2);
    add_filter('previous_post_link', 'my_trimmed_post_links', 10, 2);
    }

    BTW: your solution doesn't work because these functions don't return the value so substr can work on it but just echo it. This way you can't just feed it to a function but have to use a filter.

Topic Closed

This topic has been closed to new replies.

About this Topic