';
}
} else {
if ($layout == 'listing') $image_size = 'rishi-blog-grid';
if ($layout == 'grid' || $layout == 'masonry_grid') $image_size = 'rishi-blog-grid';
if ($wrapper) echo '
';
}
}
}
endif;
if ( ! function_exists( 'rishi_single_featured_image' ) ) :
/**
* Single post featured image helper render.
*
* @return void
*/
function rishi_single_featured_image( $prefix, $featured_image_ratio = NULL, $featured_image_size = NULL, $featured_image_visibility = NULL ) {
$featured_image_source = [
'prefix' => $prefix,
'strategy' => 'customizer'
];
if ( ! $featured_image_visibility ) {
$featured_image_visibility = [
'desktop' => true,
'tablet' => true,
'mobile' => true
];
}
if ( ! $featured_image_ratio ) {
$featured_image_ratio = rishi__cb_get_akv_or_customizer(
'featured_image_ratio',
$featured_image_source,
'original'
);
}
if ( ! $featured_image_size ) {
$featured_image_size = rishi__cb_get_akv_or_customizer(
'featured_image_size',
$featured_image_source,
'original'
);
}
if (rishi__cb_get_akv_or_customizer(
'has_featured_image',
$featured_image_source,
'yes'
) === 'no') {
return '';
}
if (! has_post_thumbnail()) {
return '';
}
if (rishi__cb_customizer_default_akg(
'disable_featured_image',
rishi__cb_customizer_get_post_options(),
'no'
) === 'yes') {
return '';
}
$class = 'rt-featured-image';
$class .= ' ' . rishi__cb_customizer_visibility_classes(
$featured_image_visibility
);
if( $featured_image_ratio == 'original' && is_singular( [ 'post', 'page' ] ) ){
$class .= $featured_image_ratio . '-ratio';
}
$maybe_figcaption = wp_get_attachment_caption(get_post_thumbnail_id());
if (! empty($maybe_figcaption)) {
$maybe_figcaption = '
' . trim($maybe_figcaption) . '';
} else {
$maybe_figcaption = '';
}
return rishi__cb_html_tag('figure', ['class' => $class], rishi__cb_customizer_image([
'attachment_id' => get_post_thumbnail_id(),
'ratio' => $featured_image_ratio,
'size' => $featured_image_size
]) . $maybe_figcaption);
}
endif;
if (!function_exists('wp_body_open')) :
/**
* Shim for sites older than 5.2.
*
* @link https://core.trac.wordpress.org/ticket/12563
*/
function wp_body_open()
{
do_action('wp_body_open');
}
endif;
if (!function_exists('rishi_get_schema_type')) :
/**
* Schema Type
*/
function rishi_get_schema_type()
{
return apply_filters('rishi_schema_type', 'microdata');
}
endif;
if (!function_exists('rishi_get_microdata')) :
/**
* Microdata Schema
*
* @param string $context The element to target
* @return string final attribute
*/
function rishi_get_microdata($context)
{
$data = false;
if ('microdata' !== rishi_get_schema_type()) {
return false;
}
if ('head' === $context) {
$data = 'itemtype="http://schema.org/WebSite" itemscope';
}
if ('body' === $context) {
$type = 'WebPage';
if (is_home() || is_archive() || is_attachment() || is_tax() || is_single()) {
$type = 'Blog';
}
if (is_search()) {
$type = 'SearchResultsPage';
}
$type = apply_filters('rishi_body_itemtype', $type);
$data = sprintf(
'itemtype="https://schema.org/%s" itemscope',
esc_html($type)
);
}
if ('header' === $context) {
$data = 'itemtype="https://schema.org/WPHeader" itemscope';
}
if ('navigation' === $context) {
$data = 'itemtype="https://schema.org/SiteNavigationElement" itemscope';
}
if ('organization' === $context) {
$data = 'itemtype="https://schema.org/Organization" itemscope';
}
if ('person' === $context) {
$data = 'itemtype="https://schema.org/Person" itemscope';
}
if ('article' === $context) {
$type = apply_filters('rishi_article_itemtype', 'CreativeWork');
$data = sprintf(
'itemtype="https://schema.org/%s" itemscope',
esc_html($type)
);
}
if ('post-author' === $context) {
$data = 'itemprop="author" itemtype="https://schema.org/Person" itemscope';
}
if ('comment-body' === $context) {
$data = 'itemtype="https://schema.org/UserComments" itemscope';
}
if ('comment-author' === $context) {
$data = 'itemprop="creator" itemtype="https://schema.org/Person" itemscope';
}
if ('sidebar' === $context) {
$data = 'itemtype="https://schema.org/WPSideBar" itemscope';
}
if ('footer' === $context) {
$data = 'itemtype="https://schema.org/WPFooter" itemscope';
}
if ($data) {
return apply_filters("rishi_{$context}_microdata", $data);
}
}
endif;
if (!function_exists('rishi_microdata')) :
/**
* Output our microdata for an element.
*
* @param $context The element to target.
* @return string The microdata.
*/
function rishi_microdata($context)
{
echo rishi_get_microdata($context); // WPCS: XSS ok, sanitization ok.
}
endif;
if (!function_exists('rishi_comment_callback')) :
/**
* Callback function for Comment List *
*
* @link https://codex.wordpress.org/Function_Reference/wp_list_comments
*/
function rishi_comment_callback($comment, $args, $depth)
{
if ('div' == $args['style']) {
$tag = 'div';
$add_below = 'comment';
} else {
$tag = 'li';
$add_below = 'div-comment';
} ?>
< id="comment-">
>
comment_approved == '0') : ?>
>
$add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))); ?>
function_exists('rishi__cb_customizer_image_picker_file') ? rishi__cb_customizer_image_picker_file('breadcrumb-sep-1') : '',
'type-2' => function_exists('rishi__cb_customizer_image_picker_file') ? rishi__cb_customizer_image_picker_file('breadcrumb-sep-2') : '',
'type-3' => function_exists('rishi__cb_customizer_image_picker_file') ? rishi__cb_customizer_image_picker_file('breadcrumb-sep-3') : '',
];
if ($breadcrumbs_separator == 'type-1') {
$seperator_svg = $separators['type-1'];
} elseif ($breadcrumbs_separator == 'type-2') {
$seperator_svg = $separators['type-2'];
} elseif ($breadcrumbs_separator == 'type-3') {
$seperator_svg = $separators['type-3'];
} else {
$seperator_svg = '';
}
$delimiter = '
' . $seperator_svg . '';
$before = '
'; // tag before the current crumb
$after = ''; // tag after the current crumb
//settings from the theme
if (get_theme_mod('breadcrumbs_position', $defaults['breadcrumbs_position']) !== 'none') {
$depth = 1;
?>
'; ?>
>
' . esc_html__('Home', 'rishi') . '' . $delimiter . '';
if (is_home()) {
$depth = 2;
echo $before . '
' . esc_html(single_post_title('', false)) . '' . $after;
} elseif (is_category()) {
$depth = 2;
$thisCat = get_category(get_query_var('cat'), false);
if ($show_front === 'page' && $post_page) { //If static blog post page is set
$p = get_post($post_page);
echo '
' . esc_html($p->post_title) . '' . $delimiter . '';
$depth++;
}
if ($thisCat->parent != 0) {
$parent_categories = get_category_parents($thisCat->parent, false, ',');
$parent_categories = explode(',', $parent_categories);
foreach ($parent_categories as $parent_term) {
$parent_obj = get_term_by('name', $parent_term, 'category');
if (is_object($parent_obj)) {
$term_url = get_term_link($parent_obj->term_id);
$term_name = $parent_obj->name;
echo '
' . esc_html($term_name) . '' . $delimiter . '';
$depth++;
}
}
}
echo $before . '
' . esc_html(single_cat_title('', false)) . '' . $after;
} elseif (rishi_is_woocommerce_activated() && (is_product_category() || is_product_tag())) { //For Woocommerce archive page
$depth = 2;
$current_term = $GLOBALS['wp_query']->get_queried_object();
if (wc_get_page_id('shop')) { //Displaying Shop link in woocommerce archive page
$_name = wc_get_page_id('shop') ? get_the_title(wc_get_page_id('shop')) : '';
if (!$_name) {
$product_post_type = get_post_type_object('product');
$_name = $product_post_type->labels->singular_name;
}
echo '
' . esc_html($_name) . '' . $delimiter . '';
$depth++;
}
if (is_product_category()) {
$ancestors = get_ancestors($current_term->term_id, 'product_cat');
$ancestors = array_reverse($ancestors);
foreach ($ancestors as $ancestor) {
$ancestor = get_term($ancestor, 'product_cat');
if (!is_wp_error($ancestor) && $ancestor) {
echo '
' . esc_html($ancestor->name) . '' . $delimiter . '';
$depth++;
}
}
}
echo $before . '
' . esc_html($current_term->name) . '' . $after;
} elseif (rishi_is_woocommerce_activated() && is_shop()) { //Shop Archive page
$depth = 2;
if (get_option('page_on_front') == wc_get_page_id('shop')) {
return;
}
$_name = wc_get_page_id('shop') ? get_the_title(wc_get_page_id('shop')) : '';
$shop_url = (wc_get_page_id('shop') && wc_get_page_id('shop') > 0) ? get_the_permalink(wc_get_page_id('shop')) : home_url('/shop');
if (!$_name) {
$product_post_type = get_post_type_object('product');
$_name = $product_post_type->labels->singular_name;
}
echo $before . '
' . esc_html($_name) . '' . $after;
} elseif (is_tag()) {
$depth = 2;
$queried_object = get_queried_object();
echo $before . '
' . esc_html(single_tag_title('', false)) . '' . $after;
} elseif (is_author()) {
global $author;
$depth = 2;
$userdata = get_userdata($author);
echo $before . '
' . esc_html($userdata->display_name) . '' . $after;
} elseif (is_search()) {
$depth = 2;
$request_uri = $_SERVER['REQUEST_URI'];
echo $before . '
' . sprintf(__('Search Results for "%s"', 'rishi'), esc_html(get_search_query())) . '' . $after;
} elseif (is_day()) {
$depth = 2;
echo '
' . esc_html(get_the_time(__('Y', 'rishi'))) . '' . $delimiter . '';
$depth++;
echo '
' . esc_html(get_the_time(__('F', 'rishi'))) . '' . $delimiter . '';
$depth++;
echo $before . '
' . esc_html(get_the_time(__('d', 'rishi'))) . '' . $after;
} elseif (is_month()) {
$depth = 2;
echo '
' . esc_html(get_the_time(__('Y', 'rishi'))) . '' . $delimiter . '';
$depth++;
echo $before . '
' . esc_html(get_the_time(__('F', 'rishi'))) . '' . $after;
} elseif (is_year()) {
$depth = 2;
echo $before . '
' . esc_html(get_the_time(__('Y', 'rishi'))) . '' . $after;
} elseif (is_single() && !is_attachment()) {
$depth = 2;
if (rishi_is_woocommerce_activated() && 'product' === get_post_type()) { //For Woocommerce single product
if (wc_get_page_id('shop')) { //Displaying Shop link in woocommerce archive page
$_name = wc_get_page_id('shop') ? get_the_title(wc_get_page_id('shop')) : '';
if (!$_name) {
$product_post_type = get_post_type_object('product');
$_name = $product_post_type->labels->singular_name;
}
echo '
' . esc_html($_name) . '' . $delimiter . '';
$depth++;
}
if ($terms = wc_get_product_terms($post->ID, 'product_cat', array('orderby' => 'parent', 'order' => 'DESC'))) {
$main_term = apply_filters('woocommerce_breadcrumb_main_term', $terms[0], $terms);
$ancestors = get_ancestors($main_term->term_id, 'product_cat');
$ancestors = array_reverse($ancestors);
foreach ($ancestors as $ancestor) {
$ancestor = get_term($ancestor, 'product_cat');
if (!is_wp_error($ancestor) && $ancestor) {
echo '
' . esc_html($ancestor->name) . '' . $delimiter . '';
$depth++;
}
}
echo '
' . esc_html($main_term->name) . '' . $delimiter . '';
$depth++;
}
echo $before . '
' . esc_html(get_the_title()) . '' . $after;
} elseif (get_post_type() != 'post') {
$post_type = get_post_type_object(get_post_type());
if ($post_type->has_archive == true) { // For CPT Archive Link
// Add support for a non-standard label of 'archive_title' (special use case).
$label = !empty($post_type->labels->archive_title) ? $post_type->labels->archive_title : $post_type->labels->name;
echo '
' . esc_html($label) . '' . $delimiter . '';
$depth++;
}
echo $before . '
' . esc_html(get_the_title()) . '' . $after;
} else { //For Post
$cat_object = get_the_category();
$potential_parent = 0;
if ($show_front === 'page' && $post_page) { //If static blog post page is set
$p = get_post($post_page);
echo '
' . esc_html($p->post_title) . '' . $delimiter . '';
$depth++;
}
if ($cat_object) { //Getting category hierarchy if any
//Now try to find the deepest term of those that we know of
$use_term = key($cat_object);
foreach ($cat_object as $key => $object) {
//Can't use the next($cat_object) trick since order is unknown
if ($object->parent > 0 && ($potential_parent === 0 || $object->parent === $potential_parent)) {
$use_term = $key;
$potential_parent = $object->term_id;
}
}
$cat = $cat_object[$use_term];
$cats = get_category_parents($cat, false, ',');
$cats = explode(',', $cats);
foreach ($cats as $cat) {
$cat_obj = get_term_by('name', $cat, 'category');
if (is_object($cat_obj)) {
$term_url = get_term_link($cat_obj->term_id);
$term_name = $cat_obj->name;
echo '
' . esc_html($term_name) . '' . $delimiter . '';
$depth++;
}
}
}
echo $before . '
' . esc_html(get_the_title()) . '' . $after;
}
} elseif (!is_single() && !is_page() && get_post_type() != 'post' && !is_404()) { //For Custom Post Archive
$depth = 2;
$post_type = get_post_type_object(get_post_type());
if (get_query_var('paged')) {
echo '
' . esc_html($post_type->label) . '' . $delimiter . '/';
echo $before . sprintf(__('Page %s', 'rishi'), get_query_var('paged')) . $after;
} else {
echo $before . '
' . esc_html($post_type->label) . '' . $after;
}
} elseif (is_attachment()) {
$depth = 2;
echo $before . '
' . esc_html(get_the_title()) . '' . $after;
} elseif (is_page() && !$post->post_parent) {
$depth = 2;
echo $before . '
' . esc_html(get_the_title()) . '' . $after;
} elseif (is_page() && $post->post_parent) {
$depth = 2;
$parent_id = $post->post_parent;
$breadcrumbs = array();
while ($parent_id) {
$current_page = get_post($parent_id);
$breadcrumbs[] = $current_page->ID;
$parent_id = $current_page->post_parent;
}
$breadcrumbs = array_reverse($breadcrumbs);
for ($i = 0; $i < count($breadcrumbs); $i++) {
echo '
' . esc_html(get_the_title($breadcrumbs[$i])) . '' . $delimiter . '';
$depth++;
}
echo $before . '
' . esc_html(get_the_title()) . '' . $after;
} elseif (is_404()) {
$depth = 2;
echo $before . '
' . esc_html__('404 Error - Page Not Found', 'rishi') . '' . $after;
}
if (get_query_var('paged')) printf(__(' (Page %s)', 'rishi'), get_query_var('paged')); ?>
'; ?>
'publish',
'posts_per_page' => $posts_per_page,
'post__not_in' => array($post->ID),
'orderby' => 'rand',
'ignore_sticky_posts' => true,
'post_type' => 'post',
);
if ($related_tax == 'cat') {
$cats = get_the_category($post->ID);
if ($cats) {
$c = array();
foreach ($cats as $cat) {
$c[] = $cat->term_id;
}
$args['category__in'] = $c;
}
} elseif ($related_tax == 'tag') {
$tags = get_the_tags($post->ID);
if ($tags) {
$t = array();
foreach ($tags as $tag) {
$t[] = $tag->term_id;
}
$args['tag__in'] = $t;
}
}
$qry = new WP_Query($args);
$meta_elements = get_theme_mod( 'related_post_meta_elements', rishi__cb__get_default_postmeta_structure() );
$meta_divider = get_theme_mod( 'related_post_meta_divider', 'slash' );
if ($qry->have_posts()) { ?>
>
have_posts()) {
$qry->the_post(); ?>
found_posts;
$visible_post = get_option('posts_per_page');
if ( $found_posts > 0) { ?>
$visible_post) {
printf(esc_html__('Showing %1$s of %2$s Results', 'rishi'), number_format_i18n($visible_post), number_format_i18n($found_posts));
} else {
/* translators: 1: found posts. */
printf(_nx('%s Result', '%s Results', $found_posts, 'found posts', 'rishi'), number_format_i18n($found_posts));
}
echo '';
}
}
endif;
if (!function_exists('rishi_get_image_sizes')) :
/**
* Get information about available image sizes
*/
function rishi_get_image_sizes($size = '')
{
global $_wp_additional_image_sizes;
$sizes = array();
$get_intermediate_image_sizes = get_intermediate_image_sizes();
// Create the full array with sizes and crop info
foreach ($get_intermediate_image_sizes as $_size) {
if (in_array($_size, array('thumbnail', 'medium', 'medium_large', 'large'))) {
$sizes[$_size]['width'] = get_option($_size . '_size_w');
$sizes[$_size]['height'] = get_option($_size . '_size_h');
$sizes[$_size]['crop'] = (bool) get_option($_size . '_crop');
} elseif (isset($_wp_additional_image_sizes[$_size])) {
$sizes[$_size] = array(
'width' => $_wp_additional_image_sizes[$_size]['width'],
'height' => $_wp_additional_image_sizes[$_size]['height'],
'crop' => $_wp_additional_image_sizes[$_size]['crop']
);
}
}
// Get only 1 size if found
if ($size) {
if (isset($sizes[$size])) {
return $sizes[$size];
} else {
return false;
}
}
return $sizes;
}
endif;
if (!function_exists('rishi_get_fallback_svg')) :
/**
* Get Fallback SVG
*/
function rishi_get_fallback_svg($post_thumbnail)
{
if (!$post_thumbnail) {
return;
}
$image_size = rishi_get_image_sizes($post_thumbnail);
if ($image_size) { ?>
maybe_get_sidebar_that_matches();
if ($maybe_sidebar) {
$home_multiple_sidebar = $maybe_sidebar;
}
}
$blog_sidebar = get_theme_mod('blog_sidebar_layout', $defaults['blog_sidebar_layout']);
if ($blog_sidebar == 'no-sidebar' || ($blog_sidebar == 'default-sidebar' && $layout == 'no-sidebar')) {
$return = $class ? 'full-width' : false; //Fullwidth
} elseif (is_active_sidebar($home_multiple_sidebar)) {
if ($blog_sidebar == 'right-sidebar' || ($blog_sidebar == 'default-sidebar' && $layout == 'right-sidebar')) $return = $class ? 'rightsidebar' : $home_multiple_sidebar;
if ($blog_sidebar == 'left-sidebar' || ($blog_sidebar == 'default-sidebar' && $layout == 'left-sidebar')) $return = $class ? 'leftsidebar' : $home_multiple_sidebar;
} else {
$return = $class ? 'full-width' : false; //Fullwidth
}
}
if( is_archive() ) {
$archive_multiple_sidebar = 'sidebar-1';
if (class_exists('RishiSidebarsManager')) {
$manager = new RishiSidebarsManager();
$maybe_sidebar = $manager->maybe_get_sidebar_that_matches();
if ($maybe_sidebar) {
$archive_multiple_sidebar = $maybe_sidebar;
}
}
if( is_author() ){
$archive_sidebar = get_theme_mod('author_sidebar_layout', $defaults['author_sidebar_layout']);
}else{
$archive_sidebar = get_theme_mod('archive_sidebar_layout', $defaults['archive_sidebar_layout']);
}
if ($archive_sidebar == 'no-sidebar' || ($archive_sidebar == 'default-sidebar' && $layout == 'no-sidebar')) {
$return = $class ? 'full-width' : false; //Fullwidth
} elseif (is_active_sidebar($archive_multiple_sidebar)) {
if ($archive_sidebar == 'right-sidebar' || ($archive_sidebar == 'default-sidebar' && $layout == 'right-sidebar')) $return = $class ? 'rightsidebar' : $archive_multiple_sidebar;
if ($archive_sidebar == 'left-sidebar' || ($archive_sidebar == 'default-sidebar' && $layout == 'left-sidebar')) $return = $class ? 'leftsidebar' : $archive_multiple_sidebar;
} else {
$return = $class ? 'full-width' : false; //Fullwidth
}
}
if( is_search()) {
$search_multiple_sidebar = 'sidebar-1';
if (class_exists('RishiSidebarsManager')) {
$manager = new RishiSidebarsManager();
$maybe_sidebar = $manager->maybe_get_sidebar_that_matches();
if ($maybe_sidebar) {
$search_multiple_sidebar = $maybe_sidebar;
}
}
$search_sidebar = get_theme_mod('search_sidebar_layout', $defaults['search_sidebar_layout']);
if ($search_sidebar == 'no-sidebar' || ($search_sidebar == 'default-sidebar' && $layout == 'no-sidebar')) {
$return = $class ? 'full-width' : false; //Fullwidth
} elseif (is_active_sidebar($search_multiple_sidebar)) {
if ($search_sidebar == 'right-sidebar' || ($search_sidebar == 'default-sidebar' && $layout == 'right-sidebar')) $return = $class ? 'rightsidebar' : $search_multiple_sidebar;
if ($search_sidebar == 'left-sidebar' || ($search_sidebar == 'default-sidebar' && $layout == 'left-sidebar')) $return = $class ? 'leftsidebar' : $search_multiple_sidebar;
} else {
$return = $class ? 'full-width' : false; //Fullwidth
}
}
if( rishi_is_woocommerce_activated() && ( is_shop() || is_product_category() || is_product_tag() || is_singular( 'product' ) ) ) {
$woo_multiple_sidebar = 'shop-sidebar';
if (class_exists('RishiSidebarsManager')) {
$manager = new RishiSidebarsManager();
$maybe_sidebar = $manager->maybe_get_sidebar_that_matches();
if ($maybe_sidebar) {
$woo_multiple_sidebar = $maybe_sidebar;
}
}
$woo_sidebar = get_theme_mod('woocommerce_sidebar_layout', $defaults['woocommerce_sidebar_layout']);
if ($woo_sidebar == 'no-sidebar' || ($woo_sidebar == 'default-sidebar' && $layout == 'no-sidebar')) {
$return = $class ? 'full-width' : false; //Fullwidth
}elseif (is_active_sidebar($woo_multiple_sidebar)) {
if ($woo_sidebar == 'right-sidebar' || ($woo_sidebar == 'default-sidebar' && $layout == 'right-sidebar')) $return = $class ? 'rightsidebar' : $woo_multiple_sidebar;
if ($woo_sidebar == 'left-sidebar' || ($woo_sidebar == 'default-sidebar' && $layout == 'left-sidebar')) $return = $class ? 'leftsidebar' : $woo_multiple_sidebar;
} else {
$return = $class ? 'full-width' : false; //Fullwidth
}
}
if(is_singular()) {
$page_layout = get_theme_mod('page_sidebar_layout', $defaults['page_sidebar_layout']); //Global Layout/Position for Pages
$post_layout = get_theme_mod('post_sidebar_layout', $defaults['post_sidebar_layout']); //Global Layout/Position for Posts
/**
* Individual post/page layout
*/
if (get_post_meta($post->ID, '_rishi_sidebar_layout', true)) {
$sidebar_layout = get_post_meta($post->ID, '_rishi_sidebar_layout', true);
} else {
$sidebar_layout = 'default-sidebar';
}
$sidebar_layout = rishi__cb_customizer_default_akg(
'page_structure_type',
rishi__cb_customizer_get_post_options($post->ID),
'default-sidebar'
);
/**
* Individual post/page sidebar
*/
$single_sidebar = 'sidebar-1';
if (class_exists('RishiSidebarsManager')) {
$manager = new RishiSidebarsManager();
$maybe_sidebar = $manager->maybe_get_sidebar_that_matches();
if ($maybe_sidebar) {
$single_sidebar = $maybe_sidebar;
}else{
$single_sidebar = rishi__cb_customizer_default_akg(
'single_multiple_sidebar',
rishi__cb_customizer_get_post_options($post->ID),
'sidebar-1'
);
}
}
if (is_page()) {
if ($sidebar_layout == 'no-sidebar' || ($sidebar_layout == 'default-sidebar' && $page_layout == 'no-sidebar')) {
$return = $class ? 'full-width' : false; //Fullwidth
}elseif( $sidebar_layout == 'centered' || ( $sidebar_layout == 'default-sidebar' && $page_layout == 'centered' ) ){
$return = $class ? 'full-width centered' : false;
} elseif (is_active_sidebar($single_sidebar)) {
if (($sidebar_layout == 'default-sidebar' && $page_layout == 'right-sidebar') || ($sidebar_layout == 'right-sidebar')) $return = $class ? 'rightsidebar' : $single_sidebar;
if (($sidebar_layout == 'default-sidebar' && $page_layout == 'left-sidebar') || ($sidebar_layout == 'left-sidebar')) $return = $class ? 'leftsidebar' : $single_sidebar;
} else {
$return = $class ? 'full-width' : false; //Fullwidth
}
}
if (is_single()) {
if ('product' === get_post_type()) { //For Product Post Type
$woo_single_sidebar = 'shop-sidebar';
if (class_exists('RishiSidebarsManager')) {
$manager = new RishiSidebarsManager();
$maybe_sidebar = $manager->maybe_get_sidebar_that_matches();
if ($maybe_sidebar) {
$woo_single_sidebar = $maybe_sidebar;
}
}
$woo_sidebar = get_theme_mod('woocommerce_sidebar_layout', $defaults['woocommerce_sidebar_layout']);
if ($woo_sidebar == 'no-sidebar' || ($woo_sidebar == 'default-sidebar' && $layout == 'no-sidebar')) {
$return = $class ? 'full-width' : false; //Fullwidth
}elseif (is_active_sidebar($woo_single_sidebar)) {
if ($woo_sidebar == 'right-sidebar' || ($woo_sidebar == 'default-sidebar' && $layout == 'right-sidebar')) $return = $class ? 'rightsidebar' : $woo_single_sidebar;
if ($woo_sidebar == 'left-sidebar' || ($woo_sidebar == 'default-sidebar' && $layout == 'left-sidebar')) $return = $class ? 'leftsidebar' : $woo_single_sidebar;
} else {
$return = $class ? 'full-width' : false; //Fullwidth
}
} elseif ('post' === get_post_type()) { //For default post type
if ($sidebar_layout == 'no-sidebar' || ($sidebar_layout == 'default-sidebar' && $post_layout == 'no-sidebar')) {
$return = $class ? 'full-width' : false; //Fullwidth
}elseif( $sidebar_layout == 'centered' || ( $sidebar_layout == 'default-sidebar' && $post_layout == 'centered' ) ){
$return = $class ? 'full-width centered' : false;
}elseif (is_active_sidebar( $single_sidebar )) {
if (($sidebar_layout == 'default-sidebar' && $post_layout == 'right-sidebar') || ($sidebar_layout == 'right-sidebar')) $return = $class ? 'rightsidebar' : $single_sidebar;
if (($sidebar_layout == 'default-sidebar' && $post_layout == 'left-sidebar') || ($sidebar_layout == 'left-sidebar')) $return = $class ? 'leftsidebar' : $single_sidebar;
} else {
$return = $class ? 'full-width' : false; //Fullwidth
}
} else { //Custom Post Type
if ($post_layout == 'no-sidebar') {
$return = $class ? 'full-width' : false; //Fullwidth
} elseif( $post_layout == 'centered' ){
$return = $class ? 'full-width centered' : false;
} elseif (is_active_sidebar('sidebar-1')) {
if ($post_layout == 'right-sidebar') $return = $class ? 'rightsidebar' : 'sidebar-1';
if ($post_layout == 'left-sidebar') $return = $class ? 'leftsidebar' : 'sidebar-1';
} else {
$return = $class ? 'full-width' : false; //Fullwidth
}
}
}
}
return $return;
}
endif;
/**
* Query WooCommerce activation
*/
function rishi_is_woocommerce_activated()
{
return class_exists('woocommerce') ? true : false;
}
/**
* Checks if classic editor is active or not
*/
function rishi_is_classic_editor_activated()
{
return class_exists('Classic_Editor') ? true : false;
}
/**
* Checks if classic editor is active or not
*/
function rishi_is_primary_menu_activated()
{
return has_nav_menu('menu-1') ? true : false;
}
if (! function_exists('rishi_frontend_deeplink_customizer_preview')) {
function rishi_frontend_deeplink_customizer_preview( $border_type, $location ) {
if( !is_customize_preview() ) return;
$data_deep_link = esc_attr( " data-shortcut=$border_type data-location=$location");
return $data_deep_link;
}
}
if (! function_exists('rishi__cb_customizer_get_woocommerce_ratio')) {
function rishi__cb_customizer_get_woocommerce_ratio() {
$cropping = get_theme_mod(
'rishi__cb_customizer_woocommerce_thumbnail_cropping',
'predefined'
);
if ($cropping === 'uncropped') {
return 'original';
}
if ($cropping === '1:1') {
return '1/1';
}
if ($cropping === 'custom' || $cropping === 'predefined') {
$width = get_option('woocommerce_thumbnail_cropping_custom_width', 4);
$height = get_option('woocommerce_thumbnail_cropping_custom_height', 3);
return $width . '/' . $height;
}
return '1/1';
}
}