'primary_nav', 'container' => false, 'menu_class' => $class, 'walker' => new aleanta_Walker_Menu(), )); } } function aleanta_no_notice($var) { if (isset($var) && $var != '') return 1; else return 0; } function aleanta_show_breadcrumbs(){ if ( class_exists( 'WooCommerce' ) && !is_page_template( 'page-home.php' )) { woocommerce_breadcrumb(); } elseif ( function_exists( 'aleanta_breadcrumbs' ) && !is_page_template( 'page-home.php' ) ){ aleanta_breadcrumbs(); } } // numbered pagination function aleanta_num_pagination( $pages = '', $range = 2 ) { $showitems = ( $range * 2 ) + 1; global $paged; if ( empty( $paged ) ) { $paged = 1; } if ( $pages == '' ) { global $wp_query; $pages = $wp_query->max_num_pages; if ( ! $pages ) { $pages = 1; } } if ( 1 != $pages ) { echo wp_kses_post('
'); } } function aleanta_wp_get_attachment( $attachment_id ) { $attachment = get_post( $attachment_id ); return array( 'alt' => is_object($attachment) ? get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ) : '', 'caption' => is_object($attachment) ? $attachment->post_excerpt : '', 'description' => is_object($attachment) ? $attachment->post_content : '', 'href' => is_object($attachment) ? get_permalink( $attachment->ID ) : '', 'src' => is_object($attachment) ? $attachment->guid : '', 'title' => is_object($attachment) ? $attachment->post_title : '' ); } function aleanta_post_read_more(){ $btn_name = aleanta_get_option('blog_settings_readmore'); $name = ($btn_name) ? $btn_name : esc_html__('Read More','aleanta'); return esc_attr($name); } function aleanta_show_sidebar($type, $layout, $sidebar, $is_woo = 0) { $layouts = array( 1 => 'full', 2 => 'right', 3 => 'left', ); $sticky_bar = aleanta_get_option('blog_settings_sidebar', 'on') == 'on' && !$is_woo ? 'sticky-bar' : ''; if ( isset($layouts[$layout]) && $type === $layouts[$layout] ) { echo '
'; } else { echo ''; } } function aleanta_limit_words($string, $word_limit) { if($word_limit > 0) { $words = explode(' ', $string); if ($string == "") return ''; else return implode(' ', array_slice($words, 0, $word_limit)) . '...'; } else { return $string; } } function aleanta_get_post_terms( $args = array() ) { $html = ''; $defaults = array( 'post_id' => get_the_ID(), 'taxonomy' => 'category', 'text' => '%s', 'before' => '', 'after' => '', 'items_wrap' => '%s', 'sep' => _x( ', ', 'taxonomy terms separator', 'aleanta' ) ); $args = wp_parse_args( $args, $defaults ); $terms = get_the_term_list( $args['post_id'], $args['taxonomy'], '', $args['sep'], '' ); if ( !empty( $terms ) ) { $html .= $args['before']; $html .= sprintf( $args['items_wrap'], sprintf( $args['text'], $terms ) ); $html .= $args['after']; } return $html; } function aleanta_hex2rgb($hex) { $hex = str_replace("#", "", $hex); if(strlen($hex) == 3) { $r = hexdec(substr($hex,0,1).substr($hex,0,1)); $g = hexdec(substr($hex,1,1).substr($hex,1,1)); $b = hexdec(substr($hex,2,1).substr($hex,2,1)); } else { $r = hexdec(substr($hex,0,2)); $g = hexdec(substr($hex,2,2)); $b = hexdec(substr($hex,4,2)); } $rgb = array($r, $g, $b); //return $rgb; // returns an array with the rgb values return implode(",", $rgb); // returns the rgb values separated by commas } function aleanta_breadcrumbs() { /* === Options === */ $text['home'] = wp_kses_post(__('', 'aleanta')); $text['category'] = esc_html__('Archive "%s"', 'aleanta'); $text['search'] = esc_html__('Search results for "%s"', 'aleanta'); $text['tag'] = esc_html__('Posts with tag "%s"', 'aleanta'); $text['author'] = esc_html__('%s posts', 'aleanta'); $text['404'] = esc_html__('Error 404', 'aleanta'); $text['page'] = esc_html__('Page %s', 'aleanta'); $text['cpage'] = esc_html__('Comments page %s', 'aleanta'); $delimiter = '  |  '; $delim_before = '';//''; $delim_after = '';//''; $show_home_link = 1; $show_on_home = 0; $show_title = 1; $show_current = 1; $before = ''; $after = ''; /* === End options === */ global $post; $home_link = esc_url(home_url('/')); $link_before = ''; $link_after = ''; $link_attr = ''; $link_in_before = ''; $link_in_after = ''; $link = $link_before . '' . $link_in_before . '%2$s' . $link_in_after . '' . $link_after; $frontpage_id = get_option('page_on_front'); $parent_id = isset($post) ? $post->post_parent : ''; $delimiter = '  |  ';// . $delim_before . $delimiter . $delim_after . ' '; if (is_home() || is_front_page()) { if ($show_on_home == 1) echo ''; } else { echo ''; } } // end aleanta_breadcrumbs() // Show admin notice if ( !function_exists( 'pix_admin_notice' ) ) { function pix_admin_notice() { add_option('pix_admin_notice', '1'); $screen = get_current_screen(); if ( $screen->id != 'appearance_page_adminpanel' ) { if ( get_option('pix_admin_notice') ) { echo "

" . esc_html__("Welcome to aleanta", "aleanta") . "

" . esc_html__("Thank you very much for purchasing our theme. Please check theme info center . ", "aleanta") . "

" . esc_html__("Read more", "aleanta") . " " . esc_html__("Hide notice", "aleanta") . "

"; } } } } if (current_user_can('switch_themes')) { add_action('admin_notices', 'pix_admin_notice', 2); } // Hide admin notice if ( !function_exists( 'pix_callback_hide_admin_notice' ) ) { function pix_callback_hide_admin_notice() { update_option('pix_admin_notice', '0'); exit; } } add_action('wp_ajax_pix_hide_admin_notice', 'pix_callback_hide_admin_notice'); // Update admin notice status if ( !function_exists( 'pix_admin_notice_update' ) ) { function pix_admin_notice_update() { update_option('pix_admin_notice', '1'); } } add_action('after_switch_theme', 'pix_admin_notice_update');