Support » Theme: Lifestyle » Read more link not appearing

  • Hi!

    I want to post only excerpts on my main page. That works fine, but there is no button or text at the end of the excerpt to read the whole post.

    My site is on: tumbleread.de

    Kind regards,
    Steffi

Viewing 3 replies - 1 through 3 (of 3 total)
  • You can add this to your functions.php file located in your themes root folder.

    // Replaces the excerpt "more" text by a link
    function new_excerpt_more($more) {
           global $post;
    	return '...<a class="moretag" href="'. get_permalink($post->ID) . '"> Read the full article.</a>';
    }
    add_filter('excerpt_more', 'new_excerpt_more');

    Sorry, but that does not work.

    Try this one.

    // Changing excerpt length
    function my_wp_trim_excerpt($text) { // Fakes an excerpt if needed
    
    if ( '' == $text ) {
    $text = get_the_content('');
    $text = apply_filters('the_content', $text);
    $text = str_replace(']]>', ']]>', $text);
    $text = strip_tags($text, '<p>');
    $excerpt_length = 50;
    $words = explode(' ', $text, $excerpt_length + 1);
    if (count($words) > $excerpt_length) {
    array_pop($words);
    array_push($words, ' ... <a href="'. get_permalink() . '">READ MORE</a>');
    $text = implode(' ', $words);
    }
    }
    return $text;
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Read more link not appearing’ is closed to new replies.