Skip to content

Commit 28b1744

Browse files
author
Robciuc Ioan
committed
Merge pull request #95 from MachoThemes/development
Development
2 parents a896a01 + 0a81aab commit 28b1744

File tree

9 files changed

+163
-102
lines changed

9 files changed

+163
-102
lines changed

functions.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,7 @@ function decode_setup() {
124124
*/
125125

126126
function decode_content_width() {
127-
$width = get_theme_mod( 'content_width', 792 );
128-
129-
$GLOBALS['content_width'] = apply_filters( 'decode_content_width', $width );
127+
$GLOBALS['content_width'] = apply_filters( 'decode_content_width', 792 );
130128
}
131129
add_action( 'after_setup_theme', 'decode_content_width', 0 );
132130

header.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717
<meta name="viewport" content="width=device-width, initial-scale=1">
1818
<link rel="profile" href="http://gmpg.org/xfn/11">
1919
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
20-
<?php if ( ! ( function_exists( 'wp_site_icon' ) && has_site_icon() ) ) {
21-
echo '<link rel="icon" href="' . esc_url( get_theme_mod( 'favicon_image', '' ) ) . '">' . "\n" .
22-
'<link rel="apple-touch-icon-precomposed" href="' . esc_url( get_theme_mod( 'favicon_image', '' ) ) . '">' . "\n";
23-
} ?>
2420
<?php if ( get_background_image() ) { echo '<link rel="prefetch" href="' . get_background_image() . '">'; } ?>
2521

2622
<?php tha_head_bottom(); ?>
@@ -78,9 +74,9 @@
7874

7975
<?php if ( get_theme_mod( 'show_site_description', true ) == true ) : ?>
8076
<?php if ( get_theme_mod( 'html_description', '' ) !== '' ) : ?>
81-
<h2 class="site-description"><?php echo get_theme_mod( 'html_description' ); ?></h2>
77+
<h2 class="site-description"><?php echo decode_sanitize_html( get_theme_mod( 'html_description' ) ); ?></h2>
8278
<?php elseif ( get_theme_mod( 'html_description', '' ) == '' ) : ?>
83-
<h2 class="site-description"><?php echo get_bloginfo( 'description' );?></h2>
79+
<h2 class="site-description"><?php echo esc_html( get_bloginfo( 'description' ) );?></h2>
8480
<?php endif; ?>
8581
<?php endif; ?>
8682

inc/customizer.php

Lines changed: 94 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@ public function render_content() {
2121
<?php
2222
}
2323
}
24-
25-
/**
26-
* Adds a favicon image uploader control that only allows .ico and .png files to be uploaded.
27-
*/
28-
class Decode_Customize_Favicon_Image_Control extends WP_Customize_Image_Control {
29-
public $extensions = array( 'png', 'ico', 'image/x-icon' );
30-
}
3124

3225
/**
3326
* Slider Control
@@ -187,8 +180,8 @@ class Decode_Customize {
187180
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
188181
*/
189182
public static function decode_customize_register( $wp_customize ) {
190-
$wp_customize->get_setting( 'blogname' ) ->transport = 'postMessage';
191-
$wp_customize->get_setting( 'blogdescription' ) ->transport = 'postMessage';
183+
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
184+
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
192185
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
193186
$wp_customize->get_setting( 'background_color' )->transport = 'postMessage';
194187
$wp_customize->get_setting( 'header_image' )->transport = 'postMessage';
@@ -207,6 +200,7 @@ public static function decode_customize_register( $wp_customize ) {
207200
remove_theme_mod( 'steam_user' );
208201
remove_theme_mod( 'steam_group' );
209202
remove_theme_mod( 'show_all_post_types' );
203+
remove_theme_mod( 'favicon_image' );
210204
$wp_customize->remove_setting( 'youtube_username' );
211205
$wp_customize->remove_setting( 'show_site_navigation' );
212206
$wp_customize->remove_setting( 'show_social_icons' );
@@ -215,6 +209,7 @@ public static function decode_customize_register( $wp_customize ) {
215209
$wp_customize->remove_setting( 'steam_user' );
216210
$wp_customize->remove_setting( 'steam_group' );
217211
$wp_customize->remove_setting( 'show_all_post_types' );
212+
$wp_customize->remove_setting( 'favicon_image' );
218213

219214
/**
220215
* Header Options
@@ -224,12 +219,6 @@ public static function decode_customize_register( $wp_customize ) {
224219
'title' => __( 'Header Options', 'decode' ),
225220
'priority' => 32,
226221
) );
227-
228-
229-
$wp_customize->add_setting( 'favicon_image', array(
230-
'default' => '',
231-
'sanitize_callback' => 'decode_sanitize_string',
232-
) );
233222

234223
$wp_customize->add_setting( 'show_site_title', array(
235224
'default' => true,
@@ -254,16 +243,6 @@ public static function decode_customize_register( $wp_customize ) {
254243
'transport' => 'postMessage',
255244
'sanitize_callback' => 'decode_sanitize_html',
256245
) );
257-
258-
259-
$wp_customize->add_control(
260-
new Decode_Customize_Favicon_Image_Control(
261-
$wp_customize, 'favicon_image', array(
262-
'label' => __( 'Favicon Image (must be a PNG)', 'decode' ),
263-
'section' => 'decode_header_options',
264-
'settings' => 'favicon_image',
265-
'priority' => 1,
266-
) ) );
267246

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

282261
$wp_customize->add_control( 'show_header_menu', array(
283-
'label' => __( 'Show Header Menu', 'decode' ),
262+
'label' => __( 'Show Navigation Menu', 'decode' ),
284263
'section' => 'decode_header_options',
285264
'type' => 'checkbox',
286265
'priority' => 4,
@@ -1269,16 +1248,36 @@ public static function decode_customize_register( $wp_customize ) {
12691248
) );
12701249

12711250

1272-
/**
1273-
* Reading Options
1274-
*/
1251+
/**
1252+
* Content Options
1253+
*/
1254+
$wp_customize->add_panel( 'decode_content_options_panel', array(
1255+
'priority' => 37,
1256+
'capability' => 'edit_theme_options',
1257+
'theme_supports' => '',
1258+
'title' => esc_html__( 'Content Options', 'decode' )
1259+
) );
12751260

1276-
$wp_customize->add_section( 'decode_content_options', array(
1277-
'title' => __( 'Content Options', 'decode' ),
1278-
'priority' => 37,
1279-
'description' => sprintf( _x( 'These options change the display of %s\'s content', '(blog name)\'s content.' ,'decode' ), get_bloginfo( 'name', 'display' ) ),
1280-
) );
1281-
1261+
// General
1262+
$wp_customize->add_section( 'decode_content_options_general', array(
1263+
'title' => __( 'General', 'decode' ),
1264+
'priority' => 1,
1265+
'panel' => 'decode_content_options_panel'
1266+
) );
1267+
1268+
// Content
1269+
$wp_customize->add_section( 'decode_content_options_content', array(
1270+
'title' => __( 'Content', 'decode' ),
1271+
'priority' => 2,
1272+
'panel' => 'decode_content_options_panel'
1273+
) );
1274+
1275+
// Content Single
1276+
$wp_customize->add_section( 'decode_content_options_content_single', array(
1277+
'title' => __( 'Content Single', 'decode' ),
1278+
'priority' => 3,
1279+
'panel' => 'decode_content_options_panel'
1280+
) );
12821281

12831282
$wp_customize->add_setting( 'latin_extended_font', array(
12841283
'default' => false,
@@ -1363,8 +1362,9 @@ public static function decode_customize_register( $wp_customize ) {
13631362
) );
13641363

13651364
$wp_customize->add_setting( 'content_width', array(
1366-
'default' => 792,
1367-
'sanitize_callback' => 'absint'
1365+
'default' => 41.619,
1366+
'sanitize_callback' => 'absint',
1367+
'transport' => 'postMessage'
13681368
) );
13691369

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

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

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

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

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

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

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

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

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

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

14401440
$wp_customize->add_control( 'entry_date_position', array(
14411441
'label' => __( 'Entry Date Position', 'decode' ),
1442-
'section' => 'decode_content_options',
1442+
'section' => 'decode_content_options_general',
14431443
'type' => 'radio',
14441444
'choices' => array(
14451445
'above' => __( 'Above Header', 'decode' ),
14461446
'below' => __( 'Below Header', 'decode' ),
14471447
),
1448-
'priority' => 10,
1448+
'priority' => 2,
14491449
) );
14501450

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

14581458
$wp_customize->add_control( 'show_allowed_tags', array(
14591459
'label' => __( 'Show allowed HTML tags on comment form', 'decode' ),
1460-
'section' => 'decode_content_options',
1460+
'section' => 'decode_content_options_content_single',
14611461
'type' => 'checkbox',
1462-
'priority' => 12,
1462+
'priority' => 4,
14631463
) );
14641464

14651465
$wp_customize->add_control( 'show_page_headers', array(
14661466
'label' => __( 'Show Page Headers', 'decode' ),
1467-
'section' => 'decode_content_options',
1467+
'section' => 'decode_content_options_general',
14681468
'type' => 'checkbox',
1469-
'priority' => 13,
1469+
'priority' => 3,
14701470
) );
14711471

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

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

14861486
$wp_customize->add_control( 'center_content_mobile', array(
14871487
'label' => __( 'Center the content on mobile.', 'decode' ),
1488-
'section' => 'decode_content_options',
1488+
'section' => 'decode_content_options_general',
14891489
'type' => 'checkbox',
1490-
'priority' => 16,
1490+
'priority' => 6,
14911491
) );
14921492

14931493
$wp_customize->add_control(
14941494
new Decode_Customize_Slider_Control(
14951495
$wp_customize, 'content_width', array(
14961496
'label' => esc_html__( 'Content Width', 'decode' ),
1497+
'description' => esc_html__( 'Select the content width in percentage.', 'decode' ),
14971498
'choices' => array(
1498-
'min' => 640,
1499-
'max' => 792,
1500-
'step' => 1
1499+
'min' => 41.619,
1500+
'max' => 80,
1501+
'step' => 0.001
15011502
),
1502-
'section' => 'decode_content_options',
1503-
'priority' => 17,
1503+
'section' => 'decode_content_options_general',
1504+
'priority' => 7,
15041505
) ) );
15051506

15061507
$wp_customize->add_control(
15071508
new Decode_Customize_Textarea_Control(
15081509
$wp_customize, 'site_colophon', array(
15091510
'label' => __( 'Text (colophon, copyright, credits, etc.) for the footer of the site', 'decode' ),
1510-
'section' => 'decode_content_options',
1511+
'section' => 'decode_content_options_general',
15111512
'settings' => 'site_colophon',
15121513
'type' => 'textarea',
1513-
'priority' => 18,
1514+
'priority' => 8,
15141515
) ) );
15151516

15161517

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

15221523
$wp_customize->add_section( 'decode_other_options', array(
15231524
'title' => __( 'Other Options', 'decode' ),
1524-
'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' ),
15251525
'priority' => 38,
15261526
) );
15271527

@@ -1645,7 +1645,8 @@ public static function decode_output_color_css() {
16451645
?>
16461646
<!-- Decode Custom Colors CSS -->
16471647
<style type="text/css">
1648-
<?php self::generate_css(
1648+
<?php
1649+
self::generate_css(
16491650
'body, .sidebar, .sidebar-top, .menu ul ul, .header-style-ghost .site',
16501651
'background-color',
16511652
'background_color',
@@ -1763,8 +1764,23 @@ public static function decode_output_color_css() {
17631764
'border-color',
17641765
'accent_color'
17651766
);
1766-
17671767
?>
1768+
1769+
@media (min-width: 68.5em) {
1770+
.site-main {
1771+
max-width: none;
1772+
}
1773+
1774+
<?php
1775+
self::generate_css(
1776+
'.site-main',
1777+
'width',
1778+
'content_width',
1779+
'',
1780+
'%'
1781+
);
1782+
?>
1783+
}
17681784
</style>
17691785
<?php
17701786
}

0 commit comments

Comments
 (0)