WordPress.org

Make WordPress Themes


Ignore:
Location:
modernize/1.8.0
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • modernize/1.8.0/functions.php

    r85626 r85626  
    121121add_action( 'widgets_init', 'modernize_widgets_init' ); 
    122122 
     123/** 
     124* Register customize. 
     125*/ 
     126add_action( 'customize_register', 'theme_customize_register' ); 
     127function theme_customize_register($wp_customize) { 
     128  $wp_customize->add_section( 'article_column_section', array( 
     129    'title'          =>'Article Layout', 
     130    'priority'       => 200, 
     131  )); 
     132} 
     133 
    123134/* 
    124135 * Register excerpt length. 
  • modernize/1.8.0/header.php

    r85626 r85626  
    6969    <?php endif; ?> 
    7070 
    71     <div id="content" class="site-content"> 
     71  <?php 
     72        $columns = ' col-' . intval( get_theme_mod( 'article_column_options', '1' ) ); 
     73    ?> 
     74 
     75  <div id="content" class="site-content <?php echo $columns ?>"> 
  • modernize/1.8.0/inc/customizer.php

    r85626 r85626  
    1414 * @param WP_Customize_Manager $wp_customize Theme Customizer object. 
    1515 */ 
     16 
     17function modernize_sanitize_select( $input, $setting ) { 
     18  global $wp_customize; 
     19    $control = $wp_customize->get_control( $setting->id ); 
     20    if ( array_key_exists( $input, $control->choices ) ) { 
     21        return $input; 
     22    } else { 
     23        return $setting->default; 
     24    } 
     25} 
     26 
     27// Columns 
     28function modernize_sanitize_select_columns( $input ) { 
     29    $valid = array( '1', '2' ); 
     30    if ( in_array( $input, $valid, true ) ) { 
     31        return $input; 
     32    } 
     33    return '1'; 
     34} 
     35 
    1636function modernize_customize_register( $wp_customize ) { 
    1737  $wp_customize->get_setting( 'blogname' )->transport         = 'postMessage'; 
    1838  $wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage'; 
    1939  $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; 
     40  $wp_customize->add_setting('article_column_options', array( 
     41    'default'  => 1, 
     42    'sanitize_callback' => 'modernize_sanitize_select_columns', 
     43  )); 
     44  $wp_customize->add_control( 'article_column', array( 
     45    'label' =>'Article Layout', 
     46    'section' => 'article_column_section', 
     47    'settings' => 'article_column_options', 
     48    'type' => 'select', 
     49    'choices' =>  array( 
     50        '1' =>  __( '1 Column', 'modernize' ), 
     51        '2' =>  __( '2 Columns', 'modernize' ), 
     52    ), 
     53  )); 
    2054} 
    2155add_action( 'customize_register', 'modernize_customize_register' ); 
  • modernize/1.8.0/style.css

    r85626 r85626  
    55Author URI: https://profiles.wordpress.org/mismith227 
    66Description: modernize is a modern, simple and beautiful WordPress theme. I made it for blogging. Customizer, social menu icon, several templates, logo addition, switching function between one column and two columns, etc. are also available. 
    7 Version: 1.7.7 
     7Version: 1.8.0 
    88License: GNU General Public License v2 or later 
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html 
Note: See TracChangeset for help on using the changeset viewer.