'ap-block-posts-editor-style', 'render_callback' => [$this, 'render'] ] ); // Register Block wp_set_script_translations( 'ap-block-posts-editor-script', 'advanced-post-block', APB_DIR_PATH . 'languages' ); remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); // Disable emoji load as image } // Register function render( $attributes ) { extract( $attributes ); wp_enqueue_style( 'ap-block-posts-style' ); if( 'ticker' === $layout ){ wp_enqueue_script( 'easyTicker' ); } wp_enqueue_script( 'ap-block-posts-script', APB_DIR_URL . 'dist/script.js', [ 'wp-api', 'wp-util', 'react', 'react-dom' ], APB_VERSION, true ); wp_set_script_translations( 'ap-block-posts-script', 'advanced-post-block', APB_DIR_PATH . 'languages' ); $className = $className ?? ''; $extraClass = apbIsPremium() ? 'premium' : 'free'; $blockClassName = "wp-block-ap-block-posts $extraClass $className align$align"; $allPosts = get_posts( array_merge( $this->query( $attributes ), [ 'posts_per_page' => -1 ] ) ); $skeletonAllowedTags = [ 'style' => [], 'div' => [ 'class' => [], 'id' => [] ], 'article' => [ 'class' => [] ], 'span' => [ 'class' => [] ], ]; $id = wp_unique_id( 'apbAdvancedPosts-' ); ob_start(); ?>