External Link Button Under Post Excerpt on Index.php

The Codilight theme is bypassing the usual the_excerpt with their own version:

inc/extras.php +26:

if ( ! function_exists( 'codilight_lite_excerpt' ) ) :
  /**
   * Get the except content limit by characters.
   *
   * @param string $characters
   * @return string
   */
  function codilight_lite_excerpt( $characters ){
    // $characters = 160;
    $excerpt = get_the_content();
    $excerpt = preg_replace(" (\[.*?\])",'',$excerpt);
    $excerpt = strip_shortcodes($excerpt);
    $excerpt = strip_tags($excerpt);
    $excerpt = substr($excerpt, 0, $characters);
    $excerpt = substr($excerpt, 0, strripos($excerpt, " "));
    $excerpt = trim(preg_replace( '/\s+/', ' ', $excerpt));
    $excerpt = $excerpt.'...';
    return '<div class="ft-excerpt">'. $excerpt .'</div>';
  }
endif;

And on top of that they aren’t even using “proper” methods of modifying via actions or filters to make it easy for child themes. Instead they’ve wrapped their function with a clause to check whether you’ve written your own, which allows you to override theirs. So in your functions.php you’ll need to basically copy their function and add your own code as needed.

add to
your-child-theme/functions.php:

  /**
   * override the parent theme excerpt
   *
   * @param string $characters
   * @return string
   */
  function codilight_lite_excerpt( $characters ){
    $excerpt = get_the_content();
    $excerpt = preg_replace( " (\[.*?\])", '', $excerpt );
    $excerpt = strip_shortcodes( $excerpt );
    $excerpt = strip_tags( $excerpt );
    $excerpt = substr( $excerpt, 0, $characters );
    $excerpt = substr( $excerpt, 0, strripos( $excerpt, " " ) );
    $excerpt = trim( preg_replace( '/\s+/', ' ', $excerpt ) );
    $excerpt = $excerpt . '...';
    $excerpt .= "<br><button>Visit Site</button>";
    return '<div class="ft-excerpt">' . $excerpt . '</div>';
  }

Fetching the metadata and building the actual button code I will leave upto you.