PluginProbe
bBlocks – Essential Gutenberg Blocks & Patterns Collection / trunk
bBlocks – Essential Gutenberg Blocks & Patterns Collection vtrunk
2.1.6 2.1.5 2.1.4 2.1.3 2.1.2 2.1.1 2.1.0 2.0.43 2.0.42 2.0.41 2.0.40 2.0.39 2.0.38 trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 All 106 releases
b-blocks / build / posts / render.php

render.php in bBlocks – Essential Gutenberg Blocks & Patterns Collection trunk, at build/posts/render.php

36 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 $prefix = 'bBlocksPosts';
3 $id = wp_unique_id( "$prefix-" );
4 $planClass = BBlocks\Inc\Utils::isPro() ? 'pro' : 'free';
5
6 use BBlocks\Inc\Posts\Posts as Posts;
7
8 extract( $attributes );
9
10 if( 'ticker' === $layout ){
11 wp_enqueue_script( 'easyTicker' );
12 }
13
14 $allPosts = get_posts( array_merge( Posts::query( $attributes ), [ 'posts_per_page' => -1 ] ) );
15
16 $skeletonAllowedTags = [
17 'style' => [],
18 'div' => [ 'class' => [], 'id' => [] ],
19 'article' => [ 'class' => [] ],
20 'span' => [ 'class' => [] ],
21 ];
22 ?>
23 <div
24 <?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- get_block_wrapper_attributes() is properly escaped ?>
25 <?php echo get_block_wrapper_attributes( [ 'class' => "$planClass align$align" ] ); ?>
26 id='<?php echo esc_attr( $id ); ?>'
27 data-nonce='<?php echo esc_attr( wp_json_encode( wp_create_nonce( 'wp_ajax' ) ) ); ?>'
28 data-attributes='<?php echo esc_attr( wp_json_encode( $attributes ) ); ?>'
29 data-extra='<?php echo esc_attr( wp_json_encode( [ 'totalPosts' => count( $allPosts ) ] ) ); ?>'
30 >
31 <pre id='firstPosts' style='display: none;'>
32 <?php echo esc_html( wp_json_encode( Posts::getPosts( $attributes ) ) ) ?>
33 </pre>
34
35 <?php echo wp_kses( Posts::loadingPlaceholder( $attributes, $prefix ), $skeletonAllowedTags ); ?>
36 </div>