/**
  * This function checks if the page we are going to render is using a dynamic template
  *
  * @return bool $result true or false
  */
 function avia_is_dynamic_template($id = false, $dependency = false)
 {
     $result = false;
     if (!$id) {
         $id = avia_get_the_ID();
     }
     if (!$id) {
         return $result;
     }
     if ($dependency) {
         if (avia_post_meta($id, $dependency[0]) != $dependency[1]) {
             return false;
         }
     }
     if ($template = avia_post_meta($id, 'dynamic_templates')) {
         $result = $template;
     }
     return $result;
 }
 function widget($args, $instance)
 {
     global $avia_config;
     extract($args, EXTR_SKIP);
     echo $before_widget;
     $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
     $count = empty($instance['count']) ? '' : $instance['count'];
     $cat = empty($instance['cat']) ? '' : $instance['cat'];
     $excerpt = empty($instance['excerpt']) ? '' : $instance['excerpt'];
     $image_size = isset($avia_config['widget_image_size']) ? $avia_config['widget_image_size'] : 'widget';
     if (!empty($title)) {
         echo $before_title . $title . $after_title;
     }
     if (empty($this->avia_term)) {
         $additional_loop = new WP_Query("cat=" . $cat . "&posts_per_page=" . $count);
     } else {
         $catarray = explode(',', $cat);
         if (empty($catarray[0])) {
             $new_query = array("posts_per_page" => $count, "post_type" => $this->avia_post_type);
         } else {
             if ($this->avia_new_query) {
                 $new_query = $this->avia_new_query;
             } else {
                 $new_query = array("posts_per_page" => $count, 'tax_query' => array(array('taxonomy' => $this->avia_term, 'field' => 'id', 'terms' => explode(',', $cat), 'operator' => 'IN')));
             }
         }
         $additional_loop = new WP_Query($new_query);
     }
     if ($additional_loop->have_posts()) {
         echo '<ul class="news-wrap image_size_' . $image_size . '">';
         while ($additional_loop->have_posts()) {
             $additional_loop->the_post();
             $format = "";
             if (empty($this->avia_post_type)) {
                 $format = $this->avia_post_type;
             }
             if (empty($format)) {
                 $format = get_post_format();
             }
             if (empty($format)) {
                 $format = 'standard';
             }
             $the_id = get_the_ID();
             $link = get_post_meta($the_id, '_portfolio_custom_link', true) != "" ? get_post_meta($the_id, '_portfolio_custom_link_url', true) : get_permalink();
             echo '<li class="news-content post-format-' . $format . '">';
             //check for preview images:
             $image = "";
             if (!current_theme_supports('force-post-thumbnails-in-widget')) {
                 $slides = avia_post_meta(get_the_ID(), 'slideshow', true);
                 if ($slides != "" && !empty($slides[0]['slideshow_image'])) {
                     $image = avia_image_by_id($slides[0]['slideshow_image'], $image_size, 'image');
                 }
             }
             if (current_theme_supports('post-thumbnails') && !$image) {
                 $image = get_the_post_thumbnail($the_id, $image_size);
             }
             $time_format = apply_filters('avia_widget_time', get_option('date_format') . " - " . get_option('time_format'), 'avia_newsbox');
             echo "<a class='news-link' title='" . get_the_title() . "' href='" . $link . "'>";
             $nothumb = !$image ? 'no-news-thumb' : '';
             echo "<span class='news-thumb {$nothumb}'>";
             echo $image;
             echo "</span>";
             if (empty($avia_config['widget_image_size']) || 'display title and excerpt' != $excerpt) {
                 echo "<strong class='news-headline'>" . get_the_title();
                 if ($time_format) {
                     echo "<span class='news-time'>" . get_the_time($time_format) . "</span>";
                 }
                 echo "</strong>";
             }
             echo "</a>";
             if ('display title and excerpt' == $excerpt) {
                 echo "<div class='news-excerpt'>";
                 if (!empty($avia_config['widget_image_size'])) {
                     echo "<a class='news-link-inner' title='" . get_the_title() . "' href='" . $link . "'>";
                     echo "<strong class='news-headline'>" . get_the_title() . "</strong>";
                     echo "</a>";
                     if ($time_format) {
                         echo "<span class='news-time'>" . get_the_time($time_format) . "</span>";
                     }
                 }
                 the_excerpt();
                 echo "</div>";
             }
             echo '</li>';
         }
         echo "</ul>";
         wp_reset_postdata();
     }
     echo $after_widget;
 }
Exemple #3
0
function avia_woocommerce_before_main_content()
{
    global $avia_config;
    if (!isset($avia_config['shop_overview_column'])) {
        $avia_config['shop_overview_column'] = "auto";
    }
    if ($new = avia_post_meta(get_option('woocommerce_shop_page_id'), 'layout')) {
        //split up result
        $results = explode(' : ', $new);
        foreach ($results as $result) {
            $result = explode('|', $result);
            $avia_config[$result[0]] = $result[1];
        }
        $avia_config['layout'] = apply_filters('avia_layout_filter', $avia_config['layout']);
    }
    $title_args = array();
    if (is_woocommerce()) {
        $t_link = "";
        if (is_shop()) {
            $title = get_option('woocommerce_shop_page_title');
        }
        $shop_id = woocommerce_get_page_id('shop');
        if ($shop_id && $shop_id != -1) {
            if (empty($title)) {
                $title = get_the_title($shop_id);
            }
            $t_link = get_permalink($shop_id);
        }
        if (!$title) {
            $title = __("Shop", 'avia_framework');
        }
        if (is_product_category() || is_product_tag()) {
            global $wp_query;
            $tax = $wp_query->get_queried_object();
            $title = $tax->name;
            $t_link = '';
        }
        $title_args = array('title' => $title, 'link' => $t_link);
    }
    if (get_post_meta(get_the_ID(), 'header', true) != 'no') {
        echo avia_title($title_args);
    }
    echo "<div class='container_wrap main_color " . avia_layout_class('main', false) . " template-shop shop_columns_" . $avia_config['shop_overview_column'] . "'>";
    echo "<div class='container'>";
    if (!is_singular()) {
        $avia_config['overview'] = true;
    }
}
Exemple #4
0
<?php

global $avia_config;
/*
 * get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory.
 */
get_header();
$title = __('Blog - Latest News', 'avia_framework');
//default blog title
$t_link = home_url('/');
$t_sub = "";
if (avia_get_option('frontpage') && ($new = avia_get_option('blogpage'))) {
    $title = get_the_title($new);
    //if the blog is attached to a page use this title
    $t_link = get_permalink($new);
    $t_sub = avia_post_meta($new, 'subtitle');
}
if (get_post_meta(get_the_ID(), 'header', true) != 'no') {
    echo avia_title(array('heading' => 'strong', 'title' => $title, 'link' => $t_link, 'subtitle' => $t_sub));
}
?>

		<div class='container_wrap container_wrap_first main_color <?php 
avia_layout_class('main');
?>
'>

			<div class='container template-blog template-single-blog '>

				<main class='content units <?php 
avia_layout_class('content');
Exemple #5
0
 $output .= "<h3 class='miniheading'>" . __('Related Posts', 'avia_framework') . "</h3>";
 $output .= "<span class='minitext'>" . __('Did you like this entry? <br/>Here are a few more posts that might be interesting for you.', 'avia_framework') . "</span>";
 $output .= "</div>";
 $output .= "<div class ='related_posts'>";
 $output .= "<strong class='related_single_heading'>Related Posts</strong>";
 $output .= "<div class='content_slider autoslide_false'>";
 while ($my_query->have_posts()) {
     $my_query->the_post();
     if ($post->ID != $this_id) {
         $reladed_posts = true;
         $slidecount++;
         if ($count == 1) {
             $output .= "<div class='single_slide single_slide_nr_{$slidecount}'>";
         }
         $image = "<span class='related_posts_default_image'></span>";
         $slides = avia_post_meta(get_the_ID(), 'slideshow', true);
         //check if a preview image is set
         if ($slides != "" && !empty($slides[0]['slideshow_image'])) {
             //check for image or video
             if (is_numeric($slides[0]['slideshow_image'])) {
                 $image = avia_image_by_id($slides[0]['slideshow_image'], 'related', 'image');
             } else {
                 $image = "<span class='related_posts_default_image related_posts_video'></span>";
             }
         }
         $output .= "<div class='relThumb relThumb" . $count . "'>\n";
         $output .= "<a href='" . get_permalink() . "' class='relThumWrap noLightbox'>\n";
         $output .= "<span class='related_image_wrap'>";
         $output .= "<span class='rounded_corner rctl'></span>";
         $output .= "<span class='rounded_corner rctr'></span>";
         $output .= "<span class='rounded_corner rcbl'></span>";
 /**
  * This function creates the html code necessary for a slideshow. It uses the avia_slideshow class located in includes/helper-slideshow.php to do that
  *
  * @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)
  * @uses avia_slideshow
  * @return string $output the string returned contains the html code generated within the method
  */
 function slideshow($element)
 {
     global $avia_config;
     if (!isset($element['saved_value'])) {
         return;
     }
     extract($element['saved_value'][0]);
     $id = $dynamic_slideshow_which_post_page == 'self' ? avia_get_the_ID() : $dynamic_slideshow_page_id;
     $type = avia_post_meta($id, '_slideshow_type');
     switch ($type) {
         case 'aviaslider':
         case 'piecemaker':
         case 'fade_slider fullwidth':
             $image_size = 'featured';
             $use_big = true;
             $avia_config['dynamic_slideshow_big'] = true;
             break;
         case 'caption_slider':
         case 'aviacordion':
             $image_size = 'aviacordion';
             $use_big = true;
             $avia_config['dynamic_slideshow_big'] = true;
             break;
         case 'fade_slider':
             //call the function that displays featured images and slideshows within posts
             if (strpos($avia_config['layout'], 'big_image') !== false) {
                 $image_size = 'page';
             }
             if (strpos($avia_config['layout'], 'fullwidth') !== false) {
                 $image_size = 'featured';
                 $use_big = true;
                 $avia_config['dynamic_slideshow_big'] = true;
             }
             if (strpos($avia_config['layout'], 'medium_image') !== false) {
                 $image_size = 'blog';
             }
             break;
     }
     $showcaption = true;
     $slider = new avia_slideshow($id, $showcaption);
     if (isset($use_big)) {
         return $slider->display();
     } else {
         return $slider->display_small($image_size);
     }
 }
Exemple #7
0
function avia_woocommerce_before_main_content()
{
    global $avia_config;
    if (!isset($avia_config['layout'])) {
        $avia_config['layout'] = "";
    }
    if (!isset($avia_config['shop_overview_column'])) {
        $avia_config['shop_overview_column'] = "auto";
    }
    if (is_shop() && ($new = avia_post_meta(get_option('woocommerce_shop_page_id'), 'page_layout'))) {
        $avia_config['layout'] = $new;
    }
    echo "<div id='main' class='container_wrap " . $avia_config['layout'] . " template-shop shop_columns_" . $avia_config['shop_overview_column'] . "'>";
    echo "<div class='container'>";
    if (!is_singular()) {
        $avia_config['overview'] = true;
        avia_woocommerce_advanced_title();
    }
}
Exemple #8
0
<?php

global $avia_config, $more;
/*
 * get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory.
 */
get_header();
$title = __('Blog - Latest News', 'avia_framework');
//default blog title
$t_link = home_url('/');
$t_sub = "";
if (avia_get_option('frontpage') && ($blogpage_id = avia_get_option('blogpage'))) {
    $title = get_the_title($blogpage_id);
    //if the blog is attached to a page use this title
    $t_link = get_permalink($blogpage_id);
    $t_sub = avia_post_meta($blogpage_id, 'subtitle');
}
if (!empty($blogpage_id) && get_post_meta($blogpage_id, 'header', true) != 'no') {
    echo avia_title(array('heading' => 'strong', 'title' => $title, 'link' => $t_link, 'subtitle' => $t_sub));
}
do_action('ava_after_main_title');
?>



		<div class='container_wrap container_wrap_first main_color <?php 
avia_layout_class('main');
?>
 <?php 
echo avia_blog_class_string();
?>
 function slideshow_class()
 {
     $class = ' preloading ' . $this->extraclass;
     $class .= ' autoslide_' . $this->autoplay;
     $class .= ' autoslidedelay__' . $this->duration;
     $class .= ' slideshow_' . $this->img_size;
     $class .= ' ' . $this->type;
     switch ($this->type) {
         case 'aviaslider':
             if (!isset($width)) {
                 $width = avia_post_meta($this->post_id, 'slice_width');
             }
             if (!isset($height)) {
                 $height = avia_post_meta($this->post_id, 'slice_height');
             }
             if (!isset($transition)) {
                 $transition = avia_post_meta($this->post_id, 'transition_type');
             }
             if (!isset($direction)) {
                 $direction = avia_post_meta($this->post_id, 'direction');
             }
             $class .= ' block_width__' . $width;
             $class .= ' block_height__' . $height;
             $class .= ' transition_type__' . $transition;
             $class .= ' direction__' . $direction;
             break;
         case 'fade_slider':
             if ($this->img_size == 'fullsize') {
                 $class .= '  auto_height';
             }
             break;
         case 'aviacordion':
             break;
         case 'piecemaker':
             break;
         case 'caption_slider':
             $class .= '  caption_full_opa auto_height transition_slide';
             break;
     }
     return $class;
 }
<?php

global $avia_config;
/* 
 * create a new dynamic template object and display it.
 * The rendering class is located in includes/helper-templates.php
 */
$post_id = avia_get_the_ID();
$template_name = avia_post_meta($post_id, 'dynamic_templates');
$template = new avia_dynamic_template($template_name);
$template->set_layout();
$template->generate_html();
$template->special_slider_config();
/*
 * get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory.
 */
get_header();
if (isset($avia_config['new_query'])) {
    query_posts($avia_config['new_query']);
    the_post();
}
?>
	

		
		<!-- ####### MAIN CONTAINER ####### -->
		<div class='container_wrap <?php 
echo $avia_config['layout'];
?>
' id='main'>
		
Exemple #11
0
<?php

global $avia_config;
if (isset($avia_config['new_query'])) {
    query_posts($avia_config['new_query']);
}
// check if we got posts to display:
if (have_posts()) {
    $first = true;
    while (have_posts()) {
        the_post();
        //check for preview images:
        $image = "";
        $slides = avia_post_meta('slideshow');
        if (is_array($slides) && !empty($slides[0]['slideshow_image'])) {
            $image = avia_image_by_id($slides[0]['slideshow_image'], 'widget', 'image');
        }
        if (!$first) {
            echo "<div class='hr'></div>";
        }
        echo "<a class='post-entry news-content' title='" . get_the_title() . "' href='" . get_permalink() . "'>";
        echo "<span class='news-link'>";
        if ($image) {
            echo "<span class='news-thumb'>";
            echo $image;
            echo "</span>";
        }
        echo "<strong class='news-headline'>" . get_the_title();
        echo "<span class='news-time'>" . get_the_time("F j, Y, g:i a") . "</span>";
        echo "</strong>";
        echo "</span>";