post_types->is_supported_post_type(); if ($post_type) { $result = [ 'strategy' => 'customizer', 'prefix' => $post_type ]; return $result; } if (function_exists('is_woocommerce')) { if (is_woocommerce()) { $result = [ 'strategy' => 'customizer', 'prefix' => 'woo' ]; return $result; } } $result = [ 'strategy' => 'customizer', 'prefix' => 'blog' ]; return $result; } } /** * Dispaly post pagination. * * @param array $args Pagination config. */ if (! function_exists('blocksy_display_posts_pagination')) { function blocksy_display_posts_pagination( $args = [] ) { $prefix = blocksy_manager()->screen->get_prefix([ 'allowed_prefixes' => [ 'blog', 'woo_categories' ], 'default_prefix' => 'blog' ]); // Don't print empty markup if there's only one page. $args = wp_parse_args( $args, [ 'has_pagination' => get_theme_mod( $prefix . '_has_pagination', 'yes' ) === 'yes', 'pagination_type' => get_theme_mod( $prefix . '_pagination_global_type', 'simple' ), 'last_page_text' => __('No more posts to load', 'blocksy'), 'total_pages' => null, 'current_page' => null, 'format' => null, 'base' => null ] ); if ($prefix === 'woo_categories') { $args['last_page_text'] = __('No more products to load', 'blocksy'); } if (! $args['has_pagination']) { return ''; } if (! $args['total_pages'] || !$args['current_page']) { global $wp_query, $wp_rewrite; $args['current_page'] = $wp_query->get('paged'); $args['total_pages'] = $wp_query->max_num_pages; if (! $args['current_page']) { $args['current_page'] = 1; } } if ($args['total_pages'] <= 1 ) { return ''; } $button_output = ''; if ( $args['pagination_type'] === 'load_more' && intval($args['current_page']) !== intval($args['total_pages']) ) { $label_button = get_theme_mod( $prefix . '_load_more_label', __('Load More', 'blocksy') ); $button_output = '' . $label_button . ''; } if ( $args['pagination_type'] !== 'simple' && $args['pagination_type'] !== 'next_prev' ) { if (intval($args['current_page']) === intval($args['total_pages'])) { return ''; } $button_output = '