예제 #1
0
function xinwp_scripts_method()
{
    global $xinwp_options, $xinwp_fonts;
    $theme_uri = get_template_directory_uri();
    // Check if the fonts are webfont, if yes, load the font.
    $xinwp_fonts = xinwp_fonts_array();
    $font_elements = array('bodyfont', 'headingfont', 'entrytitlefont', 'sitetitlefont', 'sitedescfont', 'mainmenufont', 'sidebarfont', 'widgettitlefont', 'footerfont');
    $fonts = array();
    foreach ($font_elements as $element) {
        if ($xinwp_options[$element] > 0 && !in_array($xinwp_options[$element], $fonts)) {
            $fonts[] = $xinmag_options[$element];
        }
    }
    foreach ($fonts as $font) {
        if (!empty($xinwp_fonts[$font]['url'])) {
            wp_enqueue_style(str_replace(' ', '', $xinwp_fonts[$font]['label']), $xinwp_fonts[$font]['url'], false, 1.0);
        }
    }
    // Foundation CSS
    wp_enqueue_style('xinwp-addons', $theme_uri . '/xinwp/css/addons.min.css', false, XINWP_VERSION);
    wp_enqueue_style('xinwp-foundation', $theme_uri . '/xinwp/css/foundation.min.css', array('xinwp-addons'), '4.1.7');
    // Javascript
    if (is_singular() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }
    wp_enqueue_script('modernizr', $theme_uri . '/xinwp/js/custom.modernizr.js', null, true);
    wp_enqueue_script('easing', $theme_uri . '/xinwp/js/jquery.easing.js', array('jquery'), null, true);
    wp_enqueue_script('foundation', $theme_uri . '/xinwp/js/foundation.min.js', array('jquery'), '4.1.7', true);
    if (has_nav_menu('section')) {
        wp_enqueue_script('xinwp-mobilemenu', $theme_uri . '/xinwp/js/jquery.mobilemenu.min.js', array('jquery'), '4.1.7', true);
    }
}
예제 #2
0
function xinmag_scheme_css($input)
{
    $xinwp_fonts = xinwp_fonts_array();
    $css = '';
    if (1080 != $input['gridwidth']) {
        $css .= '.row, .contain-to-grid .top-bar {max-width: ' . $input['gridwidth'] . 'px; }' . "\n";
    }
    if (1 == $input['sidebarresp'] && 3 != $input['sidebarpos']) {
        if ($input['content'] + $input['sidebar1'] + $input['sidebar2'] <= 12) {
            $pct = 100 / 12 * ($input['sidebar1'] + $input['sidebar2']);
            $pct = (int) $pct * 100000;
            $pct = $pct / 100000;
            $css .= '@media only screen and (min-width: 768px) ';
            $css .= 'and (max-width: ' . $input['respbp'] . 'px) {' . "\n";
            $css .= '#sidebar_one,#sidebar_two { width: ' . $pct;
            $css .= '%; border-right: none; }}' . "\n";
        }
    }
    if (1 == $input['sidebarresp']) {
        $pct = 50;
        $css .= '@media only screen and (min-width: 481px) ';
        $css .= 'and (max-width: 767px) {' . "\n";
        $css .= '#sidebar_one,#sidebar_two { width: ' . $pct;
        $css .= '%; }}' . "\n";
    }
    // Magazin Section Color
    $sections = array();
    parse_str($input['section_order'], $sections);
    if (isset($sections['section'])) {
        foreach ($sections['section'] as $section) {
            $color = $input['color_' . $section];
            $css .= '.color_' . $section . ' { color:' . $color . '; } ' . "\n";
            $css .= '.bdcolor_' . $section . ' { border-color:' . $color . '; } ' . "\n";
            $css .= '.bgcolor_' . $section . ' { background-color:' . $color . '; } ' . "\n";
        }
    }
    // Fonts
    if ($input['bodyfont'] > 0) {
        $css .= 'body {font-family:' . $xinwp_fonts[$input['bodyfont']]['family'] . ';}' . "\n";
    }
    if ($input['headingfont'] > 0) {
        $css .= 'h1, h2, h3, h4, h5, h6 {font-family:' . $xinwp_fonts[$input['headingfont']]['family'] . ';}' . "\n";
    }
    if ($input['entrytitlefont'] > 0) {
        $css .= '.entry-title {font-family:' . $xinwp_fonts[$input['entrytitlefont']]['family'] . ';}' . "\n";
    }
    if ($input['sitetitlefont'] > 0) {
        $css .= '#site-title {font-family:' . $xinwp_fonts[$input['sitetitlefont']]['family'] . ';}' . "\n";
    }
    if ($input['sitedescfont'] > 0) {
        $css .= '#site-description {font-family:' . $xinwp_fonts[$input['sitedescfont']]['family'] . ';}' . "\n";
    }
    if ($input['widgettitlefont'] > 0) {
        $css .= '.widget-title {font-family:' . $xinwp_fonts[$input['widgettitlefont']]['family'] . ';}' . "\n";
    }
    if ($input['sidebarfont'] > 0) {
        $css .= '.blog-widgets {font-family:' . $xinwp_fonts[$input['sidebarfont']]['family'] . ';}' . "\n";
    }
    if ($input['footerfont'] > 0) {
        $css .= '#footer {font-family:' . $xinwp_fonts[$input['footerfont']]['family'] . ';}' . "\n";
    }
    if ($input['mainmenufont'] > 0) {
        $css .= '#topbar {font-family:' . $xinwp_fonts[$input['mainmenufont']]['family'] . ';}' . "\n";
    }
    //Background
    if (!empty($input['headerbg'])) {
        $css .= '.custom-background .site-header,.site-header {background:' . $input['headerbg'] . ';}' . "\n";
    }
    if (!empty($input['titlebarbg'])) {
        $css .= '.custom-background .titlebar,.titlebar {background:' . $input['titlebarbg'] . ';}' . "\n";
    }
    if (!empty($input['contentbg'])) {
        $css .= '.custom-background .row-container,.row-container {background:' . $input['contentbg'] . ';}' . "\n";
    }
    if (!empty($input['footerbg'])) {
        $css .= '.custom-background #footer,#footer {background:' . $input['footerbg'] . ';}' . "\n";
    }
    return apply_filters('xinmag_scheme_css', $css);
}