• Resolved caticc

    (@caticc)


    Hello!
    First of all thanks for the plugin, it is very usefull!
    I need to show the Excerpt in the VP layout grid, ONLY if the excerpt field is filled up in the post. I don’t want it to automatically create an excerpt from the content. In case there is nothing in the excerpt field, then there should be no excerpt shown.
    Could you help me with this?
    maybe there is a function that I can apply?

    Thanks!!!

    • This topic was modified 4 years ago by caticc.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter caticc

    (@caticc)

    I found a solution! not sure if many people will have this need, but, here it goes:

    I opened this file: excerpt.php (wp-content/plugins/visual-portfolio/templates/items-list/items-parts/excerpt.php)

    And I replaced this:

    <div class=”vp-portfolio__item-meta-excerpt”>
    <div>
    <?php echo wp_kses_post( $args[‘excerpt’] ); ?>
    </div>
    </div>

    with this code:

    <div class=”vp-portfolio__item-meta-excerpt”>
    <div>
    <?php if ( has_excerpt() ) { the_excerpt(); } else { echo ”; } ?>
    </div>
    </div>

    This worked for me.

    The only problem is that I’ve tried to do this in my child theme with no results: I recreated this file in my child theme (by creating every folder and copying the excerp.php file)
    public_html/wp-content/themes/my-child-theme/wp-content/plugins/visual-portfolio/templates/items-list/items-parts/excerpt.php
    There i did the same replacement, but it didn’t work. If anyone knows why, it would help.

    Thanks!

    Plugin Author Nikita

    (@nko)

    Hey.

    The replacement should be added here: wp-content/themes/my-child-theme/visual-portfolio/items-list/items-parts/excerpt.php. See here info about templates https://visualportfolio.co/documentation/developers/changing-default-templates-and-styles/

    Regards, nK.

    Thread Starter caticc

    (@caticc)

    Thanks a lot, it worked!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Remove Excerpt if excerpt field is empty?’ is closed to new replies.