add_action( 'wp_enqueue_scripts', 'extra_fonts' );
function extra_fonts() {
wp_enqueue_style( 'style-name', get_template_directory_uri() . '/styles/fonts.css' );
}
if(
(isset( $_POST['roomC'] ) && ($_POST['roomC'] != '')) ||
(isset( $_POST['room1'] ) && ($_POST['room1'] != '')) ||
(isset( $_POST['room2'] ) && ($_POST['room2'] != '')) ||
(isset( $_POST['room3'] ) && ($_POST['room3'] != '')) ||
(isset( $_POST['room4'] ) && ($_POST['room4'] != '')) ||
(isset( $_POST['room5'] ) && ($_POST['room5'] != ''))
){
$arrRooms = [];
if ( isset( $_POST['roomC'] ) && ($_POST['roomC'] != '') ) $arrRooms[] = 'C';
if ( isset( $_POST['room1'] ) && ($_POST['room1'] != '') ) $arrRooms[] = '1';
if ( isset( $_POST['room2'] ) && ($_POST['room2'] != '') ) $arrRooms[] = '2';
if ( isset( $_POST['room3'] ) && ($_POST['room3'] != '') ) $arrRooms[] = '3';
if ( isset( $_POST['room4'] ) && ($_POST['room4'] != '') ) $arrRooms[] = '4';
if ( isset( $_POST['room5'] ) && ($_POST['room5'] != '') ) $arrRooms[] = '5+';
$args['meta_query'][] = array(
'key' => 'room',
'value' => $arrRooms,
'type' => 'char',
'compare' => 'IN'
);
}
add_action('wp_enqueue_scripts', function(){
wp_add_inline_script('my_scripts', 'var templateDirectory = ' . get_template_directory_uri() );
});
<?php wp_head() ?>
<head>
$buildings = get_posts( $args );
foreach( $buildings as $post ){ setup_postdata($post);
?>
<div class="col-lg-2 col-md-2 col-sm-4 col-xs-6">
<div class="card" style="width: 100%;">
<img class="card-img-top" src="<?php $image_url = wp_get_attachment_image_src( $post->photo ); echo $image_url[0] ?>" alt="Card image cap">
<div class="card-body">
<h5 class="card-title"><?php echo $post->price; ?> ₽</h5>
<p class="card-text card-text--build">
<?php
if ($post->room == 'Студия') {
echo ($post->room . ', ' . $post->space . ' м<sup>2</sup>');
}else{
echo ($post->room . ' комн. кв. ' . $post->space . ' м<sup>2</sup>');
}
?><br>
<?php echo ($post->district . '<br>ул. ' . $post->city . ', дом ' . $post->house); ?>
</p>
<a href="<?php the_permalink(); ?>" class="btn btn-primary" target="_blank">Перейти</a>
</div>
</div>
</div>
<?php
the_post();
}
wp_reset_postdata();
position: absolute;
top: 0;
left: 0;