Read-More-Link with the Ethos-Stack

Hello,

i have a problem to add the Read-More-Link to the Ethos Stack. I found this this Topic: https://theme.co/apex/forums/topic/ethos-add-read-more-to-blog-excerpt/ but this don’t work.

Here is the website. I want to do it for a client.

Do you habe any idea, how it works?

Best
lennart

Hi lennart,

Thank you for reaching out to us. I tested the following code and it works fine:

// Excerpt More String
// =============================================================================

if ( ! function_exists( 'x_excerpt_string' ) ) :
  function x_excerpt_string( $more ) {
    
    $stack = x_get_stack();

    if ( $stack == 'integrity' ) {
      return ' ... <div><a href="' . get_permalink() . '" class="more-link">' . __( 'Read More', '__x__' ) . '</a></div>';
    } else if ( $stack == 'renew' ) {
      return ' ... <a href="' . get_permalink() . '" class="more-link">' . __( 'Read More', '__x__' ) . '</a>';
    } else if ( $stack == 'icon' ) {
      return ' ...';
    } else if ( $stack == 'ethos' ) {
       return ' ... <a href="' . get_permalink() . '" class="more-link">' . __( 'Read More', '__x__' ) . '</a>';

    }

  }
  add_filter( 'excerpt_more', 'x_excerpt_string' );
endif;

Make sure you’re adding it in the child theme’s functions.php file. Also make sure the EXCERPT LENGTH is set correctly under Theme Options > Blog > Content (see screenshot)

You can adjust the value as per your need. When i test it in my local setup i see the Read More button (see screenshot)

Hope this helps!

Hi Nabeel,

sorry, it dosen’t work. Here’re some Screenshots.

Best
Lennart

https://drive.google.com/drive/folders/11j16L0hKHwnIxWIb9d6l4N9mX_rKDgAN?usp=sharing

Hi again,

Thank you for the screenshots. In your screenshots I see the code is displaying above your site instead of being executed (see screenshot)

This usually happens when you add the PHP code outside the <?php ?> tags. PHP codes should be in inside <?php and ?>.. Make sure you’ve added the code correctly in the child theme functions.php file.

Thanks!

Thank you very much. Now it works.

Best
Lennart

We are gratified that we’re able to help you with this,

Cheers!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.