Permalink
Browse files

Update stel for custom background and als add layout options for leav…

…e sidebar left or right
  • Loading branch information...
1 parent 23073bb commit e2495033a0eff8b247aa766b5f0e008bc00fb05c @bueltge committed Sep 19, 2012
Showing with 57 additions and 4 deletions.
  1. +1 −1 css/style.css
  2. +10 −3 css/style.dev.css
  3. +19 −0 inc/head-style.php
  4. +27 −0 inc/theme-customize.php
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -2,12 +2,11 @@
/**
* Documentation layout
*
- * @version 08/10/2012
+ * @version 09/18/2012
* @author Frank Bültge
*/
body {
-background: #fff;
font-family: 'Lucida Sans Unicode','Lucida Sans', 'Trebuchet MS', 'Lucida Grande', 'Bitstream Sans Vera', Verdana, Arial, Tahoma, Helvetica, Sans-Serif;
font-style: normal;
line-height: 1.5em;
@@ -110,6 +109,10 @@ margin: 2px .1em 5px;
padding: 5px 1em;
line-height: 1.7em;
}
+/* Sidebar on left */
+.sidebar-left #content {
+ float: right;
+}
#content h2 a:link, #content h2 a:visited, #header h1 a:link, #header h1 a:visited {
font-weight: 400;
@@ -192,14 +195,18 @@ padding: 5px;
}
#sidebar {
-background: #fff;
color: #111;
width: 25%;
float: right;
margin: 5px 0;
padding: 5px 0;
}
+/* Sidebar on left */
+.sidebar-left #sidebar {
+ float: left;
+}
+
#sidebar ul {
list-style-type: none;
margin: 2px;
View
@@ -51,6 +51,8 @@ public function __construct( $args = NULL ) {
add_action( 'wp_head', array( $this, 'get_custom_style' ) );
// enqueue the the different color scheme
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_color_scheme' ) );
+ // add class to body tag for layout changes
+ add_filter( 'body_class', array( $this, 'layout_classes' ) );
}
/**
@@ -74,6 +76,23 @@ public function get_custom_style() {
}
/**
+ * Add layout class to the array of body classes.
+ *
+ * @since 09/18/2012
+ * @param array $existing_classes
+ * @return array
+ */
+ public function layout_classes( $existing_classes ) {
+
+ $layout = parent::get_theme_options( 'layout' );
+
+ if ( 'sidebar-left' === $layout )
+ $existing_classes[] = 'sidebar-left';
+
+ return $existing_classes;
+ }
+
+ /**
* Enqueue the color scheme
*
* @since 09/18/2012
View
@@ -48,6 +48,7 @@ public function get_default_theme_options( $value = NULL ) {
$default_theme_options = array(
'echo_desc' => '1',
+ 'layout' => 'sidebar-right',
'rewrite_url' => 'wp-admin/edit.php',
'color_scheme' => 'light',
'text_color' => '#111',
@@ -112,6 +113,32 @@ public function customize_register( $wp_customize ) {
),
) );
+ // ===== Layout Section =====
+ // Option for leave sidebar left or right
+ $wp_customize->add_section( $this->option_key . '_layout', array(
+ 'title' => __( 'Layout', 'documentation' ),
+ 'priority' => 30
+ ) );
+
+ // Add field for radio buttons to set layout
+ $wp_customize->add_setting( $this->option_key . '[layout]', array(
+ 'default' => $defaults['layout'],
+ 'type' => 'option',
+ 'capability' => 'edit_theme_options',
+ ) );
+
+ // Add control and output for select field
+ $wp_customize->add_control( $this->option_key . '_layout', array(
+ 'label' => __( 'Color Scheme', 'documentation' ),
+ 'section' => $this->option_key . '_layout',
+ 'settings' => $this->option_key . '[layout]',
+ 'type' => 'radio',
+ 'choices' => array(
+ 'sidebar-left' => __( 'Sidebar on left', 'documentation' ),
+ 'sidebar-right' => __( 'Sidebar on right', 'documentation' )
+ ),
+ ) );
+
// ===== Custom Section =====
// create custom section for rewrite url
$wp_customize->add_section( $this->option_key . '_rewrite_url', array(

0 comments on commit e249503

Please sign in to comment.