// Register Testimonials Post Type
function testimonials_post_type() {
$labels = array(
'name' => _x( 'Testimonials', 'Post Type General Name', 'youth-worker' ),
'singular_name' => _x( 'Testimonial', 'Post Type Singular Name', 'youth-worker' ),
'menu_name' => __( 'Testimonials', 'youth-worker' ),
'name_admin_bar' => __( 'Testimonials', 'youth-worker' ),
'archives' => __( 'Testimonial Archives', 'youth-worker' ),
'attributes' => __( 'Testimonial Attributes', 'youth-worker' ),
'parent_item_colon' => __( 'Parent Item:', 'youth-worker' ),
'all_items' => __( 'All Testimonials', 'youth-worker' ),
'add_new_item' => __( 'Add New Testimonial', 'youth-worker' ),
'add_new' => __( 'Add New', 'youth-worker' ),
'new_item' => __( 'New Testimonial', 'youth-worker' ),
'edit_item' => __( 'Edit Testimonial', 'youth-worker' ),
'update_item' => __( 'Update Testimonial', 'youth-worker' ),
'view_item' => __( 'View Testimonial', 'youth-worker' ),
'view_items' => __( 'View Testimonials', 'youth-worker' ),
'search_items' => __( 'Search Testimonial', 'youth-worker' ),
'not_found' => __( 'Not found', 'youth-worker' ),
'not_found_in_trash' => __( 'Not found in Trash', 'youth-worker' ),
'featured_image' => __( 'Featured Image', 'youth-worker' ),
'set_featured_image' => __( 'Set featured image', 'youth-worker' ),
'remove_featured_image' => __( 'Remove featured image', 'youth-worker' ),
'use_featured_image' => __( 'Use as featured image', 'youth-worker' ),
'insert_into_item' => __( 'Insert into item', 'youth-worker' ),
'uploaded_to_this_item' => __( 'Uploaded to this item', 'youth-worker' ),
'items_list' => __( 'Testimonials list', 'youth-worker' ),
'items_list_navigation' => __( 'Testimonials list navigation', 'youth-worker' ),
'filter_items_list' => __( 'Filter Testimonials list', 'youth-worker' ),
);
$args = array(
'label' => __( 'Testimonial', 'youth-worker' ),
'description' => __( 'Post Type for testimonials', 'youth-worker' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail', 'custom-fields', 'page-attributes', 'post-formats' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 30,
'menu_icon' => 'dashicons-format-status',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'post',
);
register_post_type( 'testimonials', $args );
}
add_action( 'init', 'testimonials_post_type', 0 );
$testimonials = new WP_Query(array(
'post_type' => 'testimonials',
'orderby' => 'date',
'order' => 'DESC',
));
<?php if ( $testimonials->have_posts() ) : ?>
<?php while ( $testimonials->have_posts() ) : $testimonials->the_post(); ?>
<div class="testimonial-item">
blabla
</div>
<?php endif; ?>
<?php endwhile;?>
<?php endif; wp_reset_postdata(); ?>
// отключение сайдбара
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );
// отключить хлебные крошки
remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 );
// добавить основной контейнер
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
add_action( 'woocommerce_before_main_content', 'storm_output_content_wrapper_start', 10 );
function storm_output_content_wrapper_start() {
?>
<div class="container-1000">
<?php
}
// закрыть основной контейнер
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
add_action( 'woocommerce_after_main_content', 'storm_output_content_wrapper_end', 40 );
function storm_output_content_wrapper_end() {
?>
</div><!-- container-1000 -->
<?php
}
add_action( 'woocommerce_before_main_content', 'storm_archive_output_content_wrapper_start', 15 );
function storm_archive_output_content_wrapper_start() {
if( is_shop() || is_product_category() ) {
?>
<div class="category-content">
<?php
}
}
add_action( 'woocommerce_before_main_content', 'storm_catalog_wrapper_start', 20 );
function storm_catalog_wrapper_start() {
if( is_shop() || is_product_category() ) {
?>
<div class="catalog-list-wrapper">
<?php
}
}
//вывод хлебных крошек на странице архива
add_action( 'woocommerce_before_main_content', 'storm_catalog_breadcrumbs', 25 );
function storm_catalog_breadcrumbs() {
if( is_shop() || is_product_category() ) {
?>
<div class="breadcrumbs">
<?php woocommerce_breadcrumb() ?>
</div>
<?php
}
}
// вывод сортировки и кнопки переключателя фильтра
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
add_action('woocommerce_before_shop_loop', 'storm_catalog_ordering', 30);
function storm_catalog_ordering() {
?>
<div class="catalog-sorting-wrapper">
<button type="button" class="fixed-toggle filter-toggle" id="filter-toggle"><i class="fa fa-filter"></i><?php _e('Filter','storm-store') ?></button>
<div class="product-sorting">
<span class="product-sorting-label"><?php _e('Сортировать:','storm-store') ?></span>
<div class="select-wrapper">
<?php woocommerce_catalog_ordering() ?>
</div>
</div>
</div>
<?php
}
// Изменить стрелки пагинации
add_filter( 'woocommerce_pagination_args', 'custom_woo_pagination' );
function custom_woo_pagination( $args ) {
$args['prev_text'] = '<span class="fa fa-angle-left"></span><span class="sr-only">Previous page</span>';
$args['next_text'] = '<span class="fa fa-angle-right"></span><span class="sr-only">Next page</span>';
return $args;
}
// вывод пагинации
remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 );
add_action('woocommerce_after_shop_loop', 'storm_pagination', 10);
function storm_pagination() {
?>
<div class="pagination-wrapper">
<?php woocommerce_pagination(); ?>
</div>
<?php
}
add_action( 'woocommerce_after_main_content', 'storm_catalog_wrapper_end', 15 );
function storm_catalog_wrapper_end() {
if( is_shop() || is_product_category() ) {
?>
</div> <!-- catalog-list-wrapper -->
<?php
}
}
add_action( 'woocommerce_after_main_content', 'storm_archive_output_content_wrapper_end', 30 );
function storm_archive_output_content_wrapper_end() {
if( is_shop() || is_product_category() ) {
?>
</div><!-- category-content -->
<?php
}
}
function mytheme_scripts() {
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', get_template_directory_uri() . '/js/jquery-1.11.2.min.js', array('custom-js'), null, true );
wp_enqueue_script( 'jquery');
wp_enqueue_script( 'custom-js', get_template_directory_uri() . '/assets/js/common.js', array(), null, true );
}
add_action( 'wp_enqueue_scripts', 'mytheme_scripts' );