• Resolved chiwawaweb

    (@chiwawaweb)


    Hello,
    The tag <!–more–> works but the theme doesn’t show “continue reading” in the category. Why?

    Best regards.
    Marco

Viewing 1 replies (of 1 total)
  • Hello,

    I noticed that the contents in the archive page are printed using WordPress native function the_excerpt(). It doesn’t have “continue reading” link by default.

    To print the “continue reading” link out, try to add the following function. The following function will manipulate the the_excerpt() output via get_the_excerpt filter.

    add_filter('get_the_excerpt', 'zerif_add_read_more_link');
    function zerif_add_read_more_link($post_excerpt){
    
      global $post;
      if(strstr($post->post_content,'<!--more-->')) {
        $more_link = ' <a class="more-link" href="'.esc_attr(get_permalink($post->ID) . "#more-{$post->ID}").'">'.__('Continue reading', 'zerif-lite').'</a>';
        return $post_excerpt . $more_link;
      }
      return $post_excerpt;
    
    }

    Make sure you add the function above in the child theme’s functions.php file.

    Please read this helpful tutorial https://docs.themeisle.com/article/14-how-to-create-a-child-theme, in case you don’t have a child theme yet.

    I hope this reply helps.

Viewing 1 replies (of 1 total)
  • The topic ‘continue reading’ is closed to new replies.