Skip to content

Commit

Permalink
Merge pull request #95 from MachoThemes/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
Robciuc Ioan committed Mar 11, 2016
2 parents a896a01 + 0a81aab commit 28b1744
Show file tree
Hide file tree
Showing 9 changed files with 163 additions and 102 deletions.
4 changes: 1 addition & 3 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,7 @@ function decode_setup() {
*/

function decode_content_width() {
$width = get_theme_mod( 'content_width', 792 );

$GLOBALS['content_width'] = apply_filters( 'decode_content_width', $width );
$GLOBALS['content_width'] = apply_filters( 'decode_content_width', 792 );
}
add_action( 'after_setup_theme', 'decode_content_width', 0 );

Expand Down
8 changes: 2 additions & 6 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<?php if ( ! ( function_exists( 'wp_site_icon' ) && has_site_icon() ) ) {
echo '<link rel="icon" href="' . esc_url( get_theme_mod( 'favicon_image', '' ) ) . '">' . "\n" .
'<link rel="apple-touch-icon-precomposed" href="' . esc_url( get_theme_mod( 'favicon_image', '' ) ) . '">' . "\n";
} ?>
<?php if ( get_background_image() ) { echo '<link rel="prefetch" href="' . get_background_image() . '">'; } ?>

<?php tha_head_bottom(); ?>
Expand Down Expand Up @@ -78,9 +74,9 @@

<?php if ( get_theme_mod( 'show_site_description', true ) == true ) : ?>
<?php if ( get_theme_mod( 'html_description', '' ) !== '' ) : ?>
<h2 class="site-description"><?php echo get_theme_mod( 'html_description' ); ?></h2>
<h2 class="site-description"><?php echo decode_sanitize_html( get_theme_mod( 'html_description' ) ); ?></h2>
<?php elseif ( get_theme_mod( 'html_description', '' ) == '' ) : ?>
<h2 class="site-description"><?php echo get_bloginfo( 'description' );?></h2>
<h2 class="site-description"><?php echo esc_html( get_bloginfo( 'description' ) );?></h2>
<?php endif; ?>
<?php endif; ?>

Expand Down
172 changes: 94 additions & 78 deletions inc/customizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ public function render_content() {
<?php
}
}

/**
* Adds a favicon image uploader control that only allows .ico and .png files to be uploaded.
*/
class Decode_Customize_Favicon_Image_Control extends WP_Customize_Image_Control {
public $extensions = array( 'png', 'ico', 'image/x-icon' );
}

/**
* Slider Control
Expand Down Expand Up @@ -187,8 +180,8 @@ class Decode_Customize {
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
public static function decode_customize_register( $wp_customize ) {
$wp_customize->get_setting( 'blogname' ) ->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' ) ->transport = 'postMessage';
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
$wp_customize->get_setting( 'background_color' )->transport = 'postMessage';
$wp_customize->get_setting( 'header_image' )->transport = 'postMessage';
Expand All @@ -207,6 +200,7 @@ public static function decode_customize_register( $wp_customize ) {
remove_theme_mod( 'steam_user' );
remove_theme_mod( 'steam_group' );
remove_theme_mod( 'show_all_post_types' );
remove_theme_mod( 'favicon_image' );
$wp_customize->remove_setting( 'youtube_username' );
$wp_customize->remove_setting( 'show_site_navigation' );
$wp_customize->remove_setting( 'show_social_icons' );
Expand All @@ -215,6 +209,7 @@ public static function decode_customize_register( $wp_customize ) {
$wp_customize->remove_setting( 'steam_user' );
$wp_customize->remove_setting( 'steam_group' );
$wp_customize->remove_setting( 'show_all_post_types' );
$wp_customize->remove_setting( 'favicon_image' );

/**
* Header Options
Expand All @@ -224,12 +219,6 @@ public static function decode_customize_register( $wp_customize ) {
'title' => __( 'Header Options', 'decode' ),
'priority' => 32,
) );


$wp_customize->add_setting( 'favicon_image', array(
'default' => '',
'sanitize_callback' => 'decode_sanitize_string',
) );

$wp_customize->add_setting( 'show_site_title', array(
'default' => true,
Expand All @@ -254,16 +243,6 @@ public static function decode_customize_register( $wp_customize ) {
'transport' => 'postMessage',
'sanitize_callback' => 'decode_sanitize_html',
) );


$wp_customize->add_control(
new Decode_Customize_Favicon_Image_Control(
$wp_customize, 'favicon_image', array(
'label' => __( 'Favicon Image (must be a PNG)', 'decode' ),
'section' => 'decode_header_options',
'settings' => 'favicon_image',
'priority' => 1,
) ) );

$wp_customize->add_control( 'show_site_title', array(
'label' => __( 'Show Site Title', 'decode' ),
Expand All @@ -280,7 +259,7 @@ public static function decode_customize_register( $wp_customize ) {
) );

$wp_customize->add_control( 'show_header_menu', array(
'label' => __( 'Show Header Menu', 'decode' ),
'label' => __( 'Show Navigation Menu', 'decode' ),
'section' => 'decode_header_options',
'type' => 'checkbox',
'priority' => 4,
Expand Down Expand Up @@ -1269,16 +1248,36 @@ public static function decode_customize_register( $wp_customize ) {
) );


/**
* Reading Options
*/
/**
* Content Options
*/
$wp_customize->add_panel( 'decode_content_options_panel', array(
'priority' => 37,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => esc_html__( 'Content Options', 'decode' )
) );

$wp_customize->add_section( 'decode_content_options', array(
'title' => __( 'Content Options', 'decode' ),
'priority' => 37,
'description' => sprintf( _x( 'These options change the display of %s\'s content', '(blog name)\'s content.' ,'decode' ), get_bloginfo( 'name', 'display' ) ),
) );

// General
$wp_customize->add_section( 'decode_content_options_general', array(
'title' => __( 'General', 'decode' ),
'priority' => 1,
'panel' => 'decode_content_options_panel'
) );

// Content
$wp_customize->add_section( 'decode_content_options_content', array(
'title' => __( 'Content', 'decode' ),
'priority' => 2,
'panel' => 'decode_content_options_panel'
) );

// Content Single
$wp_customize->add_section( 'decode_content_options_content_single', array(
'title' => __( 'Content Single', 'decode' ),
'priority' => 3,
'panel' => 'decode_content_options_panel'
) );

$wp_customize->add_setting( 'latin_extended_font', array(
'default' => false,
Expand Down Expand Up @@ -1363,8 +1362,9 @@ public static function decode_customize_register( $wp_customize ) {
) );

$wp_customize->add_setting( 'content_width', array(
'default' => 792,
'sanitize_callback' => 'absint'
'default' => 41.619,
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
) );

$wp_customize->add_setting( 'site_colophon', array(
Expand All @@ -1376,141 +1376,142 @@ public static function decode_customize_register( $wp_customize ) {

$wp_customize->add_control( 'latin_extended_font', array(
'label' => __( 'Load Latin Extended character set. This will increase page load times.', 'decode' ),
'section' => 'decode_content_options',
'section' => 'decode_content_options_general',
'type' => 'checkbox',
'priority' => 1,
) );

$wp_customize->add_control( 'use_excerpts', array(
'label' => __( 'Use entry excerpts instead of full text on site home. Excludes sticky posts.', 'decode' ),
'section' => 'decode_content_options',
'section' => 'decode_content_options_content',
'type' => 'checkbox',
'priority' => 2,
'priority' => 1,
) );

$wp_customize->add_control( 'use_excerpts_on_archives', array(
'label' => __( 'Use entry excerpts on archive, category, and author pages.', 'decode' ),
'section' => 'decode_content_options',
'section' => 'decode_content_options_content',
'type' => 'checkbox',
'priority' => 3,
'priority' => 2,
) );

$wp_customize->add_control( 'show_featured_images_on_excerpts', array(
'label' => __( 'Display posts\' featured images when excerpts are shown.', 'decode' ),
'section' => 'decode_content_options',
'section' => 'decode_content_options_content',
'type' => 'checkbox',
'priority' => 4,
'priority' => 3,
) );

$wp_customize->add_control( 'show_featured_images_on_singles', array(
'label' => __( 'Display a post\'s featured image on its individual page.', 'decode' ),
'section' => 'decode_content_options',
'section' => 'decode_content_options_content_single',
'type' => 'checkbox',
'priority' => 5,
'priority' => 1,
) );

$wp_customize->add_control( 'show_tags', array(
'label' => __( 'Show tags on front page (tags will be shown on post\'s individual page)', 'decode' ),
'section' => 'decode_content_options',
'section' => 'decode_content_options_content',
'type' => 'checkbox',
'priority' => 6,
'priority' => 4,
) );

$wp_customize->add_control( 'show_categories', array(
'label' => __( 'Show categories on front page (categories will be shown on post\'s individual page)', 'decode' ),
'section' => 'decode_content_options',
'section' => 'decode_content_options_content',
'type' => 'checkbox',
'priority' => 7,
'priority' => 5,
) );

$wp_customize->add_control( 'show_author_section', array(
'label' => __( 'Show author\'s name, profile image, and bio after posts', 'decode' ),
'section' => 'decode_content_options',
'section' => 'decode_content_options_content_single',
'type' => 'checkbox',
'priority' => 8,
'priority' => 2,
) );

$wp_customize->add_control( 'show_leave_a_comment_link', array(
'label' => __( 'Show "Leave a comment" link after posts.', 'decode' ),
'section' => 'decode_content_options',
'section' => 'decode_content_options_content_single',
'type' => 'checkbox',
'priority' => 9,
'priority' => 3,
) );

$wp_customize->add_control( 'entry_date_position', array(
'label' => __( 'Entry Date Position', 'decode' ),
'section' => 'decode_content_options',
'section' => 'decode_content_options_general',
'type' => 'radio',
'choices' => array(
'above' => __( 'Above Header', 'decode' ),
'below' => __( 'Below Header', 'decode' ),
),
'priority' => 10,
'priority' => 2,
) );

$wp_customize->add_control( 'show_entry_date_on_excerpts', array(
'label' => __( 'Show entry date for post excepts on the main page', 'decode' ),
'section' => 'decode_content_options',
'section' => 'decode_content_options_content',
'type' => 'checkbox',
'priority' => 11,
'priority' => 6,
) );

$wp_customize->add_control( 'show_allowed_tags', array(
'label' => __( 'Show allowed HTML tags on comment form', 'decode' ),
'section' => 'decode_content_options',
'section' => 'decode_content_options_content_single',
'type' => 'checkbox',
'priority' => 12,
'priority' => 4,
) );

$wp_customize->add_control( 'show_page_headers', array(
'label' => __( 'Show Page Headers', 'decode' ),
'section' => 'decode_content_options',
'section' => 'decode_content_options_general',
'type' => 'checkbox',
'priority' => 13,
'priority' => 3,
) );

$wp_customize->add_control( 'link_post_title_arrow', array(
'label' => __( 'Add an arrow before the title of a link post', 'decode' ),
'section' => 'decode_content_options',
'section' => 'decode_content_options_general',
'type' => 'checkbox',
'priority' => 14,
'priority' => 4,
) );

$wp_customize->add_control( 'show_theme_info', array(
'label' => __( 'Show Theme Info (display a line of text about the theme and its creator at the bottom of pages)', 'decode' ),
'section' => 'decode_content_options',
'section' => 'decode_content_options_general',
'type' => 'checkbox',
'priority' => 15,
'priority' => 5,
) );

$wp_customize->add_control( 'center_content_mobile', array(
'label' => __( 'Center the content on mobile.', 'decode' ),
'section' => 'decode_content_options',
'section' => 'decode_content_options_general',
'type' => 'checkbox',
'priority' => 16,
'priority' => 6,
) );

$wp_customize->add_control(
new Decode_Customize_Slider_Control(
$wp_customize, 'content_width', array(
'label' => esc_html__( 'Content Width', 'decode' ),
'description' => esc_html__( 'Select the content width in percentage.', 'decode' ),
'choices' => array(
'min' => 640,
'max' => 792,
'step' => 1
'min' => 41.619,
'max' => 80,
'step' => 0.001
),
'section' => 'decode_content_options',
'priority' => 17,
'section' => 'decode_content_options_general',
'priority' => 7,
) ) );

$wp_customize->add_control(
new Decode_Customize_Textarea_Control(
$wp_customize, 'site_colophon', array(
'label' => __( 'Text (colophon, copyright, credits, etc.) for the footer of the site', 'decode' ),
'section' => 'decode_content_options',
'section' => 'decode_content_options_general',
'settings' => 'site_colophon',
'type' => 'textarea',
'priority' => 18,
'priority' => 8,
) ) );


Expand All @@ -1521,7 +1522,6 @@ public static function decode_customize_register( $wp_customize ) {

$wp_customize->add_section( 'decode_other_options', array(
'title' => __( 'Other Options', 'decode' ),
'description' => __( 'Custom CSS is longer recommended. This feature may be removed in a future update. To continue using your tweaks, copy and paste your CSS into a custom CSS plugin such as <a href="http://jetpack.me/install/">Jetpack</a>. Get help <a href="http://jetpack.me/support/custom-css/">here</a>.', 'decode' ),
'priority' => 38,
) );

Expand Down Expand Up @@ -1645,7 +1645,8 @@ public static function decode_output_color_css() {
?>
<!-- Decode Custom Colors CSS -->
<style type="text/css">
<?php self::generate_css(
<?php
self::generate_css(
'body, .sidebar, .sidebar-top, .menu ul ul, .header-style-ghost .site',
'background-color',
'background_color',
Expand Down Expand Up @@ -1763,8 +1764,23 @@ public static function decode_output_color_css() {
'border-color',
'accent_color'
);

?>

@media (min-width: 68.5em) {
.site-main {
max-width: none;
}

<?php
self::generate_css(
'.site-main',
'width',
'content_width',
'',
'%'
);
?>
}
</style>
<?php
}
Expand Down
Loading

0 comments on commit 28b1744

Please sign in to comment.