<?php $otkatnye_gates = new WP_Query([
'post_type' => 'section_gates',
'post_name' => 'otkatnye-vorota',
'post_status' => 'publish',
'posts_per_page'=> -1,
'order' => 'ASC'
]);
//var_dump($otkatnye_gates);
while($otkatnye_gates->have_posts()):
$otkatnye_gates->the_post();
$gallery = get_post_meta(get_the_ID(), 'section_gates_gallery', true);
if($gallery):
$images = get_field('section_gates_gallery');
if( $images ): ?>
<div class="row section_gates_gallery">
<div class="col-xs-12">
<div id="sectiongates" class="sectiongates-carousel">
<?php foreach( $images as $image ): ?>
<div class="item">
<img src="<?php echo $image['sizes']['large']; ?>" alt="<?php echo $image['alt']; ?>" />
<button class="order-call" onclick="toggle(hidden_content2)">Заказать</button>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
<?php endif; endif; ?>
<?php endwhile ?>
<?php wp_reset_query() ?>
add_filter('dynamic_sidebar_params', 'my_dynamic_sidebar_params');
function my_dynamic_sidebar_params( $params ) {
// get widget vars
$widget_name = $params[0]['widget_name'];
$widget_id = $params[0]['widget_id'];
// bail early if this widget is not a Text widget
if( $widget_name != 'Text' ) {
return $params;
}
// add image to after_widget
$image = get_field('widget_banner', 'widget_' . $widget_id);
if( $image ) {
$params[0]['after_widget'] = '<img src="' . $image['url'] . '">' . $params[0]['after_widget'];
}
// return
return $params;
}