Created
May 23, 2021 21:10
-
-
Save frankyonnetti/3a089d9f315a3342676d8bcc0570c850 to your computer and use it in GitHub Desktop.
WordPress - featured image path #wordpress #path
This file contains hidden or 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
https://developer.wordpress.org/reference/functions/get_the_post_thumbnail_url/ | |
<?php $featured_img_url = get_the_post_thumbnail_url(get_the_ID(), 'full'); ?> | |
<?php if (has_post_thumbnail( $post->ID ) ): ?> | |
<?php echo esc_url($featured_img_url); ?> | |
<?php endif; ?> | |
https://developer.wordpress.org/reference/functions/wp_get_attachment_image_src/ | |
<?php $featured_img_url = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ); ?> | |
<img src="<?php echo esc_url($featured_img_url); ?>"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment