• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Add a div to Genesis archive thumbs

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › General Genesis Framework Discussions › Add a div to Genesis archive thumbs

This topic is: not resolved

Tagged: hidden, image, overflow, thumbnail, wrap, zoom

  • This topic has 2 replies, 2 voices, and was last updated 1 year, 8 months ago by Jelly4567.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • September 29, 2023 at 4:12 am #507671
    baggi-t
    Participant

    I need to wrap a div around the archive thumbnails on this site: https://graphicviolence.co.uk/workbook/ so that I can hide overflow to crop the zoom on the hover. If you click on the first post, you'll see I have added the zoom within-frame effect on all of the linked images in the regular post content. I've added the zoom on the archive thumbs but I cannot hide the overflow on the top and bottom without a div around the img. I've used this code to add a div for this purpose on all the regular content images but it does not add a div around the archive thumbs. Can anyone advise me as to how I achieve this?

    // ADD IMG WRAP
    function addDivToImage( $content ) {

    // A regular expression of what to look for.
    $pattern = '/(<img([^>]*)>)/i';
    // What to replace it with. $1 refers to the content in the first 'capture group', in parentheses above
    $replacement = '<div class="img-wrap">$1</div>';

    // run preg_replace() on the $content
    $content = preg_replace( $pattern, $replacement, $content );

    // return the processed content
    return $content;
    }

    add_filter( 'the_content', 'addDivToImage' );

    Many thanks
    Tim

    https://graphicviolence.co.uk/workbook/
    October 9, 2023 at 12:14 am #507679
    Jelly4567
    Blocked

    This code creates a function called custom_archive_thumbnail_div that checks if the current page is an archive page Yost Team Arlington. If it is, the archive thumbnail is wrapped in a <div> with the class "archive-thumbnail." The add_filter function is then used to hook this custom function into the genesis_entry_content filter.

    October 15, 2023 at 1:25 am #507690
    Jelly4567
    Blocked

    In WordPress, the Genesis framework is a popular choice for building themes. If you want to add a <div> element around the thumbnail images in the archive pages YAS Downloader of your Genesis-based theme, you might need to make changes in the theme files.

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Log In

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble