function avia_woocommerce_overview_banner_image() { global $avia_config; if (avia_is_dynamic_template() || is_paged() || is_search()) { return false; } $image_size = "entry_with_sidebar"; $layout = avia_layout_class('main', false); if ($layout == 'fullsize') { $image_size = 'entry_without_sidebar'; } if (is_shop()) { $shop_id = woocommerce_get_page_id('shop'); if ($shop_id != -1) { $image = get_the_post_thumbnail($shop_id, $image_size); if ($image) { echo "<div class='page-thumb'>{$image}</div>"; } } } if (is_product_category()) { global $wp_query; $image = ""; if (isset($wp_query->query_vars['taxonomy'])) { $term = get_term_by('slug', get_query_var($wp_query->query_vars['taxonomy']), $wp_query->query_vars['taxonomy']); if (!empty($term->term_id)) { $attachment_id = get_woocommerce_term_meta($term->term_id, 'thumbnail_id'); if (!empty($attachment_id)) { $image = wp_get_attachment_image($attachment_id, $image_size, false, array('class' => 'category_thumb')); if ($image) { echo "<div class='page-thumb'>{$image}</div>"; } } } } } }
function avia_backend_admin_bar_menu() { if (!current_user_can('manage_options')) { return; } global $avia, $wp_admin_bar; $real_id = is_admin() ? false : avia_get_the_ID(); //home edit button for frontpage if (is_front_page()) { $front_id = avia_get_option('frontpage'); $parent = ""; if ($front_id && $real_id == $front_id) { $menu = array('id' => 'edit', 'title' => __('Edit Frontpage', 'avia_framework'), 'href' => admin_url('post.php?post=' . $real_id . '&action=edit'), 'meta' => array('target' => 'blank')); $wp_admin_bar->add_menu($menu); } } //dynamic tempalte edit for current entry, in case a dynamic tempalte is applied if ($real_id && ($template = avia_is_dynamic_template())) { $safeSlug = avia_backend_safe_string($template); $menu = array('id' => 'avia_edit', 'title' => __('Edit this entry', 'avia_framework'), 'href' => admin_url('post.php?post=' . $real_id . '&action=edit'), 'meta' => array('target' => 'blank'), 'parent' => 'edit'); $wp_admin_bar->add_menu($menu); $menu = array('id' => 'avia_edit_dynamic', 'title' => __('Edit Dynamic Template of this entry', 'avia_framework'), 'href' => admin_url("admin.php?page=templates#goto_" . $safeSlug), 'meta' => array('target' => 'blank'), 'parent' => 'edit'); $wp_admin_bar->add_menu($menu); } // add all option pages if (empty($avia->option_pages)) { return; } $urlBase = admin_url('admin.php'); foreach ($avia->option_pages as $avia_page) { $safeSlug = avia_backend_safe_string($avia_page['title']); $menu = array('id' => $avia_page['slug'], 'title' => strip_tags($avia_page['title']), 'href' => $urlBase . "?page=" . $avia_page['slug'], 'meta' => array('target' => 'blank')); if ($avia_page['slug'] != $avia_page['parent']) { $menu['parent'] = $avia_page['parent']; $menu['href'] = $urlBase . "?page=" . $avia_page['parent'] . "#goto_" . $avia_page['slug']; } if (is_admin()) { $menu['meta'] = array('onclick' => 'self.location.replace(encodeURI("' . $menu['href'] . '")); window.location.reload(true); '); } $wp_admin_bar->add_menu($menu); } }
function avia_title($args = false, $id = false) { global $avia_config; if (!$id) { $id = avia_get_the_id(); } $header_settings = avia_header_setting(); if ($header_settings['header_title_bar'] == 'hidden_title_bar') { return ""; } $defaults = array('title' => get_the_title($id), 'subtitle' => "", 'link' => get_permalink($id), 'html' => "<div class='{class} title_container'><div class='container'><{heading} class='main-title entry-title'>{title}</{heading}>{additions}</div></div>", 'class' => 'stretch_full container_wrap alternate_color ' . avia_is_dark_bg('alternate_color', true), 'breadcrumb' => true, 'additions' => "", 'heading' => 'h1'); if (is_tax() || is_category() || is_tag()) { global $wp_query; $term = $wp_query->get_queried_object(); $defaults['link'] = get_term_link($term); } else { if (is_archive()) { $defaults['link'] = ""; } } // Parse incomming $args into an array and merge it with $defaults $args = wp_parse_args($args, $defaults); $args = apply_filters('avf_title_args', $args, $id); //disable breadcrumb if requested if ($header_settings['header_title_bar'] == 'title_bar') { $args['breadcrumb'] = false; } //disable title if requested if ($header_settings['header_title_bar'] == 'breadcrumbs_only') { $args['title'] = ''; } // OPTIONAL: Declare each item in $args as its own variable i.e. $type, $before. extract($args, EXTR_SKIP); if (empty($title)) { $class .= " empty_title "; } $markup = avia_markup_helper(array('context' => 'avia_title', 'echo' => false)); if (!empty($link) && !empty($title)) { $title = "<a href='" . $link . "' rel='bookmark' title='" . __('Permanent Link:', 'avia_framework') . " " . esc_attr($title) . "' {$markup}>" . $title . "</a>"; } if (!empty($subtitle)) { $additions .= "<div class='title_meta meta-color'>" . wpautop($subtitle) . "</div>"; } if ($breadcrumb) { $additions .= avia_breadcrumbs(array('separator' => '/', 'richsnippet' => true)); } $html = str_replace('{class}', $class, $html); $html = str_replace('{title}', $title, $html); $html = str_replace('{additions}', $additions, $html); $html = str_replace('{heading}', $heading, $html); if (!empty($avia_config['slide_output']) && !avia_is_dynamic_template($id) && !avia_is_overview()) { $avia_config['small_title'] = $title; } else { return $html; } }
function avia_special_dynamic_template($id = false) { $return = false; if (!$id) { $id = avia_get_the_ID(); } if (!$id) { return $return; } $post_type = avia_template_helper_get_layout_string(); if (avia_is_dynamic_template($id) && (avia_post_meta($id, $post_type) == 'dynamic' || 'portfolio' == get_post_type())) { $return = true; } return $return; }