Example #1
0
function biznex_main_slider_section($atts, $content = null)
{
    extract(shortcode_atts(array('section_id' => ''), $atts));
    $output = '';
    $output .= Tesla_slider::get_slider_html('biznex_main', array('shortcode_parameters' => array('section_id' => $section_id)));
    return biznex_before_shortcode() . $output . biznex_after_shortcode();
}
 public static function get_slider_html($slider_id, $category = '', $output_id = null, $post_id = null, $shortcode_parameters = array(), $query = array(), $custom = array())
 {
     $args = func_get_args();
     if (count($args) === 2 && is_array($args[1])) {
         $args = $args[1];
         $args_defaults = array('category' => '', 'output_id' => null, 'post_id' => null, 'shortcode_parameters' => array(), 'query' => array(), 'custom' => array());
         $args = shortcode_atts($args_defaults, $args);
         $category = $args['category'];
         $output_id = $args['output_id'];
         $post_id = $args['post_id'];
         $shortcode_parameters = $args['shortcode_parameters'];
         $query = $args['query'];
         $custom = $args['custom'];
     }
     $slider_options = self::$slider_config;
     if (!array_key_exists($slider_id, $slider_options)) {
         return false;
     } else {
         if ($output_id === null) {
             if (isset($slider_options[$slider_id]['output_default']) && isset($slider_options[$slider_id]['output'][$slider_options[$slider_id]['output_default']])) {
                 $output_id = $slider_options[$slider_id]['output_default'];
             } else {
                 $output_id = array_keys($slider_options[$slider_id]['output']);
                 $output_id = reset($output_id);
             }
         }
         $data = array();
         if ($post_id === null) {
             $query_options = array('post_type' => $slider_id, 'order' => isset($slider_options[$slider_id]['order']) ? $slider_options[$slider_id]['order'] : 'DESC', 'posts_per_page' => -1, 'suppress_filters' => false);
             if (!empty($category)) {
                 $query_options['tax_query'] = array(array('taxonomy' => $slider_id . '_tax', 'field' => 'slug', 'terms' => explode(' ', $category), 'operator' => 'IN'));
             }
             if (!empty($query)) {
                 $query_options = array_merge($query_options, $query);
             }
             $posts_array = get_posts($query_options);
         } else {
             if (is_array($post_id)) {
                 $posts_array = $post_id;
             } else {
                 $posts_array = array(get_post($post_id));
             }
         }
         $values_array = array();
         $all_categories_pool = array();
         foreach ($posts_array as $post) {
             $meta = apply_filters('tesla_slide_options', get_post_meta($post->ID, 'slide_options', true), $post->ID, 'get_slider_html');
             $meta_array = self::process_options($meta, $slider_options[$slider_id]['options']);
             $post_cats = get_the_terms($post->ID, $slider_id . '_tax');
             $post_cats_slugs = array();
             if (is_array($post_cats)) {
                 foreach ($post_cats as $cat) {
                     if ($cat->slug !== $category && $cat->name !== $category) {
                         $post_cats_slugs[$cat->slug] = $cat->name;
                     }
                 }
             }
             $all_categories_pool = array_merge($all_categories_pool, $post_cats_slugs);
             $values_array[] = array('post' => $post, 'options' => $meta_array, 'categories' => $post_cats_slugs, 'related' => self::get_related($post->ID, $category));
         }
         $all_categories = Tesla_slider::get_categories($slider_id, true);
         // foreach ($all_categories as $all_categories_key => $all_categories_value)
         // 	if($all_categories_key===$category||$all_categories_value===$category)
         // 		unset($all_categories[$all_categories_key]);
         foreach ($all_categories as $all_categories_key => $all_categories_value) {
             if ('' !== $category && !array_key_exists($all_categories_key, $all_categories_pool)) {
                 unset($all_categories[$all_categories_key]);
             }
         }
         $data['slides'] = $values_array;
         $data['all_categories'] = $all_categories;
         $shortcode_defaults = isset($slider_options[$slider_id]['output'][$output_id]['shortcode_defaults']) ? $slider_options[$slider_id]['output'][$output_id]['shortcode_defaults'] : array();
         $data['shortcode'] = shortcode_atts($shortcode_defaults, $shortcode_parameters);
         $data['slider_id'] = $slider_id;
         $data['output_id'] = $output_id;
         $data['custom'] = $custom;
         $view = $slider_options[$slider_id]['output'][$output_id]['view'];
         return self::$load->view($view, $data, true, true);
     }
 }
get_header();
?>
<div class="site-title-center">
    <div class="container">
        <h3><?php 
the_title();
?>
</h3>
        <ul class="content-arrows">
            <li class="prev"><i class="icon-517" title="517"></i></li>
            <li class="next"><i class="icon-501" title="501"></i></li>
        </ul>
    </div> 
</div>
<?php 
echo Tesla_slider::get_slider_html('events');
?>

<?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        ?>
    <div class='container'>
        <?php 
        the_content();
        ?>
    </div>
    <?php 
    }
}
<?php 
if (have_posts()) {
    the_post();
    ?>

<div class="titleContainer font1 titlePage titleBordered">
    <div class="title">
        <?php 
    the_title();
    ?>
    </div>
</div>

<div class="page page-no-padding">
	<div class="pageContents">
		<?php 
    echo Tesla_slider::get_slider_html('revoke_portfolio', '', 'single', get_the_ID());
    ?>
	</div>
    <?php 
    comments_template();
    ?>
</div>

<?php 
}
?>

<?php 
get_footer();
Example #5
0
define('THEME_OPTIONS', THEME_NAME . '_options');
//Load main framework classes
require_once TTF . '/extensions/twitteroauth/twitteroauth.php';
require_once TTF . '/core/teslaframework.php';
require_once TTF . '/core/tesla_admin.php';
require_once TTF . '/core/tt_load.php';
if (file_exists(TTF . '/core/tt_security.php')) {
    require_once TTF . '/core/tt_security.php';
} else {
    exit;
}
//TT ENQUEUE
require_once TTF . '/core/tt_enqueue.php';
TT_ENQUEUE::init_enqueue();
//Contact Form Builder
if (file_exists(TT_THEME_DIR . '/theme_config/contact-form-config.php')) {
    require_once TTF . '/core/tt_contact_form.php';
    TT_Contact_Form_Builder::init_builder();
}
//Admin load
$TTA = new Tesla_admin();
//Slider - do not load if plugin TFW detected
if ((!defined('TT_USES_PLUGIN') || defined('TT_USES_PLUGIN') && !TT_USES_PLUGIN) && !class_exists('Tesla_slider')) {
    require_once TTF . '/core/tesla_slider.php';
    Tesla_slider::init();
}
//Subscription
if (file_exists(TT_THEME_DIR . '/theme_config/subscription.php')) {
    require_once TTF . '/core/tt_subscription.php';
    TT_Subscription::subscription_init();
}
<?php

get_header();
?>

<?php 
if (have_posts()) {
    the_post();
    ?>

	<?php 
    echo Tesla_slider::get_slider_html('events', '', 'single', get_the_ID());
    ?>
	
<?php 
}
?>

<?php 
get_footer();
get_header();
?>
<div class="site-title-center">
    <div class="container">
        <h3><?php 
the_title();
?>
</h3>
        <ul class="content-arrows">
            <li class="prev"><i class="icon-517" title="517"></i></li>
            <li class="next"><i class="icon-501" title="501"></i></li>
        </ul>
    </div> 
</div>
<?php 
echo Tesla_slider::get_slider_html('events', '', 'masonry');
?>

<?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        ?>
    <div class='container'>
        <?php 
        the_content();
        ?>
    </div>
    <?php 
    }
}
<?php

/*
    Template Name: Gallery
*/
get_header();
?>
<div class="content-path-1">
    <h1><?php 
the_title();
?>
</h1>
</div>
<div class="container">
	<?php 
echo Tesla_slider::get_slider_html('gallery');
?>
</div>
<?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        ?>
    <div class='container'>
        <?php 
        the_content();
        ?>
    </div>
    <?php 
    }
}
<?php

/*
    Template Name: Portfolio
*/
get_header();
?>
<div class="content-path-1">
    <h1><?php 
the_title();
?>
</h1>
</div>
<div class="container">
	<?php 
echo Tesla_slider::get_slider_html('portfolio');
?>
</div>
<?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        ?>
    <div class='container'>
        <?php 
        the_content();
        ?>
    </div>
    <?php 
    }
}