Created
August 5, 2017 19:05
-
-
Save roamn/c0a2842aa59373f64408892a7e1d4310 to your computer and use it in GitHub Desktop.
Вывод миниатюры записи
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Получение img миниатюры записи | |
* | |
* null - ID текущего поста | |
* thumbnail - размер миниатюры | |
* | |
* Подробнее: https://wp-kama.ru/function/get_the_post_thumbnail | |
*/ | |
$thumb_img = get_the_post_thumbnail( null, 'thumbnail' ); | |
?> | |
<?php // Если img сгенерирован ?> | |
<?php if ( $thumb_img ): ?> | |
<?php // Обнятие img в произвольную ссылку и вывод img ?> | |
<a href="http://some-site.ru/"> | |
<?php echo $thumb_img; ?> | |
</a> | |
<?php endif ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment