можно оформить все на языке движка WP
function zakra_post_thumbnail( $image_size = 'thumbnail' ) {
$attachment_src = wp_get_attachment_image_src(get_post_thumbnail_id(),'mysize');
}
if ( ! function_exists( 'zakra_post_thumbnail' ) ) :
/**
* Displays an optional post thumbnail.
*
* Wraps the post thumbnail in an anchor element on index views, or a div
* element when on single views.
*/
function zakra_post_thumbnail( $image_size = '-post-thumbnail' ) {
if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) {
return;
}
?>
<div class="zak-entry-thumbnail">
<?php
if ( is_singular() ) :
the_post_thumbnail();
else :
?>
<a class="zak-entry-thumbnail__link" href="<?php the_permalink(); ?>" aria-hidden="true">
<?php
the_post_thumbnail(
$image_size,
array(
'alt' => the_title_attribute(
array(
'echo' => false,
)
),
)
);
?>
</a>
<?php endif; // End is_singular(). ?>
</div><!-- .zak-entry-thumbnail -->
<?php
}
endif;
if ( ! function_exists( 'zakra_post_thumbnail' ) ) :
/**
* Displays an optional post thumbnail.
*
* Wraps the post thumbnail in an anchor element on index views, or a div
* element when on single views.
*/
function zakra_post_thumbnail( $image_size = '-post-thumbnail' ) {
if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) {
return;
}
?>
<div class="zak-entry-thumbnail">
<?php
if ( is_singular() ) :
the_post_thumbnail();
else :
?>
<a class="zak-entry-thumbnail__link" href="<?php the_permalink(); ?>" aria-hidden="true">
<?php
the_post_thumbnail(
$image_size,
array(
'alt' => the_title_attribute(
array(
'echo' => false,
)
),
)
);
?>
</a>
<?php endif; // End is_singular(). ?>
</div><!-- .zak-entry-thumbnail -->
<?php
}
endif;
function zakra_post_thumbnail( $image_size = '-post-thumbnail' )
function zakra_post_thumbnail( $image_size = 'thumbnail' )