wp_get_attachment_image_src() | obrazek wyróżniający
Sun Feb 20 2022 13:06:46 GMT+0000 (Coordinated Universal Time)
Saved by
@rafalw
<?php $src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID)), array('1200', '600'), true, '');?>
<?php the_title('<h1>',</h1>);?>
----------------------------------------
$args = array( 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => 5, 'numberposts' => 5 );
$posts = get_posts( $args );
foreach($posts as $post) {
$thumbnail_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), array('220','220'), true );
$thumbnail_url = $thumbnail_url[0];
echo ( !empty($thumbnail_url) ) ? $thumbnail_url : 'No thumb!';
content_copyCOPY
https://developer.wordpress.org/reference/functions/wp_get_attachment_image_src/
Comments