'', 'previewImg' => '', //-------------------------- // Layout //-------------------------- 'layout' => 'layout1', //-------------------------- // Query Setting //-------------------------- 'queryQuick' => '', 'queryNumPosts' => (object)['lg'=>5], 'queryNumber' => 5, 'queryType' => 'post', 'queryTax' => 'category', 'queryTaxValue' => '[]', 'queryRelation' => 'OR', 'queryOrderBy' => 'date', 'metaKey' => 'custom_meta_key', 'queryOrder' => 'desc', // Include Remove from Version 2.5.4 'queryInclude' => '', 'queryExclude' => '[]', 'queryAuthor' => '[]', 'queryOffset' => '0', 'queryExcludeTerm' => '[]', 'queryExcludeAuthor' => '[]', 'querySticky' => true, 'queryUnique' => '', 'queryPosts' => '[]', 'queryCustomPosts' => '[]', //-------------------------- // General Setting //-------------------------- 'titleShow' => true, 'titleStyle' => 'none', 'headingShow' => true, 'excerptShow' => true, 'catShow' => true, 'metaShow' => true, 'showImage' => true, 'filterShow' => false, 'paginationShow' => false, 'readMore' => false, 'contentTag' => 'div', 'openInTab' => false, 'notFoundMessage' => 'No Post Found', //-------------------------- // Heading Setting/Style //-------------------------- 'headingText' => 'Post Module #2', '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.', //-------------------------- // Title Setting/Style //-------------------------- 'titleTag' => 'h3', 'titlePosition' => true, 'titleLength' => 0, //-------------------------- // Content Setting/Style //-------------------------- 'varticalAlign' => 'middle', 'showSeoMeta' => false, 'showSmallExcerpt' => false, 'showFullExcerpt' => false, 'smallExcerptLimit' => 20, 'excerptLimit' => 20, 'excerptBigColor' => '#fff', //-------------------------- // Category Setting/Style //-------------------------- 'maxTaxonomy'=> '30', 'taxonomy' => 'category', 'showSmallCat' => false, 'catStyle' => 'classic', 'catPosition' => 'aboveTitle', 'customCatColor' => false, 'seperatorLink' => admin_url( 'edit-tags.php?taxonomy=category' ), 'onlyCatColor' => false, //-------------------------- // Meta Setting/Style //-------------------------- 'showSmallMeta' => true, 'metaPosition' => 'top', 'metaStyle' => 'icon', 'authorLink' => true, 'metaSeparator' => 'dot', 'metaList' => '["metaAuthor","metaDate","metaRead"]', 'metaMinText' => 'min read', 'metaAuthorPrefix' => 'By', 'metaDateFormat' => 'M j, Y', 'metaListSmall' => '["metaAuthor","metaDate"]', 'LargeMetaColor' => '#fff', //-------------------------- // Inner Content Setting/Style //-------------------------- //-------------------------- // Image Setting/Style //-------------------------- 'columnFlip' => false, 'imgCrop' => 'full', 'imgCropSmall' => (ultimate_post()->get_setting('disable_image_size') == 'yes' ? 'full' : 'ultp_layout_square'), 'imgAnimation' => 'opacity', 'imgOverlay' => false, 'imgOverlayType' => 'default', 'fallbackEnable' => true, 'fallbackImg' => '', 'imgSrcset' => false, 'imgLazy' => false, //-------------------------- // Video Setting/Style //-------------------------- 'vidIconEnable' => true, 'popupAutoPlay' => true, 'iconSize' => (object)['lg'=>'40', 'sm'=> '30', 'xs'=> '30', 'unit' => 'px'], // by default should be off 'enablePopup' => false, 'enablePopupTitle' => true, //-------------------------- // Separator //-------------------------- 'separatorShow' => false, //-------------------------- // Read more Setting/Style //-------------------------- 'showSmallBtn' => false, 'readMoreText' => '', 'readMoreIcon' => 'rightArrowLg', //-------------------------- // Filter Setting/Style //-------------------------- 'filterBelowTitle' => false, 'filterType' => 'category', 'filterText' => 'all', 'filterValue' => '[]', 'filterMobile' => true, 'filterMobileText' => 'More', //-------------------------- // Pagination Setting/Style //-------------------------- 'paginationType' => 'navigation', 'paginationNav' => 'textArrow', 'navPosition' => 'topRight', //-------------------------- // Wrapper Style //-------------------------- 'advanceId' => '', 'advanceZindex' => '', 'hideExtraLarge' => false, 'hideTablet' => false, 'hideMobile' => false, 'advanceCss' => '', 'currentPostId' => '', ); } public function register() { register_block_type( 'ultimate-post/post-module-2', 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()); global $unique_ID; if (!$noAjax) { $paged = is_front_page() ? get_query_var('page') : get_query_var('paged'); $attr['paged'] = $paged ? $paged : 1; } if($attr['queryUnique'] && isset($attr['savedQueryUnique'])) { $unique_ID = $attr['savedQueryUnique']; } $block_name = 'post-module-2'; $wraper_before = $wraper_after = $post_loop = ''; $attr['queryNumber'] = ultimate_post()->get_post_number(5, $attr['queryNumber'], $attr['queryNumPosts']); $recent_posts = new \WP_Query( ultimate_post()->get_query( $attr ) ); $pageNum = ultimate_post()->get_page_number($attr, $recent_posts->found_posts); // Dummy Img Url $dummy_url = ULTP_URL.'assets/img/ultp-fallback-img.png'; // Loadmore and Unique content if($attr['queryUnique'] && isset($attr['loadMoreQueryUnique']) && $attr['paginationShow'] && ($attr['paginationType'] == 'loadMore')) { $unique_ID = $attr['loadMoreQueryUnique']; $current_unique_posts = $attr['ultp_current_unique_posts']; } if ($recent_posts->have_posts()) { $attr['className'] = isset($attr['className']) && $attr['className'] ? preg_replace('/[^A-Za-z0-9_ -]/', '', $attr['className']) : ''; $attr['align'] = isset($attr['align']) && $attr['align'] ? preg_replace('/[^A-Za-z0-9_ -]/', '', $attr['align']) : ''; $attr['advanceId'] = isset($attr['advanceId']) ? sanitize_html_class( $attr['advanceId'] ) : ''; $attr['blockId'] = isset($attr['blockId']) ? sanitize_html_class( $attr['blockId'] ) : ''; $attr['contentTag'] = in_array( $attr['contentTag'], ultimate_post()->ultp_allowed_block_tags() ) ? $attr['contentTag'] : 'div'; $attr['layout'] = sanitize_html_class( $attr['layout'] ); $attr['imgAnimation'] = sanitize_html_class( $attr['imgAnimation'] ); $attr['imgOverlayType'] = sanitize_html_class( $attr['imgOverlayType'] ); $attr['popupAutoPlay'] = $attr['popupAutoPlay'] == true ; $attr['readMoreText'] = wp_kses($attr['readMoreText'], ultimate_post()->ultp_allowed_html_tags()); $attr['varticalAlign'] = sanitize_html_class( $attr['varticalAlign'] ); $wraper_before .= '
';
}
$post_loop .= '';
} else {
if (($attr['layout'] == 'layout2') || ($attr['layout'] === 'layout3') || ($attr['layout'] === 'layout5')) {
// Image
$post_loop .= '';
// Post Image Id
$block_img_id = $post_thumb_id ? $post_thumb_id : ($attr['fallbackEnable'] && isset($attr['fallbackImg']['id']) ? $attr['fallbackImg']['id'] : '');
// Post Image
if($post_thumb_id || ($attr['fallbackEnable'] && $block_img_id)) {
$post_loop .= ultimate_post()->get_image($block_img_id, $attr['imgCropSmall'], '', $title, $attr['imgSrcset'], $attr['imgLazy']);
} else {
$video = ultimate_post()->get_youtube_id($post_video);
$post_loop .= '
';
}
$post_loop .= '';
}
if($post_video){
$post_loop .= '';
}
}
if (($attr['catPosition'] != 'aboveTitle') && ($idx == 0 || $attr['showSmallCat']) && $attr['catShow'] ) {
$post_loop .= '