Пример #1
0
/**
 * Display the footer widget if the footer widget are active.
 */
function calibrefx_do_footer_widgets()
{
    global $wp_registered_sidebars;
    $footer_widgets = get_theme_support('calibrefx-footer-widgets');
    $all_widgets = wp_get_sidebars_widgets();
    //Check if footer widget theme support is activated or is there any widget inside
    if (!$footer_widgets or !isset($all_widgets['footer-widget'])) {
        return;
    }
    $count_footer_widgets = count($all_widgets['footer-widget']);
    if (0 == $count_footer_widgets) {
        return;
    }
    if (current_theme_supports('calibrefx-responsive-style')) {
        $span = 'col-lg-' . strval(floor(12 / $count_footer_widgets)) . ' col-md-' . strval(floor(12 / $count_footer_widgets)) . ' col-sm-12 col-xs-12';
    } else {
        $span = 'col-xs-' . strval(floor(12 / $count_footer_widgets));
    }
    $sidebar = $wp_registered_sidebars['footer-widget'];
    $footer_widget_column = apply_filters('calibrefx_footer_widget_column_span', $span);
    $sidebar['before_widget'] = '<div id="%1$s" class="widget ' . $footer_widget_column . ' %2$s">';
    $sidebar['after_widget'] = '</div>';
    unregister_sidebar('footer-widget');
    register_sidebar($sidebar);
    if (is_active_sidebar('footer-widget')) {
        echo '<div id="footer-widget">';
        calibrefx_put_wrapper('footer-widget', 'open');
        $footer_widget_wrapper_class = apply_filters('footer_widget_wrapper_class', calibrefx_row_class());
        echo '<div class="footer-widget-wrapper"><div class="' . $footer_widget_wrapper_class . '">';
        dynamic_sidebar('footer-widget');
        echo '</div></div><!--end .footer-widget-wrapper -->';
        calibrefx_put_wrapper('footer-widget', 'close');
        echo '</div><!--end #footer-widget-->';
    }
}
Пример #2
0
    /**
     * Display widget content.
     *
     * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
     * @param array $instance The settings for the particular instance of the widget
     */
    function widget($args, $instance)
    {
        global $wp_query, $calibrefx;
        extract($args);
        $instance = wp_parse_args((array) $instance, $this->defaults);
        echo $before_widget;
        if (!empty($instance['title'])) {
            echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
        }
        $query = new WP_Query(array('posts_per_page' => $instance['num_posts'], 'orderby' => 'date', 'order' => 'DESC', 'ignore_sticky_posts' => true));
        $no_post_thumbnail = apply_filters('no_thumbnail_image_url', CALIBREFX_IMAGES_URL . '/no-image.jpg');
        echo '<ul class="list-latest-posts">';
        if ($query->have_posts()) {
            while ($query->have_posts()) {
                $query->the_post();
                $img = calibrefx_get_image(array('format' => 'html', 'size' => $instance['image_size']));
                $img = !empty($img) ? $img : '<img src="' . $no_post_thumbnail . '" />';
                $date_format = get_option('date_format');
                $item_class = apply_filters('calibrefx_latest_posts_item_class', calibrefx_row_class());
                $image_class = apply_filters('calibrefx_latest_posts_image_class', col_class(12, 4, 4));
                $content_class = apply_filters('calibrefx_latest_posts_content_class', col_class(12, 8, 8));
                if ($instance['show_thumbnail']) {
                    echo '
						<li>
							<div class="' . $item_class . ' latest-post-item">
								<div class="latest-post-thumb ' . $image_class . '">
									<a href="' . get_permalink() . '" class="thumbnail">' . $img . '</a>
								</div>
								<div class="latest-post-detail ' . $content_class . '">
									<h5 class="latest-post-title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h5>
									<p class="latest-post-info">' . do_shortcode('[post_date]') . '</p>
									' . ($instance['show_detail'] ? get_the_content_limit($instance['detail_length']) : '') . '
								</div>
							</div>
						</li>
					';
                } else {
                    echo '
						<li>
							<div class="' . calibrefx_row_class() . ' latest-post-item">
								<div class="latest-post-detail col-lg-12 col-md-12 col-sm-12 col-xs-12">
									<h5 class="latest-post-title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h5>
									<p class="latest-post-date">' . date($date_format, get_the_time('U')) . '</p>
									' . ($instance['show_detail'] ? get_the_content_limit($instance['detail_length']) : '') . '
								</div>
							</div>
						</li>
					';
                }
            }
        } else {
            echo '<li>' . __('There is no post available yet', 'calibrefx') . '</li>';
        }
        echo '</ul>';
        echo $after_widget;
        wp_reset_query();
        wp_reset_postdata();
    }
Пример #3
0
/**
 * This function is for displaying the "Primary Navigation" bar.
 */
function calibrefx_do_nav()
{
    global $calibrefx;
    /** Do nothing if menu not supported */
    if (!calibrefx_nav_menu_supported('primary')) {
        return;
    }
    $calibrefx->load->library('walker_nav_menu');
    $nav = '';
    $args = '';
    $superfish_class = apply_filters('nav_superfish', ' superfish');
    if (calibrefx_get_option('nav')) {
        if (has_nav_menu('primary')) {
            $args = array('theme_location' => 'primary', 'container' => '', 'menu_class' => 'nav navbar-nav menu-primary menu' . $superfish_class, 'echo' => 0, 'walker' => $calibrefx->walker_nav_menu);
            $nav = wp_nav_menu($args);
        } else {
            $nav = '<ul id="menu-primary-i" class="nav navbar-nav menu-primary menu' . $superfish_class . '">
					<li id="menu-item-812" class="menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item page-item-800 current_page_item menu-item-812"><a href="#"><i class="fa fa-home"></i>&nbsp;&nbsp;Homepage</a></li>
					<li id="menu-item-813" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-813"><a href="#"><i class="fa fa-comment"></i>&nbsp;&nbsp;About Us</a></li>
					<li id="menu-item-817" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-817"><a href="#"><i class="fa fa-envelope-o"></i>&nbsp;&nbsp;Contact Page</a></li>
				</ul>';
        }
        $nav_class = apply_filters('nav_class', calibrefx_row_class());
        if (calibrefx_is_responsive_enabled()) {
            $nav_output = sprintf('
				<div id="nav" class="navbar navbar-default">
					%2$s
					<div class="navbar-header">
						<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
							<span class="navbar-brand">%4$s</span>                            
							<span class="menu-toggle-icon">
								<span class="icon-bar"></span>
								<span class="icon-bar"></span>
								<span class="icon-bar"></span>
							</span>
						</button>
					</div>
					<div class="collapse navbar-collapse" role="navigation">%1$s</div>  
					%3$s
				</div>
				<!-- end #nav -->', $nav, calibrefx_put_wrapper('nav', 'open', false), calibrefx_put_wrapper('nav', 'close', false), __('MENU', 'calibrefx'));
        } else {
            $nav_output = sprintf('
				<div id="nav" class="navbar navbar-default">
					%2$s
					%1$s
					%3$s
				</div>
				<!-- end #nav -->', $nav, calibrefx_put_wrapper('nav', 'open', false), calibrefx_put_wrapper('nav', 'close', false));
        }
        echo apply_filters('calibrefx_do_nav', $nav_output, $nav, $args);
    }
}
Пример #4
0
/**
 * Retrieve the classes for the body element as an array.
 * @deprecated 2.0
 */
function get_footer_widget_classes($class = '')
{
    _deprecated_function(__FUNCTION__, '2.0');
    $classes = array();
    //always use row class as the base
    $classes[] = calibrefx_row_class();
    if (!empty($class)) {
        if (!is_array($class)) {
            $class = preg_split('#\\s+#', $class);
        }
        $classes = array_merge($classes, $class);
    } else {
        $class = array();
    }
    $classes = array_map('esc_attr', $classes);
    return apply_filters('footer_widget_class', $classes, $class);
}
Пример #5
0
/**
 * Fire everything and display it.
 * 
 * @param  array  $args allow to custom template
 * @return void
 */
function calibrefx($args = array())
{
    $default_args = array('header' => '', 'footer' => '');
    $args = array_merge($default_args, $args);
    extract($args);
    get_header($header);
    do_action('calibrefx_inner');
    do_action('calibrefx_before_content_wrapper');
    $content_wrapper_class = calibrefx_row_class() . ' ' . apply_filters('content_wrapper_class', '');
    ?>
    <div id="content-wrapper" class="<?php 
    echo esc_attr($content_wrapper_class);
    ?>
" >
        <?php 
    do_action('calibrefx_before_content');
    ?>
        <div id="content" class="<?php 
    echo esc_attr(calibrefx_content_span());
    ?>
">
            <?php 
    do_action('calibrefx_before_loop');
    do_action('calibrefx_loop');
    do_action('calibrefx_after_loop');
    ?>
        </div><!-- end #content -->
        <?php 
    do_action('calibrefx_after_content');
    ?>
    </div><!-- end #content-wrapper -->
    <?php 
    do_action('calibrefx_after_content_wrapper');
    do_action('calibrefx_after_inner');
    get_footer($footer);
}
Пример #6
0
 * The Template for displaying product archives, including the main shop page which is a post type archive.
 *
 * Override this template by copying it to yourtheme/woocommerce/archive-product.php
 *
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version     2.0.0
 */
if (!defined('ABSPATH')) {
    exit;
    // Exit if accessed directly
}
get_header('shop');
do_action('calibrefx_inner');
do_action('calibrefx_before_content_wrapper');
$content_wrapper_class = calibrefx_row_class() . ' ' . apply_filters('content_wrapper_class', '');
?>
    <div id="content-wrapper" class="<?php 
echo esc_attr($content_wrapper_class);
?>
" >
    <?php 
do_action('calibrefx_before_content');
/**
 * woocommerce_before_main_content hook
 *
 * @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
 * @hooked woocommerce_breadcrumb - 20
 */
do_action('woocommerce_before_main_content');
?>
Пример #7
0
function calibrefx_sidebar_content_sidebar_wrapper_open()
{
    echo '<div id="content-sidebar" class="' . calibrefx_content_sidebar_span() . '"><div class="' . calibrefx_row_class() . '">';
}
Пример #8
0
function calibrefx_three_fourth_column($atts, $content = '')
{
    extract(shortcode_atts(array('class' => '', 'style' => '', 'align' => '', 'last' => 'no', 'first' => 'no', 'id' => ''), $atts));
    $before = '';
    $after = '';
    $classes = '';
    $attr = '';
    $classes .= ' col-lg-9 col-md-9 col-sm-12 col-xs-12';
    if (!empty($class)) {
        $classes .= ' ' . $class;
    }
    if (!empty($align)) {
        $classes .= ' ' . $align;
    }
    if (!empty($first)) {
        if ($first == 'yes') {
            $before = '<div class="' . calibrefx_row_class() . '">';
        }
    }
    if (!empty($last)) {
        if ($last == 'yes') {
            $after = '</div>';
        }
    }
    if (!empty($style)) {
        $attr .= ' style="' . $style . '"';
    }
    if (!empty($id)) {
        $attr .= ' id="' . $id . '"';
    }
    return $before . '<div class="' . $classes . '"' . $attr . '>' . do_shortcode(advance_shortcode_unautop($content)) . '</div>' . $after;
}
Пример #9
0
/**
 * Show the mobile special menu 
 */
function calibrefx_do_mobile_nav()
{
    global $calibrefx;
    $calibrefx->load->library('walker_nav_menu');
    $nav = '';
    $args = '';
    $args = array('theme_location' => 'mobile', 'container' => '', 'menu_class' => calibrefx_get_option('nav_fixed_top') ? 'navbar navbar-default navbar-fixed-top menu-primary menu ' : 'nav navbar-nav menu-primary menu ', 'echo' => 0, 'walker' => $calibrefx->walker_nav_menu);
    $nav = wp_nav_menu($args);
    $nav_class = apply_filters('nav_class', calibrefx_row_class());
    $nav_output = sprintf('
		<div id="mobile-nav" class="navbar navbar-default">
			 %1$s
		</div>
		<!-- end #mobile-nav -->', $nav);
    echo apply_filters('calibrefx_do_mobile_nav', $nav_output, $nav, $args);
}
Пример #10
0
/**
 * Echo function for calibrefx_row_class()
 *
 * @echo string
 */
function row_class()
{
    // @codingStandardsIgnoreStart
    echo calibrefx_row_class();
    // @codingStandardsIgnoreEnd
}