array( $this, 'render_callback' ), ) ); } public function get_label() { return __( 'Custom Post Type', 'getwid' ); } public function render_callback( $attributes, $content ) { $query_args = getwid_build_custom_post_type_query( $attributes ); $q = new \WP_Query( $query_args ); $use_template = false; $template_part_content = ''; if ( isset( $attributes['postTemplate'] ) && '' !== $attributes['postTemplate'] ) { $template_post = get_post( $attributes['postTemplate'], ARRAY_A ); if ( ! is_null( $template_post ) && '' !== $template_post['post_content'] ) { $use_template = true; $template_part_content = $template_post['post_content']; } } $block_name = 'wp-block-getwid-custom-post-type'; $post_type = isset( $attributes['postType'] ) ? $attributes['postType'] : 'post'; $extra_attr = array( 'block_name' => $block_name, ); $class = $block_name; $class .= ' custom-post-type-' . $post_type; if ( isset( $attributes['align'] ) ) { $class .= ' align' . $attributes['align']; } if ( isset( $attributes['postLayout'] ) ) { $class .= ' has-layout-' . $attributes['postLayout']; } if ( isset( $attributes['spacing'] ) && 'default' !== $attributes['spacing'] ) { $class .= ' has-spacing-' . $attributes['spacing']; } if ( isset( $attributes['className'] ) ) { $class .= ' ' . $attributes['className']; } $wrapper_class = $block_name . '__wrapper'; if ( isset( $attributes['columns'] ) && isset( $attributes['postLayout'] ) && 'grid' === $attributes['postLayout'] ) { $wrapper_class .= ' getwid-columns getwid-columns-' . $attributes['columns']; } ob_start(); ?>