# Подключаем стили
add_action( 'wp_enqueue_scripts' , 'theme_styles' );
# Подключаем скрипты
add_action( 'wp_enqueue_scripts' , 'theme_scripts' );
function theme_styles(){
wp_enqueue_style( 'swiper', get_bloginfo('template_url') . '/assets/css/swiper.min.css' );
wp_enqueue_style( 'main-style', get_stylesheet_uri() );
}
function theme_scripts(){
if( is_single() ) {
wp_enqueue_script( 'polyfill', get_bloginfo('template_url') . '/assets/js/polyfill.js', null, null, true);
}
wp_enqueue_script( 'swiper', get_bloginfo('template_url') . '/assets/js/swiper.min.js', null, null, true);
wp_enqueue_script( 'scripts', get_bloginfo('template_url') . '/assets/js/scripts.js', null, null, true);
wp_enqueue_script( 'scripts-query', get_bloginfo('template_url') . '/assets/js/scripts-query.js',array( 'jquery' ), null, true);
}
# id текущей директории
$categories = get_the_category();
$cat = $categories[0]->term_id;
$args = array(
'post_type' => 'post', // Выводить посты
'posts_per_page' => 10, // Вывести 10 записей
'order' => 'DESC', // порядок сортировки от большего к меньшему ASC наоборот
'cat' => $cat, // Только из текущей директории
);
$id_post_current = get_the_ID();
$query = new WP_Query( $args );
while ( $query->have_posts() ) { $query->the_post(); ?>
<a href="<?php the_permalink(); ?>"> <?php
if( $id_post_current == get_the_ID() ) {
?> <b><?php the_title(); ?></b> <?php
} else {
the_title();
} ?>
</a> <?php
}
wp_reset_postdata(); // сброс ?>
wp_enqueue_style( 'main-style', get_stylesheet_uri(), array(), '3.1.0.1553430030', true );
wp_enqueue_style( 'main-style', get_stylesheet_uri());
if( is_single() ) {
wp_enqueue_script( 'youtube', get_bloginfo('template_url') . '/assets/js/youtube-player.js', null, null, true);
}