Support » Theme: Astra » esc_html from blog-config.php

  • Could you explain one thing to me? Here is the code snippet from blog-config.php (line 201):

    $read_more_text    = apply_filters( 'astra_post_read_more', __( 'Read More »', 'astra' ) );
    		$read_more_classes = apply_filters( 'astra_post_read_more_class', array() );
    
    		$post_link = sprintf(
    			esc_html( '%s' ),
    			'<a class="' . esc_attr( implode( ' ', $read_more_classes ) ) . '" href="' . esc_url( get_permalink() ) . '"> ' . the_title( '<span class="screen-reader-text">', '</span>', false ) . ' ' . $read_more_text . '</a>'
    		);
    
    		$output = ' &hellip;<p class="read-more"> ' . $post_link . '</p>';

    Why is it here:

    $post_link = sprintf(
    			esc_html( '%s' ),

    What exactly will be replaced here? Can I just write something like this in my code:

    $read_more_text    = apply_filters( 'astra_post_read_more', __( 'Read More &raquo;', 'astra' ) );
    ......
    return '<p class="read-more"><a class="myclass" href="' . esc_url( get_permalink() ) . '"> ' . the_title( '<span class="screen-reader-text">', '</span>', false ) . ' ' . $read_more_text . '</a></p>'

    Please forgive me for bothering!

    P.S
    Since I already set the class for the a tag, this filter is no longer needed either:

    add_filter( 'astra_post_read_more_class','my_rm_classes' );
    function my_rm_classes( $classes ) {
     
        $classes[] = 'myclass';
         
        return $classes;
         
    }
Viewing 1 replies (of 1 total)
  • Hello @zabavljaev

    Thanks for bringing this to our notice. 🙂

    We will work and improve on this in our future updates. As of now, the esc_html is not needed there.

    I hope that clarifies.

    Regards,
    Suman

Viewing 1 replies (of 1 total)
  • The topic ‘esc_html from blog-config.php’ is closed to new replies.