Ejemplo n.º 1
0
 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;
     }
 }
Ejemplo n.º 2
0
 /**
  * This function creates the html code necessary for a dynamic heading line. 
  *
  * @param array $element is an array with all the data necessary for creating the html code (it contains the element data and the saved values for the element)
  * @return string $output the string returned contains the html code generated within the method
  */
 function heading($element)
 {
     if (!isset($element['saved_value'][0])) {
         return;
     }
     extract($element['saved_value'][0]);
     $output = $titleClass = "";
     switch ($dynamic_heading_type) {
         case 'self':
             $heading = get_the_title(avia_get_the_ID());
             break;
         case 'custom':
             $heading = $dynamic_heading_custom;
             break;
     }
     if ($heading) {
         $output .= "<div class='title_container {$titleClass}'>";
         if ($dynamic_heading_bc == 'yes' && !is_front_page()) {
             $output .= avia_breadcrumbs();
         }
         $output .= "<h1>" . $heading . "</h1>";
         if ($dynamic_heading_custom_sub) {
             $output .= wpautop($dynamic_heading_custom_sub);
         }
         $output .= "</div>";
     }
     return $output;
 }
Ejemplo n.º 3
0
function avia_title($post = "", $_product = "", $title = "")
{
    if (!$_product) {
        global $product;
        $_product = $product;
    }
    if (!$title) {
        $title = get_the_title();
    }
    echo "<div class='title_container'>";
    if (!is_front_page()) {
        echo avia_breadcrumbs();
    }
    echo '<h1 class="page-title">' . $title . '</h1>';
    if ($_product && is_singular()) {
        echo '<span class="amount" style="color: #662D91; font-size: 20px;">' . $_product->get_sku() . '</span>';
        echo "<div class='price_container'>";
        woocommerce_template_single_price($post, $_product);
        echo "</div>";
    }
    echo "</div>";
}
Ejemplo n.º 4
0
function avia_woocommerce_advanced_title()
{
    global $wp_query;
    $titleClass = "";
    $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']);
        $attachment_id = get_woocommerce_term_meta($term->term_id, 'thumbnail_id');
        if (!empty($term->description)) {
            $titleClass .= "title_container_description ";
        }
    }
    if (!empty($attachment_id)) {
        $titleClass .= "title_container_image ";
        $image = wp_get_attachment_image($attachment_id, 'thumbnail', false, array('class' => 'category_thumb'));
    }
    echo "<div class='title_container {$titleClass}'>";
    echo avia_breadcrumbs();
    woocommerce_catalog_ordering();
    echo $image;
}
Ejemplo n.º 5
0
function avia_title($post = "", $_product = "", $title = "")
{
    if (!$_product) {
        global $product;
        $_product = $product;
    }
    if (!$title) {
        $title = get_the_title();
    }
    echo "<div class='title_container'>";
    if (!is_front_page()) {
        echo avia_breadcrumbs();
    }
    echo '<h1 class="page-title">' . $title . '</h1>';
    if ($_product && is_singular()) {
        echo "<div class='price_container'>";
        woocommerce_template_single_price($post, $_product);
        echo "</div>";
    }
    echo "</div>";
}