function my_theme_assets() {
wp_enqueue_style( 'slick', get_template_directory_uri() . '/assets/slick/slick.css' );
wp_enqueue_script( 'slick', get_template_directory_uri() . '/assets/slick/slick.js', array('jquery'), null, true );
}
add_action( 'wp_enqueue_scripts', 'my_theme_assets' );
function post_by_slug( $atts ) {
$a = shortcode_atts( array(
'slug' => ''
), $atts );
$slug = explode(',', $a['slug']);
$args = array(
'post_name__in' => $slug,
'post_type' => 'page',
'post_status' => 'publish',
);
$html = '';
$my_posts = get_posts($args);
if( $my_posts ) :
foreach( $my_posts as $post ) :
echo $post->post_title;
endforeach;
endif;
return $html;
}
add_shortcode( 'post_by_slug', 'post_by_slug' );
// добываем слаг поста
global $post;
$slug = $post->post_name;
// функция получения ID по слагу
function get_id_by_slug($slug) {
$query = new WP_Query(
array(
'name' => $slug,
'post_type' => 'post'
)
)
$query->the_post();
return get_the_ID();
}
// наше поле
$postData = get_fields(function get_id_by_slug($slug));
#calendar_wrap.calendar_wrap {
padding: 10px 10px;
}
$thumb_ID = get_sub_field('ale_projects_img');
$img_src = wp_get_attachment_image_src($thumb_ID, 'large');
<img src="<?php echo $img_src[0]; ?>">