Skip to main content
All CollectionsTroubleshooting and FAQsFrequently Asked QuestionsPortfolio Module
How to Display the Project Excerpt Text When Hovering on Portfolio Module Items
How to Display the Project Excerpt Text When Hovering on Portfolio Module Items

Learn how to display project excerpt text on hover in the Portfolio Module to enhance user interaction and engagement on your site.

Updated over a week ago

Enhancing user interaction on your website by displaying project excerpt text when users hover over items in the Portfolio Module. This customization provides additional context and entices visitors to explore your projects further.

This article will guide you through the steps to reveal the project excerpt text in your Portfolio Module.

Prerequisites:

  1. This customization requires having a Child theme for Divi installed and activated.

  2. Move the Portfolio module from the parent theme to your child theme folder.

  1. Go to WordPress Dashboard → Appearance → Theme Files Editor

  2. Open the custom-FilterablePortfolio.php from your child theme folder

  3. Find these lines of code:

    <?php } else { ?>
    <span class="et_portfolio_image">
    <?php
    $image_attrs = array(
    'alt' => get_the_title(),
    'width' => '400',
    'height' => '284',
    );

    if ( ! empty( $post->featured_image ) ) {
    $image_attrs['srcset'] = $post->featured_image . ' 479w, ' . $post->post_thumbnail . ' 480w';
    $image_attrs['sizes'] = '(max-width:479px) 479px, 100vw';
    }

    $this->render_image( $post->post_thumbnail, $image_attrs );
    ?>
    <?php echo et_core_esc_previously( $overlay ); ?>
    </span>
    <?php } ?>

  4. Replace it with this code:

    <?php } else { ?>
    <span class="et_portfolio_image">
    <?php
    $image_attrs = array(
    'alt' => get_the_title(),
    'width' => '400',
    'height' => '284',
    );

    if ( ! empty( $post->featured_image ) ) {
    $image_attrs['srcset'] = $post->featured_image . ' 479w, ' . $post->post_thumbnail . ' 480w';
    $image_attrs['sizes'] = '(max-width:479px) 479px, 100vw';
    }

    $this->render_image( $post->post_thumbnail, $image_attrs );
    ?>
    <?php echo et_core_esc_previously( $overlay ); ?>
    <span class="dt-excerpt"><?php echo get_the_excerpt(); ?></span>
    </span>
    <?php } ?>

  5. For each Project, ensure that the Excerpt text is added by editing each of the Projects in WordPress Dashboard → Projects and filling in the Excerpt field for each project

    WordPress - Set the Excerpt for Project post

  6. Open the Portfolio module's settings by clicking on the Gear icon

  7. Go to Advanced Tab → Custom CSS → Free Form CSS and add this CSS code:

    selector .dt-excerpt {
    z-index: -1;
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    width: 100%;
    height: auto;
    opacity: 0;
    pointer-events: none;
    -webkit-transition: all 0.3s;
    transition: all 0.3s;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    text-align: center;
    padding: 10px;
    }

    selector .et_portfolio_image:hover .dt-excerpt {
    z-index: 3;
    opacity: 1;
    }

    selector .et_overlay::before {
    top: calc(50% + 20px);
    }

The result can be seen in the screenshot below:

Divi Portfolio module - Show Project excerpt text
Did this answer your question?