@kentos

Почему не выводится переменная?

Здравствуйте, не могу понять, почему не стучиться до переменной $thumb

<?php
global $post;
if (is_product_category()) {
        global $wp_query;
        $cat = $wp_query->get_queried_object()->slug;
    }

$args = array( 'posts_per_page' => 3, 'category_name' => $cat);
$myposts = get_posts( $args );
foreach( $myposts as $post ){ setup_postdata($post);
$thumb = get_the_post_thumbnail_url( $myposts->ID, large ); 
    ?>
<div class="w-grid us_custom_70facfb4 type_grid layout_302 cols_3 overflow_hidden" id="us_grid_6" data-grid-filter="true">
<div class="w-grid-list">
    <article class="w-grid-item size_1x1 post-1583 post type-post status-publish format-standard hentry category-mediczinskie-czentry-i-stomatologii" data-id="1583">
	<div class="w-grid-item-h">
<div class="w-post-elm post_image usg_post_image_1 stretched has_ratio"><div style="padding-bottom:75.0000%"></div><a href="<?php the_permalink();?>" aria-label="Тест статья с медицины">
<img width="1024" height="682" src="<?php $thumb ?>" class="attachment-large size-large wp-post-image" alt="Выгодные франшизы в vengi" loading="lazy" srcset="<?php $thumb ?>" title="Самые выгодные франшизы, или как найти своё дело">

</a></div>
				<div class="w-vwrapper usg_vwrapper_1 align_left valign_top "><h2 class="w-post-elm post_title usg_post_title_1 entry-title color_link_inherit has_text_color"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2><div class="w-post-elm post_content usg_post_content_1"><?php the_content(); ?></div></div><a class="w-btn us-btn-style_5 usg_btn_1" href="<?php the_permalink(); ?>"><span class="w-btn-label">Подробнее</span></a>	</div>
</article>
    </div>
</div>
    <?php
}
wp_reset_postdata();
?>
  • Вопрос задан
  • 87 просмотров
Решения вопроса 1
bingumd
@bingumd
...
$thumb = get_the_post_thumbnail_url( $myposts->ID, "large" );
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы