'', 'previewImg' => '', // Layout 'layout' => '1', // Query Setting 'taxType' => 'regular', 'taxSlug' => 'category', 'taxValue' => '[]', 'queryNumber' => 6, // General Setting 'taxGridEn' => true, 'columns' => (object) array( 'lg' => '1' ), 'rowGap' => (object) array( 'lg' => '20', 'unit' => 'px', ), 'titleShow' => true, 'headingShow' => true, 'excerptShow' => false, 'countShow' => true, 'openInTab' => false, 'notFoundMessage' => 'No Taxonomy Found.', // Heading Setting/Style 'headingText' => 'Post Taxonomy', 'headingURL' => '', 'headingBtnText' => 'View More', 'headingStyle' => 'style9', 'headingTag' => 'h2', 'headingAlign' => 'left', 'subHeadingShow' => false, 'subHeadingText' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer ut sem augue. Sed at felis ut enim dignissim sodales.', 'titleTag' => 'span', 'contentTitleAlign' => 'left', 'titlePosition' => true, 'customTaxTitleColor' => false, 'seperatorTaxTitleLink' => admin_url( 'edit-tags.php?taxonomy=category' ), // Content Setting/Style 'excerptLimit' => 30, // Image Setting/Style 'imgCrop' => ( ultimate_post()->get_setting( 'disable_image_size' ) == 'yes' ? 'full' : 'ultp_layout_landscape' ), // Separator 'separatorShow' => false, // Custom Wrapper Style 'customTaxColor' => false, 'seperatorTaxLink' => admin_url( 'edit-tags.php?taxonomy=category' ), 'TaxAnimation' => 'none', 'advanceId' => '', 'advanceZindex' => '', 'hideExtraLarge' => false, 'hideTablet' => false, 'hideMobile' => false, 'advanceCss' => '', ); } public function register() { register_block_type( 'ultimate-post/ultp-taxonomy', array( 'editor_script' => 'ultp-blocks-editor-script', 'editor_style' => 'ultp-blocks-editor-css', 'render_callback' => array( $this, 'content' ), ) ); } public function content( $attr, $noAjax ) { $attr = wp_parse_args( $attr, $this->get_attributes() ); if ( ! $noAjax ) { $paged = is_front_page() ? get_query_var( 'page' ) : get_query_var( 'paged' ); $attr['paged'] = $paged ? $paged : 1; } $block_name = 'ultp-taxonomy'; $wraper_before = $wraper_after = $post_loop = ''; $recent_posts = ultimate_post()->get_category_data( json_decode( $attr['taxValue'] ), $attr['queryNumber'], $attr['taxType'], $attr['taxSlug'] ); if ( ! empty( $recent_posts ) ) { $attr['className'] = isset( $attr['className'] ) && $attr['className'] ? preg_replace( '/[^A-Za-z0-9_ -]/', '', $attr['className'] ) : ''; $attr['imgCrop'] = isset( $attr['imgCrop'] ) && $attr['imgCrop'] ? preg_replace( '/[^A-Za-z0-9_ -]/', '', $attr['imgCrop'] ) : ''; $attr['advanceId'] = isset( $attr['advanceId'] ) ? sanitize_html_class( $attr['advanceId'] ) : ''; $attr['blockId'] = isset( $attr['blockId'] ) ? sanitize_html_class( $attr['blockId'] ) : ''; $attr['titleTag'] = in_array( $attr['titleTag'], ultimate_post()->ultp_allowed_block_tags() ) ? $attr['titleTag'] : 'span'; $attr['layout'] = sanitize_html_class( $attr['layout'] ); $attr['TaxAnimation'] = sanitize_html_class( $attr['TaxAnimation'] ); $wraper_before .= '
'; $wraper_before .= '
'; $wraper_before .= ultimate_post()->postx_loading(); // Loading if ( $attr['headingShow'] ) { $wraper_before .= '
'; $wraper_before .= '
'; include ULTP_PATH . 'blocks/template/heading.php'; // Heading $wraper_before .= '
'; $wraper_before .= '
'; } $wraper_before .= '
'; $wraper_before .= ''; $wraper_after .= '
'; $wraper_after .= '
'; $wraper_after .= '
'; wp_reset_query(); } else { $wraper_before .= ultimate_post()->get_no_result_found_html( $attr['notFoundMessage'] ); } return $noAjax ? $post_loop : $wraper_before . $post_loop . $wraper_after; } }