esc_url( rest_url() ) ) ); } add_action( 'enqueue_block_editor_assets', 'atomic_blocks_editor_assets' ); /** * Enqueue assets for frontend * * @since 1.0.0 */ function atomic_blocks_frontend_assets() { // Load the dismissable notice js wp_enqueue_script( 'atomic-blocks-dismiss-js', plugins_url( '/dist/assets/js/dismiss.js', dirname( __FILE__ ) ), array( 'wp-blocks', 'jquery' ), filemtime( plugin_dir_path( __FILE__ ) . '/assets/js/dismiss.js' ) ); } add_action( 'wp_enqueue_scripts', 'atomic_blocks_frontend_assets' ); // Add template to testimonial post type function atomic_blocks_testimonial_templates( $args, $post_type ) { if ( 'atomic-testimonial' == $post_type ) { // Lock the template $args['template_lock'] = true; // Setup the template $args['template'] = [ array( 'atomic/atomic-testimonial' ) ]; } return $args; } add_filter( 'register_post_type_args', 'atomic_blocks_testimonial_templates', 20, 2 ); // Render the testimonial posts for the frontend function atomic_blocks_testimonial_list_render( $attributes ) { $posts = (array) wp_get_recent_posts( array( 'numberposts' => 5, 'post_status' => 'publish', ) ); if ( count( $posts ) === 0 ) { return __( 'No posts', 'atomic-blocks' ); } $markup = '