jQuery( document ).ready(function( $ ) {
......
});
// подключаем стили и скрипты
function register_styles_scripts() {
//стили
wp_register_style('bootstrapCSS', get_template_directory_uri() .
'/css/bootstrap.min.css');
wp_enqueue_style('bootstrapCSS');
//скрипты
wp_deregister_script('jquery');
wp_register_script('jquery', get_template_directory_uri() .
'/js/jquery-3.2.1.min.js');
wp_enqueue_script('jquery');
wp_register_script('PopperJS', get_template_directory_uri() .
'/js/popper.min.js');
wp_enqueue_script('PopperJS');
// шрифты
wp_enqueue_style('google-fonts-Lato', 'https://fonts.googleapis.com/css?family=Lato:300,400,400i,700', array(), null, 'all' );
wp_enqueue_style('google-fonts-Niconne', 'https://fonts.googleapis.com/css?family=Niconne', array(), null, 'all' );
}
add_action('wp_enqueue_scripts', 'register_styles_scripts');
/** Выводим dropdown кол-во товаров **/
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
function woocommerce_catalog_page_ordering() {
?>
<form action="" method="POST" name="results" class="woocommerce-ordering">
<select name="woocommerce-sort-by-columns" id="woocommerce-sort-by-columns" class="sortby" onchange="this.form.submit()">
<?php
//Get products on page reload
if (isset($_POST['woocommerce-sort-by-columns']) && (($_COOKIE['shop_pageResults'] <> $_POST['woocommerce-sort-by-columns']))) {
$numberOfProductsPerPage = $_POST['woocommerce-sort-by-columns'];
} else {
$numberOfProductsPerPage = $_COOKIE['shop_pageResults'];
}
$shopCatalog_orderby = apply_filters('woocommerce_sortby_page', array(
'10' => __('10', 'woocommerce'),
'20' => __('20', 'woocommerce'),
'40' => __('40', 'woocommerce'),
'-1' => __('Все', 'woocommerce'),
));
foreach ( $shopCatalog_orderby as $sort_id => $sort_name )
echo '<option value="' . $sort_id . '" ' . selected( $numberOfProductsPerPage, $sort_id, true ) . ' >' . $sort_name . '</option>';
?>
</select>
</form>
<?php echo ' </span>' ?>
<?php
}
// now we set our cookie if we need to
function dl_sort_by_page($count) {
if (isset($_COOKIE['shop_pageResults'])) { // if normal page load with cookie
$count = $_COOKIE['shop_pageResults'];
}
if (isset($_POST['woocommerce-sort-by-columns'])) { //if form submitted
setcookie('shop_pageResults', $_POST['woocommerce-sort-by-columns'], time()+1209600, '/', 'example.com, false); //this will fail if any part of page has been output- hope this works!
$count = $_POST['woocommerce-sort-by-columns'];
}
// else normal page load and no cookie
return $count;
}
add_filter('loop_shop_per_page','dl_sort_by_page');
.......data-video-id="<?php echo do_shortcode('[urlparam param='ytid' /]');?>" .....
, то заработает <?php
while ( have_posts() ) :
the_post();
get_template_part( 'template-parts/content', 'page' );
endwhile; // End of the loop.
?>
// задаем нужные нам критерии выборки данных из БД
$args = array(
'posts_per_page' => 5,
);
$query = new WP_Query( $args );
// Цикл
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
echo '<li>' . get_the_title() . '</li>';
}
} else {
// Постов не найдено
}
/* Возвращаем оригинальные данные поста. Сбрасываем $post. */
wp_reset_postdata();
'taxonomies' => array('portfoliocat'),