false,
'mainbar_class' => 'col-md-12'
);
if ( ! empty( $layout ) ) {
/* Choose layout class */
switch ( $layout ) {
case 'full':
$mainbar = 'col-md-12';
$sidebar = false;
break;
case 'right':
$mainbar = 'col-md-9';
$sidebar = 'col-md-3';
break;
case 'left':
$mainbar = 'col-md-9 col-md-push-3';
$sidebar = 'sidebar-left col-md-3 col-md-pull-9';
break;
default:
$mainbar = 'col-md-12';
$sidebar = false;
break;
}
$data['sidebar_class'] = $sidebar;
$data['mainbar_class'] = $mainbar;
}
return apply_filters( 'mino_set_bar_class', $data );
}
}
/**
* Set custom mino pagination links
* @param array $args Arguments about pagination configurations
* @return -
*/
if ( ! function_exists( 'mino_paginate_links' ) ) {
function mino_paginate_links( $args ) {
global $wp_query, $wp_rewrite;
$max_pages = $wp_query->max_num_pages;
/* Custom WP_Query */
if ( isset( $args['used_query'] ) ) {
$max_pages = $args['used_query']->max_num_pages;
}
if ( $max_pages < 2 ) {
return;
}
/**
* Get current URI page
*/
if ( get_query_var( 'paged' ) ) {
$paged = get_query_var( 'paged' );
} elseif ( get_query_var( 'page' ) ) {
$paged = get_query_var( 'page' );
} else {
$paged = 1;
}
$big = 999999999; // need an unlikely integer
$paginate_link_data = apply_filters( 'mino_set_paginate_link', array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, $paged ),
'total' => $max_pages,
'type' => 'array',
'prev_text' => ' ',
'next_text' => ' ',
) );
$paginate_links = paginate_links( $paginate_link_data );
$paginate = $next_prev = null;
foreach ( $paginate_links as $links => $value ) {
$next_prev_a = null;
/* Current number */
if ( strpos( $value, 'current' ) ) {
$value = str_replace( 'span', 'a', $value );
}
/* Next Prev */
if ( strpos( $value, 'prev' ) || strpos( $value, 'next' ) ) {
$next_prev_a = $value;
$value = null;
}
$paginate .= ( ! empty( $value ) ) ? '
' . $value . ' ' : null;
$next_prev .= $next_prev_a;
}
$output = '' . $next_prev . ' ';
echo apply_filters( 'mino_paginate_output', $output );
}
}
/**
* Custom category list
* @param int $id Post ID
* @return -
*/
if ( ! function_exists( 'mino_category_list' ) ) {
function mino_category_list( $id, $pre_text = '' ) {
if ( $pre_text == '' ) {
$pre_text = __( 'Posted in', 'mino' );
}
$categories = get_the_category( $id );
if ( ! empty( $categories ) ) {
echo $pre_text . ' ' . get_the_category_list( ', ' );
}
}
}
/**
* Custom tag list
* @param int $id Post ID
* @return -
*/
if ( ! function_exists( 'mino_tag_list' ) ) {
function mino_tag_list( $id = false ) {
$tags = get_the_tags( $id );
$tag_list = null;
if ( ! empty( $tags ) ) {
foreach ( $tags as $tag ) {
$tag_list .= '' . $tag->name . ' ';
}
echo '' . $tag_list . ' ';
}
}
}
/**
* Mino_Walker_Comment
* Extended Walker_Comment class
*
* @package Mino
* @since Mino 1.0.1
*/
/**
* HTML comment custom list class and layouts
*
* @uses Walker_Comment
* @since 4.1
*/
class Mino_Walker_Comment extends Walker_Comment {
var $tree_type = 'comment';
var $db_fields = array( 'parent' => 'comment_parent', 'id' => 'comment_ID' );
function __construct() {
/* Empty consctruct */
}
/* Start Comment List for children list */
function start_lvl( &$output, $depth = 0, $args = array() ) {
$GLOBALS['comment_depth'] = $depth + 1;
echo '';
}
/* End Comment List for children list comments */
function end_lvl( &$output, $depth = 0, $args = array() ) {
$GLOBALS['comment_depth'] = $depth + 1;
echo ' ';
}
/* Start Comment List */
function start_el( &$output, $comment, $depth = 0, $args = array(), $id = 0 ) {
$depth++;
$GLOBALS['comment_depth'] = $depth;
$GLOBALS['comment'] = $comment;
$parent_class = ( empty( $args['has_children'] ) ? '' : 'parent' ); ?>
id="comment-">
__( 'year', 'mino' ),
'm' => __( 'month', 'mino' ),
'd' => __( 'day', 'mino' ),
'h' => __( 'hour', 'mino' ),
'i' => __( 'minute', 'mino' )
);
$diff = date_diff( $comment_time, $current_time );
foreach ( $diff as $key => $value ) {
if ( $value != 0 ) {
if ( $key == 's' ) {
echo __( 'Just now', 'mino' );
return false;
}
$format = $time_format[$key];
$format = ( $value > 1 ) ? $format . 's' : $format;
echo sprintf( __( '%1$s %2$s ago', 'mino' ), $value, $format );
return false;
}
}
}
/** DESTRUCTOR
* I'm just using this since we needed to use the constructor to reach the top
* of the comments list, just seems to balance out nicely:) */
function __destruct() {
echo '';
}
}
/**
* Dimox Breadcrumbs
* @see http://dimox.net/wordpress-breadcrumbs-without-a-plugin/
* @since 1.0
*
* Add this to any template file by calling mino_dimox_breadcrumbs()
*
* Changes:
* - MC added taxonomy support
* - Add settings to check the breadcrumb is enabled or not
* - Replace get_query_var( 'cat' ) with get_queried_object_id()
*/
if ( ! function_exists( 'mino_dimox_breadcrumbs' ) ) {
function mino_dimox_breadcrumbs(){
$enable_breadcrumb = get_theme_mod( 'mino_breadcrumb_customizer_set', 'all' );
if ( (array) $enable_breadcrumb == $enable_breadcrumb ) {
/* Check one by one */
if ( is_single() ) {
if ( ! in_array( 'post', $enable_breadcrumb ) ) {
return;
}
} elseif ( is_page() ) {
if ( ! in_array( 'page', $enable_breadcrumb ) ) {
return;
}
} elseif ( is_attachment() ) {
if ( ! in_array( 'attachment', $enable_breadcrumb ) ) {
return;
}
} elseif ( is_search() ) {
if ( ! in_array( 'search', $enable_breadcrumb ) ) {
return;
}
} elseif ( is_category() ) {
if ( ! in_array( 'category', $enable_breadcrumb ) ) {
return;
}
} elseif ( is_author() ) {
if ( ! in_array( 'author', $enable_breadcrumb ) ) {
return;
}
} elseif ( is_archive() ) {
if ( ! in_array( 'archive', $enable_breadcrumb ) ) {
return;
}
}
}
/* === OPTIONS === */
$text['home'] = __( 'Home', 'mino' ); // text for the 'Home' link
$text['category'] = __( 'Archive by Category "%s"', 'mino' ); // text for a category page
$text['tax'] = __( 'Archive for "%s"', 'mino' ); // text for a taxonomy page
$text['search'] = __( 'Search Results for "%s" Query', 'mino' ); // text for a search results page
$text['tag'] = __( 'Posts Tagged "%s"', 'mino' ); // text for a tag page
$text['author'] = __( 'Articles Posted by %s', 'mino' ); // text for an author page
$text['404'] = __( 'Error 404', 'mino' ); // text for the 404 page
$showCurrent = 1; // 1 - show current post/page title in breadcrumbs, 0 - don't show
$showOnHome = 0; // 1 - show breadcrumbs on the homepage, 0 - don't show
$delimiter = ''; // delimiter between crumbs
$before = ''; // tag before the current crumb
$after = ' '; // tag after the current crumb
/* === END OF OPTIONS === */
global $post;
$output = '';
$homeLink = esc_url( home_url() );
$linkBefore = '';
$linkAfter = ' ';
$linkAttr = ' rel="v:url" property="v:title"';
$link = $linkBefore . '%2$s ' . $linkAfter;
if (is_home() || is_front_page()) {
if ($showOnHome == 1) $output .= '' . $text['home'] . ' ';
} else {
$output .= '' . sprintf($link, $homeLink, $text['home']) . $delimiter;
if ( is_category() ) {
$thisCat = get_category( get_queried_object_id(), false);
if ($thisCat->parent != 0) {
$cats = get_category_parents($thisCat->parent, TRUE, $delimiter);
$cats = str_replace('', ' ' . $linkAfter, $cats);
$output .= $cats;
}
$output .= $before . sprintf($text['category'], single_cat_title('', false)) . $after;
} elseif( is_tax() ){
$thisCat = get_category( get_queried_object_id(), false);
if ($thisCat->parent != 0) {
$cats = get_category_parents($thisCat->parent, TRUE, $delimiter);
$cats = str_replace('', ' ' . $linkAfter, $cats);
$output .= $cats;
}
$output .= $before . sprintf($text['tax'], single_cat_title('', false)) . $after;
}elseif ( is_search() ) {
$output .= $before . sprintf($text['search'], get_search_query()) . $after;
} elseif ( is_day() ) {
$output .= sprintf($link, get_year_link(get_the_time('Y')), get_the_time('Y')) . $delimiter;
$output .= sprintf($link, get_month_link(get_the_time('Y'),get_the_time('m')), get_the_time('F')) . $delimiter;
$output .= $before . get_the_time('d') . $after;
} elseif ( is_month() ) {
$output .= sprintf($link, get_year_link(get_the_time('Y')), get_the_time('Y')) . $delimiter;
$output .= $before . get_the_time('F') . $after;
} elseif ( is_year() ) {
$output .= $before . get_the_time('Y') . $after;
} elseif ( is_single() && !is_attachment() ) {
if ( get_post_type() != 'post' ) {
$post_type = get_post_type_object(get_post_type());
$slug = $post_type->rewrite;
$output .= sprintf($link, $homeLink . '/' . $slug['slug'] . '/', $post_type->labels->singular_name);
if ($showCurrent == 1) $output .= $delimiter . $before . get_the_title() . $after;
} else {
$cat = get_the_category();
if ( ! empty( $cat ) ) {
$cat = $cat[0];
$cats = get_category_parents($cat, TRUE, $delimiter);
if ($showCurrent == 0) $cats = preg_replace("#^(.+)$delimiter$#", "$1", $cats);
$cats = str_replace('', ' ' . $linkAfter, $cats);
$output .= $cats;
}
if ($showCurrent == 1) $output .= $before . get_the_title() . $after;
}
} elseif ( !is_single() && !is_page() && get_post_type() != 'post' && !is_404() ) {
$post_type = get_post_type_object(get_post_type());
$output .= $before . $post_type->labels->singular_name . $after;
} elseif ( is_attachment() ) {
$parent = get_post($post->post_parent);
$cat = get_the_category($parent->ID); $cat = $cat[0];
$cats = get_category_parents($cat, TRUE, $delimiter);
$cats = str_replace('', ' ' . $linkAfter, $cats);
$output .= $cats;
printf($link, esc_url( get_permalink($parent) ), $parent->post_title);
if ($showCurrent == 1) $output .= $delimiter . $before . get_the_title() . $after;
} elseif ( is_page() && !$post->post_parent ) {
if ($showCurrent == 1) $output .= $before . get_the_title() . $after;
} elseif ( is_page() && $post->post_parent ) {
$parent_id = $post->post_parent;
$breadcrumbs = array();
while ($parent_id) {
$page = get_page($parent_id);
$breadcrumbs[] = sprintf($link, esc_url( get_permalink($page->ID) ), get_the_title($page->ID));
$parent_id = $page->post_parent;
}
$breadcrumbs = array_reverse($breadcrumbs);
for ($i = 0; $i < count($breadcrumbs); $i++) {
$output .= $breadcrumbs[$i];
if ($i != count($breadcrumbs)-1) $output .= $delimiter;
}
if ($showCurrent == 1) $output .= $delimiter . $before . get_the_title() . $after;
} elseif ( is_tag() ) {
$output .= $before . sprintf($text['tag'], single_tag_title('', false)) . $after;
} elseif ( is_author() ) {
global $author;
$userdata = get_userdata($author);
$output .= $before . sprintf($text['author'], $userdata->display_name) . $after;
} elseif ( is_404() ) {
$output .= $before . $text['404'] . $after;
}
/**
* Get current URI page
*/
if ( get_query_var('paged') ) {
if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) $output .= ' (';
$output .= '' . __( 'Page', 'mino' ) . ' ' . get_query_var('paged') . ' ';
if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) $output .= ')';
}
$output .= ' ';
echo apply_filters( 'mino_breadcrumb_output', $output );
}
} // end mino_dimox_breadcrumbs()
}
if ( ! function_exists( 'mino_wc_dimox_breadcrumbs' ) ) {
/**
* Set breadscrumb for Woocommerce
* @return -
*/
function mino_wc_dimox_breadcrumbs() {
echo '';
mino_dimox_breadcrumbs();
echo '
';
}
}
/**
* Mino set breadcrumb list
* @return array Breadcrumb location list
*/
if ( ! function_exists( 'mino_breadcrumb_list' ) ) {
function mino_breadcrumb_list( $key = false ) {
/* Set Data */
$types = apply_filters( 'mino_set_breadcrumb_area', array(
'post' => 'Post',
'page' => 'Page',
'attachment' => 'Attachment',
'archive' => 'Archive',
'tags' => 'Tags',
'category' => 'Category',
'search' => 'Search',
'author' => 'Author',
));
if ( $key ) {
$types = apply_filters( 'mino_set_breadcrumb_area', array(
0 => 'post',
1 => 'page',
2 => 'attachment',
3 => 'archive',
4 => 'tags',
5 => 'category',
6 => 'search',
7 => 'author',
));
}
return $types;
}
}
if ( ! function_exists( 'mino_generate_select' ) ) {
function mino_generate_select( $name = false, $data = false, $selected = '', $attr = '' ) {
if ( $name == false || $name == null ) {
return 'Set name for select.';
}
if ( ! empty( $data ) ) {
$select = '';
foreach ( $data as $value => $label ) {
$select_tag = null;
if ( $value == $selected ) {
$select_tag = 'selected="selected"';
}
$select .= '' . $label . ' ';
}
$select .= ' ';
} else {
$select = apply_filters( 'mino_generate_select_empty', __( 'No data found.', 'mino' ) );
}
return $select;
}
}
if ( ! function_exists( 'mino_get_themes_color' ) ) {
function mino_get_themes_color( $for_image = false ) {
/* Skin styles */
$theme_skin = 'black';
if ( get_theme_mod( 'mino_theme_color_customizer_set' ) == true ) {
$theme_skin = get_theme_mod( 'mino_theme_color_customizer_set' );
}
if ( $for_image == true ) {
$theme_skin .= '/';
if ( $theme_skin == 'black/' || $theme_skin == 'blue/' ) {
$theme_skin = '';
}
}
return $theme_skin;
}
}
/**
* Woocommerce filter part
*/
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
if ( ! function_exists( 'mino_check_woocommerce_class' ) ) {
function mino_check_woocommerce_class() {
$add_class = '';
$classes = get_body_class();
$data = apply_filters( 'mino_condition_page_templates', array(
'page-templates/blog-homepage.php',
'page-templates/shop-homepage.php'
));
$id = get_the_ID();
$page_template = get_post_meta( $id, '_wp_page_template', true );
if ( ! in_array( 'woocommerce', $classes ) && ! is_woocommerce() && ! is_cart() && ! is_checkout() && in_array( $page_template, $data ) ) {
$add_class = 'woocommerce shop-home';
}
return apply_filters( 'mino_set_woocommerce_page_templates_class', $add_class );
}
}
if ( ! function_exists( 'mino_woocommerce_logout' ) ) {
function mino_woocommerce_logout() {
$myaccount_page_id = get_option( 'woocommerce_myaccount_page_id' );
$logout_url = '#';
if ( $myaccount_page_id ) {
$logout_url = wp_logout_url( esc_url( get_permalink( $myaccount_page_id ) ) );
if ( get_option( 'woocommerce_force_ssl_checkout' ) == 'yes' ) {
$logout_url = str_replace( 'http:', 'https:', $logout_url );
}
}
return $logout_url;
}
}
}