Wordpress images
Mon Mar 29 2021 13:18:42 GMT+0000 (Coordinated Universal Time)
Saved by
@Sikor
// Feature Image
<?php if ( has_post_thumbnail() ) { ?>
<a itemprop="url" href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php the_post_thumbnail('full'); ?>
</a>
<?php } ?>
//IMG - AS ID
<?php if ($instance['illustration'] > 0) { ?>
<?php echo wp_get_attachment_image($instance['illustration'], 'medium_size_w', '', array( "class" => "quote__author__avatar" )); ?>
<?php } ?>
//IMG - AS ID - CUSTOM SIZE
<?php echo wp_get_attachment_image($instance['illustration'], array('40', '40', true), '', array( "class" => "quote__author__avatar" )); ?>
//IMG - AS URL
<img src="<?php echo wp_get_attachment_image_url($instance['illustration'], 'medium'); ?>" alt="" class="image-fullwidth__desktop" />
//IMG - AS SRC
<?php wp_get_attachment_image_src($instance['background_image'], 'medium')[0]; ?>
//https://wordpress.stackexchange.com/questions/261283/what-is-diference-wp-get-attachment-url-wp-get-attachment-src-get-post-thumb/261285
content_copyCOPY
Comments