[Support request] Custom CSS is not working for Read More text

Home Forums Support [Support request] Custom CSS is not working for Read More text

Home Forums Support Custom CSS is not working for Read More text

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2080510
    Pintu

    Hi, I’ve added the custom php for showing the ‘Read More’ text for custom excerpt in the entry meta section. But my custom CSS is not working for the ‘read more’ text. I am using `.read-more {
    margin-top: 5%;
    float: right;
    }` for aligning the Read More text but it is not working. However, the CSS is working fine when I am not adding custom excerpts. Please help as I want to apply the CSS to all the Read more text.

    #2080554
    Ying
    Staff
    Customer Support

    Hi Pintu,

    I only see one post on your site and the CSS is working properly:
    https://www.screencast.com/t/nj6mBjPIm

    Let me know if I miss anything πŸ™‚

    #2080809
    Pintu

    Hi, Ying I’ve added the class="read-more" to the PHP code `add_filter( ‘wp_trim_excerpt’, ‘tu_excerpt_metabox_more’ );
    function tu_excerpt_metabox_more( $excerpt ) {
    $output = $excerpt;

    if ( has_excerpt() ) {
    $output = sprintf( ‘%1$s <a href=”%2$s”>%3$s</a>’,
    $excerpt,
    get_permalink(),
    __( ‘Read more’, ‘generatepress’ )
    );
    }

    return $output;
    }`

    Now the code is `add_filter( ‘wp_trim_excerpt’, ‘tu_excerpt_metabox_more’ );
    function tu_excerpt_metabox_more( $excerpt ) {
    $output = $excerpt;

    if ( has_excerpt() ) {
    $output = sprintf( ‘%1$s <a class=”read-more” href=”%2$s”>%3$s</a>’,
    $excerpt,
    get_permalink(),
    __( ‘Read More β†’’, ‘generatepress’ )
    );
    }

    return $output;
    }
    `
    That’s why CSS is working fine now. However, I am not a coder, By fluke, I added the code. Would please verify the later PHP and let me know if I did it right or not. Or something needs to change. Thanks

    #2081459
    Ying
    Staff
    Customer Support

    The code looks good to me πŸ™‚

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.