Trying to override part of the Modern_Post_Summary class

Home Forums Modern Trying to override part of the Modern_Post_Summary class

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #21274

    uncle.lag
    Participant

    Trying to override part of the Modern_Post_Summary class

    Resolved

    Hey there! Have you noticed this support service is provided FREE of charge?
    If you like the speed and accuracy of resolutions, please consider supporting me with a small donation. Thank you

    Consider a donation →

    First of all, quite pleased with this theme. Kudos for the detailed documentation, very important for us, newbies.

    I am attempting to make some changes in the internal logic of one of the functions inside /includes/frontend/class-post-summary.php. I have a child theme based off Modern theme, and, as I figured out, it is a futile endeavor in this case.

    Although I can alter the original theme, I do not prefer to go that way.

    The culprit is the wrap_excerpt() function that wraps a text excerpt from the post into a <div>. But as I see it, it makes no distinction if there was at all any text in the post, therefore several margins add up and you’ve got yourself a bunch of empty space. Long story short, I wanted to change the line (137) from:
    return '<div class="entry-summary">' . PHP_EOL . $post_excerpt . PHP_EOL . '</div>';

    to:
    if ( !empty($post_excerpt) ) { return '<div class="entry-summary">' . PHP_EOL . $post_excerpt . PHP_EOL . '</div>'; }

    Or something like that. Perhaps instead of leaving the <div> out entirely, add a specific class identifier, so it can be modified or hidden via css. But anyway, how should I approach this? Can I re-define one single function?

    Thanks!

    #21280

    Oliver Juhas
    Keymaster

    Hi uncle.lag,

    Thank you, I’m glad you like the theme :)

    And thank you very much for spotting this! You can simply go ahead and change the theme core files directly. I will introduce this fix in next theme update.

    The <div class="entry-summary"> should be removed if the post excerpt is empty.

    Best regards,

    Oliver Juhas
    WebMan Design

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.