コード例 #1
0
ファイル: utils.php プロジェクト: kadimi/tijara
function header_social_links()
{
    $social_links = tijara_option('social_links');
    if (!is_array($social_links)) {
        return;
    }
    /**
     * Social sites to font icon reference
     * 
     * Example:
     * $social_domains['google'] = ''
     * 
     * Note:
     * If no corresponding value is found for a social site,
     * the domain without extention will be used (e.g.: twitter, facebook...)
     */
    $social_domains = array('google' => array('google-plus', 'Google+'), 'facebook' => array('facebook', 'Facebook'), 'flickr' => array('flickr', 'Flickr'), 'instagram' => array('instagram', 'Instagram'), 'linkedin' => array('linkedin', 'LinkedIn'), 'pinterest' => array('pinterest', 'Pinterest'), 'skype' => array('skype', 'Skype'), 'twitter' => array('twitter', 'Twitter'), 'vimeo' => array('vimeo', 'Vimeo'), 'vk' => array('vk', 'VKontakte'), 'youtube' => array('youtube', 'YouTube'));
    foreach ($social_links as $social_link) {
        // Get link domain
        $social_domain = str_replace('www.', '', get_value(parse_url($social_link), 'host'));
        // Automatic slug
        $social_domain_no_ext = array_shift(preg_split('/(?=\\.[^.]+$)/', $social_domain));
        // Slug from referece
        if (isset($social_domains[$social_domain_no_ext])) {
            $social_slug = $social_domains[$social_domain_no_ext][0];
            $social_service = $social_domains[$social_domain_no_ext][1];
        } else {
            $social_slug = 'question-circle';
        }
        echo "<a title = \"" . sprintf(__('Follow on %s', 'tijara'), $social_service) . "\" href=\"{$social_link}\" ><i class=\"{$social_slug} fa fa-{$social_slug}\"></i></a> ";
    }
}
コード例 #2
0
ファイル: piklist.php プロジェクト: kadimi/tijara
function tijara_get_image_URL($image, $default = null)
{
    $image = tijara_option($image);
    $image_URL = false;
    is_array($image) && ($image = $image[0]);
    if (!empty($image)) {
        $image_URL = wp_get_attachment_url($image);
    }
    if ($image_URL) {
        return $image_URL;
    } else {
        if (isset($default)) {
            return get_template_directory_uri() . '/' . $default;
        } else {
            return false;
        }
    }
}
コード例 #3
0
ファイル: enqueue.php プロジェクト: kadimi/tijara
function tijara_inline_css()
{
    $css = '';
    if (tijara_option('boxed') === '1' && ($background_image = tijara_get_background_URL())) {
        $css = "body{background: url(\"{$background_image}\") fixed}";
        switch (tijara_option('background_style')) {
            case 'repeat-x':
                $css .= "body{background-repeat:repeat-x}";
                break;
            case 'repeat-y':
                $css .= "body{background-repeat:repeat-y}";
                break;
            case 'stretch':
                $css .= "body{background-size:cover}";
                break;
        }
    }
    wp_add_inline_style('tijara-main', $css);
}
コード例 #4
0
ファイル: widgets.php プロジェクト: kadimi/tijara
function tijara_body_class($classes)
{
    global $sidebars_widgets;
    // Responsive
    $classes[] = (tijara_option('disable_responsive') ? 'no-' : '') . 'responsive';
    // Main menu width
    if (tijara_option('menu_width') === 'wide') {
        $classes[] = 'menu-wide';
    }
    // Top bar
    if (tijara_option('topbar_menu') === '0') {
        $classes[] = 'no-topbar';
    }
    // Sticky
    if ('menu' === tijara_option('sticky') or in_array('menu', tijara_option('sticky', array()))) {
        $classes[] = 'sticky-menu';
    }
    if ('topbar' === tijara_option('sticky') or in_array('topbar', tijara_option('sticky', array()))) {
        $classes[] = 'sticky-topbar';
    }
    // Boxed
    if (tijara_option('boxed') === '1') {
        $classes[] = 'boxed';
    }
    // Top menu
    $primary_menu = wp_nav_menu(array('container' => FALSE, 'container_class' => 'desktop-only', 'echo' => FALSE, 'fallback_cb' => FALSE, 'theme_location' => 'primary', 'walker' => new Tijara_Walker_Menu()));
    if (empty($primary_menu)) {
        $classes[] = 'no-menu';
    }
    // Sidebar position
    $classes[] = 'sidebar-' . tijara_option('sidebar_position');
    // Sidebar position
    if (empty($sidebars_widgets['sidebar'])) {
        $classes = array_values(array_diff($classes, array('sidebar-before')));
        $classes = array_values(array_diff($classes, array('sidebar-after')));
        $classes[] = 'sidebar-none';
    }
    return $classes;
}
コード例 #5
0
ファイル: navigation.php プロジェクト: kadimi/tijara
        ?>
" value="<?php 
        echo esc_attr(get_search_query());
        ?>
" name="s" title="<?php 
        _ex('Search for:', 'label', 'tijara');
        ?>
" />
				</form>
				<label for="s" class="gray"><i class="fa fa-search double"></i></label>
			</div>
		<?php 
    }
    ?>

		<?php 
    if (!tijara_option('disable_responsive')) {
        ?>
		<div id="mobile-cart">
			<a href="<?php 
        echo $GLOBALS['woocommerce']->cart->get_cart_url();
        ?>
"><i class="fa fa-shopping-cart double"></i></a>	
		</div>
		<?php 
    }
    ?>

	</nav><!-- #site-navigation -->
<?php 
}
コード例 #6
0
ファイル: top.php プロジェクト: kadimi/tijara
<?php

/**
 * Prevent direct access to this file
 */
function_exists('tijara_option') or die;
?>

<?php 
$topbar_plus = tijara_option('topbar_plus', tijara_default('topbar_plus'));
$secondary_menu = wp_nav_menu(array('container' => FALSE, 'depth' => 1, 'echo' => FALSE, 'fallback_cb' => '__return_false', 'menu_class' => '', 'theme_location' => 'secondary_menu'));
?>

<div id="masthead-top">
	<div id="masthead-top-inner">
		<?php 
// Prepare menu width
if (strstr($topbar_plus, 'cart') && strstr($topbar_plus, 'social')) {
    $topbar_menu_width = 6;
} else {
    if (strstr($topbar_plus, 'cart') || strstr($topbar_plus, 'social')) {
        $topbar_menu_width = 9;
    } else {
        $topbar_menu_width = 12;
    }
}
// Show menu
if (!empty($secondary_menu)) {
    echo '<div id="secondary-menu" class="span' . $topbar_menu_width . '">' . $secondary_menu . '</div>';
}
// Show cart and social
コード例 #7
0
ファイル: header.php プロジェクト: kadimi/tijara
" rel="home"><img src="<?php 
    echo tijara_get_logo_URL();
    ?>
" alt="<?php 
    bloginfo('description');
    ?>
" /></a>
			</div><!-- #logo -->
		<?php 
}
?>

		<?php 
// Calculate the header widgets sidebar depending on logo position
if (!tijara_option('logo_position') || tijara_option('logo_position') === 'header') {
    $header_sidebar_spans = tijara_option('logo_width') ? 12 - tijara_option('logo_width') : 9;
    $header_sidebar_spans = 'span' . $header_sidebar_spans . ' last';
} else {
    $header_sidebar_spans = 'span12';
}
?>
		<div class="<?php 
echo $header_sidebar_spans;
?>
">
			<?php 
dynamic_sidebar('header');
?>
		</div>