<?php
get_header();
/*
Template Name: Page Builder
*/
?>
<?php if ( have_rows( 'builder_layout' ) ) : ?>
<?php while ( have_rows( 'builder_layout' ) ) : the_row(); ?>
<?php $layout = get_row_layout(); ?>
<?php get_template_part( "template-parts/builder-blocks/$layout" ); ?>
<?php endwhile; ?>
<?php else: ?>
<h2><?php _e('No layout found parent', 'ajat') ?></h2>
<?php endif; ?>
<?php get_footer(); ?>
<section class="section">
<div class="container">
<div class="row">
<div class="col-md-6">
<div class="content">
<?php if ( have_rows( 'column_1_page_layout' ) ) : ?>
<?php while ( have_rows( 'column_1_page_layout' ) ) : the_row(); ?>
<?php $layout = get_row_layout(); ?>
<?php get_template_part( "template-parts/acf-blocks/$layout" ); ?>
<?php endwhile; ?>
<?php else: ?>
<h2><?php _e('No layout found', 'ajat') ?></h2>
<?php endif; ?>
</div>
</div>
<div class="col-md-6">
<div class="content">
<?php if ( have_rows( 'column_2_page_layout' ) ) : ?>
<?php while ( have_rows( 'column_2_page_layout' ) ) : the_row(); ?>
<?php $layout = get_row_layout(); ?>
<?php get_template_part( "template-parts/acf-blocks/$layout" ); ?>
<?php endwhile; ?>
<?php else: ?>
<h2><?php _e('No layout found', 'ajat') ?></h2>
<?php endif; ?>
</div>
</div>
</div>
</div>
</section>
// 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(); ?>
add_filter( 'woocommerce_rest_prepare_product_object', 'filter_function_name', 10, 3 );
function filter_function_name( $response, $object, $request ){
if( empty( $response->data ) )
return $response;
$inclde = [
'id' => $response->data['id'],
'name' => $response->data['name'],
'images' => $response->data['images'],
'price' => $response->data['price'],
'meta_data' => $response->data['meta_data'],
'categories'=> $response->data['categories']
];
return $inclde;
}
И как можно реализовать, чтобы при наведении на фамилию преподавателя появлялась краткая информация о нём?