/**
 * Returns the 960 grid system classes.
 *
 * @param string $classes Optional additional classes
 * @param int $grid_one Grid number for 1 column layout
 * @param int $grid_two Grid number for 2 column layout
 * @param int $grid_three Grid number for 3 column layout
 * @param bool $alpha Switch for the alpha class
 * @param bool $omega Switch for the omega class
 * @return array Grid system classes
 *
 * @package Graphene
 * @since 1.6
*/
function graphene_get_grid($classes = '', $grid_one = 1, $grid_two = '', $grid_three = '', $alpha = false, $omega = false)
{
    $grid_two = !$grid_two ? $grid_one : $grid_two;
    $grid_three = !$grid_three ? $grid_one : $grid_three;
    $column_mode = graphene_column_mode();
    $grid = array();
    if ($classes) {
        $grid = array_merge($grid, explode(' ', trim($classes)));
    }
    if (strpos($column_mode, 'one_col') === 0) {
        $grid[] = 'grid_' . $grid_one;
    }
    if (strpos($column_mode, 'two_col') === 0) {
        $grid[] = 'grid_' . $grid_two;
    }
    if (strpos($column_mode, 'three_col') === 0) {
        $grid[] = 'grid_' . $grid_three;
    }
    if ($alpha) {
        if (is_rtl()) {
            $grid[] = 'alpha-rtl';
        } else {
            $grid[] = 'alpha';
        }
    }
    if ($omega) {
        if (is_rtl()) {
            $grid[] = 'omega-rtl';
        } else {
            $grid[] = 'omega';
        }
    }
    return apply_filters('graphene_grid', $grid, $classes, $grid_one, $grid_two, $grid_three, $alpha, $omega);
}
Beispiel #2
0
do_action('graphene_top_menu');
?>

    </div>

    <?php 
do_action('graphene_before_content');
?>

    <div id="content" class="clearfix hfeed">
        <?php 
do_action('graphene_before_content-main');
?>
        
        <?php 
/* Sidebar2 on the left side? */
if (in_array(graphene_column_mode(), array('three_col_right', 'three_col_center', 'two_col_right'))) {
    get_sidebar('two');
}
/* Sidebar1 on the left side? */
if (in_array(graphene_column_mode(), array('three_col_right'))) {
    get_sidebar();
}
?>
        
        <div id="content-main" <?php 
graphene_grid('clearfix', 16, 11, 8);
?>
>
        <?php 
do_action('graphene_top_content');
Beispiel #3
0
 */
global $graphene_settings;
?>
  
<?php 
do_action('graphene_bottom_content');
?>
    </div><!-- #content-main -->
    
    <?php 
/* Sidebar 2 on the right side? */
if (graphene_column_mode() == 'three_col_left') {
    get_sidebar('two');
}
/* Sidebar 1 on the right side? */
if (in_array(graphene_column_mode(), array('two_col_left', 'three_col_left', 'three_col_center'))) {
    get_sidebar();
}
?>
    
    <?php 
do_action('graphene_after_content');
?>

</div><!-- #content -->

<?php 
/* Get the footer widget area */
get_template_part('sidebar', 'footer');
?>
Beispiel #4
0
 /**
  * Sets up theme defaults and registers support for various WordPress features.
  *
  * Note that this function is hooked into the after_setup_theme hook, which runs
  * before the init hook. The init hook is too late for some features, such as indicating
  * support post thumbnails.
  */
 function graphene_setup()
 {
     global $graphene_settings, $graphene_defaults;
     // Add custom image sizes selectively
     if ($graphene_settings['slider_display_style'] == 'bgimage-excerpt') {
         $height = $graphene_settings['slider_height'] ? $graphene_settings['slider_height'] : 240;
         $frontpage_id = get_option('show_on_front') == 'posts' ? NULL : get_option('page_on_front');
         if ($graphene_settings['slider_full_width']) {
             $slider_width = graphene_grid_width('', 16);
         } else {
             $column_mode = graphene_column_mode($frontpage_id);
             if (strpos($column_mode, 'two_col') === 0) {
                 $column_mode = 'two_col';
             } elseif (strpos($column_mode, 'three_col') === 0) {
                 $column_mode = 'three_col';
             } else {
                 $column_mode = NULL;
             }
             if ($column_mode) {
                 $slider_width = $graphene_settings['column_width'][$column_mode]['content'];
             } else {
                 $slider_width = graphene_grid_width('', 16, 11, 8, $frontpage_id);
             }
         }
         add_image_size('graphene_slider', apply_filters('graphene_slider_image_width', $slider_width), $height, true);
     }
     if (get_option('show_on_front') == 'page' && !$graphene_settings['disable_homepage_panes']) {
         $pane_width = graphene_grid_width('', 8, 6, 4);
         add_image_size('graphene-homepage-pane', apply_filters('graphene_homepage_pane_image_width', $pane_width), apply_filters('graphene_homepage_pane_image_height', floor($pane_width * 0.5)), true);
     }
     // Add support for editor syling
     if (!$graphene_settings['disable_editor_style']) {
         global $content_width;
         add_editor_style(array('editor-style.css', 'http://fonts.googleapis.com/css?family=Pontano+Sans'));
     }
     // Add default posts and comments RSS feed links to head
     add_theme_support('automatic-feed-links');
     // Add support for post thumbnail / featured image
     add_theme_support('post-thumbnails');
     // Add supported post formats
     add_theme_support('post-formats', array('status', 'link', 'audio', 'image', 'video'));
     // Make theme available for translation
     load_theme_textdomain('graphene', get_template_directory() . '/languages');
     // Register the custom menu locations
     register_nav_menus(array('Header Menu' => __('Header Menu', 'graphene'), 'secondary-menu' => __('Secondary Menu', 'graphene'), 'footer-menu' => __('Footer Menu', 'graphene')));
     // Add support for custom background
     global $wp_version;
     add_theme_support('custom-background');
     /* Add support for custom header */
     define('HEADER_TEXTCOLOR', apply_filters('graphene_header_textcolor', '000000'));
     define('HEADER_IMAGE', apply_filters('graphene_default_header_image', '%s/images/headers/flow.jpg'));
     define('HEADER_IMAGE_WIDTH', apply_filters('graphene_header_image_width', graphene_grid_width($graphene_settings['gutter_width'] * 2, 16)));
     define('HEADER_IMAGE_HEIGHT', apply_filters('graphene_header_image_height', $graphene_settings['header_img_height']));
     define('NO_HEADER_TEXT', !apply_filters('graphene_header_text', true));
     $args = array('width' => HEADER_IMAGE_WIDTH, 'height' => HEADER_IMAGE_HEIGHT, 'default-image' => HEADER_IMAGE, 'header-text' => !NO_HEADER_TEXT, 'default-text-color' => HEADER_TEXTCOLOR, 'wp-head-callback' => '', 'admin-head-callback' => 'graphene_admin_header_style');
     $args = apply_filters('graphene_custom_header_args', $args);
     add_theme_support('custom-header', $args);
     set_post_thumbnail_size($args['width'], $args['height'], true);
     // Register default custom headers packaged with the theme. %s is a placeholder for the theme template directory URI.
     register_default_headers(graphene_get_default_headers());
     do_action('graphene_setup');
 }
Beispiel #5
0
/**
 * Build and return the CSS styles custom column width
 *
 * @package Graphene
 * @since 1.6
 * @return string $style CSS styles
*/
function graphene_get_custom_column_width()
{
    global $graphene_settings, $graphene_defaults;
    $column_mode = graphene_column_mode();
    $container = $graphene_settings['container_width'];
    $grid = $graphene_settings['grid_width'];
    $gutter = $graphene_settings['gutter_width'];
    $style = '';
    /* Custom container width */
    if ($container != $graphene_defaults['container_width']) {
        $style .= ".container_16 {width:{$container}px}";
        for ($i = 1; $i <= 16; $i++) {
            /* Grid */
            $style .= '.container_16 .grid_' . $i . '{width:';
            $style .= $grid * $i + $gutter * ($i * 2 - 2);
            $style .= 'px}';
            /* Prefix */
            $style .= '.container_16 .prefix_' . $i . '{padding-left:';
            $style .= $grid * $i + $gutter * ($i * 2);
            $style .= 'px}';
            /* Suffix */
            $style .= '.container_16 .suffix_' . $i . '{padding-right:';
            $style .= $grid * $i + $gutter * ($i * 2);
            $style .= 'px}';
            /* Push */
            $style .= '.container_16 .push_' . $i . '{left:';
            $style .= $grid * $i + $gutter * ($i * 2);
            $style .= 'px}';
            /* Pull */
            $style .= '.container_16 .pull_' . $i . '{left:-';
            $style .= $grid * $i + $gutter * ($i * 2);
            $style .= 'px}';
        }
        /* Header image positioning */
        $style .= '.header-img {margin-left: -' . $container / 2 . 'px;}';
    }
    /* Custom column width - one-column mode */
    if (strpos($column_mode, 'one_col') === 0 && $container != $graphene_defaults['container_width']) {
        $content = $container - $gutter * 2;
        $style .= '.one-column .comment-form-author, .one-column .comment-form-email, .one-column .comment-form-url {width:' . ($content - $gutter * 6) / 3 . 'px}';
        $style .= '.one-column .graphene-form-field {width:' . (($content - $gutter * 6) / 3 - 8) . 'px}';
        $style .= '.one-column #commentform textarea {width:' . ($content - $gutter * 2 - 8) . 'px}';
    }
    /* Custom column width - two-column mode */
    $content = $graphene_settings['column_width']['two_col']['content'];
    $content_default = $graphene_defaults['column_width']['two_col']['content'];
    if (strpos($column_mode, 'two_col') === 0 && $content != $content_default) {
        $sidebar = $graphene_settings['column_width']['two_col']['sidebar'];
        $style .= '#content-main, #content-main .grid_11, .container_16 .slider_post, #comments #respond {width:' . $content . 'px}';
        $style .= '#sidebar1, #sidebar2 {width:' . $sidebar . 'px}';
        $style .= '.comment-form-author, .comment-form-email, .comment-form-url {width:' . ($content - $gutter * 6) / 3 . 'px}';
        $style .= '.graphene-form-field {width:' . (($content - $gutter * 6) / 3 - 8) . 'px}';
        $style .= '#commentform textarea {width:' . ($content - $gutter * 2 - 8) . 'px}';
    }
    /* Custom column width - three-column mode */
    $content = $graphene_settings['column_width']['three_col']['content'];
    $sidebar_left = $graphene_settings['column_width']['three_col']['sidebar_left'];
    $sidebar_right = $graphene_settings['column_width']['three_col']['sidebar_right'];
    $content_default = $graphene_defaults['column_width']['three_col']['content'];
    $sidebar_left_default = $graphene_defaults['column_width']['three_col']['sidebar_left'];
    $sidebar_right_default = $graphene_defaults['column_width']['three_col']['sidebar_right'];
    if (strpos($column_mode, 'three_col') === 0 && ($content != $content_default || $sidebar_left != $sidebar_left_default || $sidebar_right != $sidebar_right_default)) {
        $style .= '#content-main, #content-main .grid_8, .container_16 .slider_post, #comments #respond {width:' . $content . 'px}';
        $style .= '#sidebar1 {width:' . $sidebar_right . 'px}';
        $style .= '#sidebar2 {width:' . $sidebar_left . 'px}';
        $style .= '.three-columns .comment-form-author, .three-columns .comment-form-email, .three-columns .comment-form-url {width:' . ($content - $gutter * 6) / 3 . 'px}';
        $style .= '.three-columns .graphene-form-field {width:' . (($content - $gutter * 6) / 3 - 8) . 'px}';
        $style .= '.three-columns #commentform textarea {width:' . ($content - $gutter * 2 - 8) . 'px}';
    }
    return apply_filters('graphene_custom_column_width_style', $style);
}