Closed nickcernis closed 6 years ago
From https://github.com/studiopress/genesis-portfolio-pro/blob/develop/lib/functions.php#L89-L112
At some point, I was working on testing changes to this. This is the last bit of code I was testing to replace the above (noting that it has been some time and my memory fails me as far as where I was at).
function genesis_portfolio_grid() {
$image = genesis_get_image( array(
'format' => 'html',
'size' => 'portfolio',
'context' => 'archive',
'attr' => array ( 'alt' => the_title_attribute( 'echo=0' ), 'class' => 'portfolio-image', 'itemprop' => 'image' ),
) );
if ( ! empty( $image ) ) {
genesis_markup( array(
'open' => '<div class="portfolio-featured-image"><a href="' . get_permalink() . '" aria-hidden="true">',
'close' => '</a></div>',
'content' => $image,
'context' => 'portfolio-pro',
) );
}
}
Thanks, @dreamwhisper.
Noting 'itemprop' => 'image'
and use of genesis_markup
as the additions above. Will review for 1.2 and look at adding srcset
too.
Ready for testing. I added the itemprop and switched to genesis_markup as suggested.
No further changes were needed to output srcset for responsive images — WP adds them if image thumbnails with the same ratio as the original thumbnail are available.
Branch: fix/archive-img-attributes
Visit the /portfolio/
archive page.
itemprop="image"
appears on images in the portfolio archive.aria-hidden="true"
.@nickcernis Confirmed +1
Environment:
WordPress: Version: 4.9.8
PHP: Versions: 5.6.24 & 7.1.14
Genesis Framework: Version: 2.6.1
Active Themes: Genesis Sample - Version: 2.6.0 Essence Pro - Version: 1.0.2
Branch: https://github.com/studiopress/genesis-portfolio-pro/tree/fix/archive-img-attributes
Results:
Screenshots:
Markup: http://nimb.ws/XaOtL0 Google's Structured Data Testing Tool: http://nimb.ws/w9VLoH
As titled.