Initial commit.

This commit is contained in:
Frank419
2024-08-20 07:44:34 +08:00
commit 942a4c151f
61 changed files with 7781 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
<?php
if (!class_exists('WP_Customize_Image_Control')) {
return null;
}
class MinimalistFlex_Color_Palette_Custom_Control extends WP_Customize_Control
{
public $label;
public $description;
public $suggest_label;
public $suggest_description;
public $suggest_images;
public function enqueue()
{
wp_enqueue_style('color-palette-style', get_template_directory_uri().'/css/color-palette.css');
wp_enqueue_script('color-palette-script', get_template_directory_uri().'/js/color-palette.js', array( 'jquery' ), rand(), true);
}
public function render_content()
{
$theme_uri = get_template_directory_uri();
?>
<span class='customize-control-title'>
<?php echo esc_html( $this->label ) ?>
</span>
<span class='description customize-control-description'>
<?php echo esc_html( $this->description ) ?>
</span>
<div>
<ul class='palettes'>
<li class="palette" style="background-image: url('<?php echo esc_attr( $theme_uri . '/defaults/palette.png' ) ?>')"><button id="minimalistflex-palette-light"><?php echo esc_html_x( 'Light', 'color palette', 'minimalistflex' ) ?></li>
<li class="palette" style="background-image: url('<?php echo esc_attr( $theme_uri . '/defaults/palette2.png' ) ?>')"><button id="minimalistflex-palette-dark"><?php echo esc_html_x( 'Dark', 'color palette', 'minimalistflex' ) ?></li>
<li class="palette" style="background-image: url('<?php echo esc_attr( $theme_uri . '/defaults/palette3.png' ) ?>')"><button id="minimalistflex-palette-galatic"><?php echo esc_html_x( 'Galatic', 'color palette', 'minimalistflex' ) ?></li>
<li class="palette" style="background-image: url('<?php echo esc_attr( $theme_uri . '/defaults/palette4.png' ) ?>')"><button id="minimalistflex-palette-spring"><?php echo esc_html_x( 'Spring', 'color palette', 'minimalistflex' ) ?></li>
</ul>
</div>
<?php
}
}
?>
+61
View File
@@ -0,0 +1,61 @@
<?php
if (!class_exists('WP_Customize_Image_Control')) {
return null;
}
class MinimalistFlex_Multi_Image_Custom_Control extends WP_Customize_Control
{
public $label;
public $description;
public $suggest_label;
public $suggest_description;
public $suggest_images;
public function enqueue()
{
wp_enqueue_media();
wp_enqueue_style('multi-image-style', get_template_directory_uri().'/css/multi-image.css');
wp_enqueue_script('multi-image-script', get_template_directory_uri().'/js/multi-image.js', array( 'jquery' ), rand(), true);
}
public function render_content()
{ ?>
<span class='customize-control-title'>
<?php echo esc_html( $this->label ) ?>
</span>
<span class='description customize-control-description'>
<?php echo esc_html( $this->description ) ?>
</span>
<div>
<ul class='images'></ul>
<div class="placeholder"><?php esc_html_e( 'No image set', 'minimalistflex' ) ?></div>
</div>
<div class='actions'>
<a class="button-secondary upload">
<?php esc_html_e( 'Add Image', 'minimalistflex' ) ?>
</a>
</div>
<input class="wp-editor-area" id="images-input" type="hidden" <?php $this->link(); ?>>
<span class='customize-control-title'>
<?php echo esc_html( $this->suggest_label ) ?>
</span>
<span class='customize-control-description'>
<?php echo esc_html( $this->suggest_description ) ?>
</span>
<div>
<ul class='suggested-images'>
<?php foreach ( $this->suggest_images as $suggest_image ): ?>
<li class="suggested-image-item"><img src="<?php echo esc_attr( get_template_directory_uri() . $suggest_image ) ?>"></li>
<?php endforeach; ?>
</ul>
</div>
<?php
}
}
?>
+67
View File
@@ -0,0 +1,67 @@
<?php
if ( !defined( 'WPINC' ) ) {
die;
}
$colors = Array(
'default' => '#000000',
'level3-dark' => '#666666',
'link' => '#004774',
'link-hover' => '#003663',
'header-bg' => '#ffffff',
'header-text' => '#000000',
'header-menu' => '#f7f7f7',
'header-sidebar' => '#f0f0f0',
'level1' => '#ffffff',
'level2' => '#f7f7f7',
'tint' => '#ffd900',
'tint-dark' => '#c1a400',
'tint-alt' => '#0060c1',
'tint-contrast' => '#00281d',
'contrast' => '#000000',
'contrast-dark' => '#ffffff',
'footer-text' => '#ffffff',
'footer-bg' => '#333333'
);
$labels = Array(
'level1' => __( 'Content Background', 'minimalistflex' ),
'level2' => __( 'Sidebar Background', 'minimalistflex' ),
'level3-dark' => __( 'Secondary Text', 'minimalistflex' ),
'default' => __( 'Default', 'minimalistflex' ),
'link' => __( 'Link', 'minimalistflex' ),
'link-hover' => __( 'Link Hover', 'minimalistflex' ),
'tint' => __( 'Tint A', 'minimalistflex' ),
'tint-dark' => __( 'Tint A Dark', 'minimalistflex' ),
'tint-alt' => __( 'Tint B', 'minimalistflex' ),
'tint-contrast' => __( 'Tint C', 'minimalistflex' ),
'contrast' => __( 'Contrast (Light)', 'minimalistflex' ),
'contrast-dark' => __( 'Contrast (Dark)', 'minimalistflex' ),
'footer-text' => __( 'Footer Text', 'minimalistflex' ),
'footer-bg' => __( 'Footer Background', 'minimalistflex' ),
'header-bg' => __( 'Header Background', 'minimalistflex' ),
'header-menu' => __( 'Navigation Menu Background', 'minimalistflex' ),
'header-sidebar' => __( 'Navigation Menu Sidebar Background', 'minimalistflex' ),
'header-text' => __( 'Navigation Menu', 'minimalistflex' )
);
$desciprtions = Array(
'level1' => __( 'The background color of the main content area.', 'minimalistflex' ),
'level2' => __( 'The background color of the sidebar.', 'minimalistflex' ),
'level3-dark' => __( 'The secondary text color. Should be lighter than the default color.', 'minimalistflex' ),
'default' => __( 'The default text color.', 'minimalistflex' ),
'link' => __( 'The link color.', 'minimalistflex' ),
'link-hover' => __( 'The link color when hovered.', 'minimalistflex' ),
'tint' => __( 'Tint color A. Should be a light color.', 'minimalistflex' ),
'tint-dark' => __( 'A darker variant of the tint color A. Only used on the scroll bars.', 'minimalistflex' ),
'tint-alt' => __( 'Tint color B. Should be a dark color.', 'minimalistflex' ),
'tint-contrast' => __( 'Tint color C. Should be a *even darker* color.', 'minimalistflex' ),
'contrast' => __( 'Text color on a light background. Better keep it as is.', 'minimalistflex' ),
'contrast-dark' => __( 'Text color on a dark background. Better keep it as is.', 'minimalistflex' ),
'footer-text' => __( 'The footer text color.', 'minimalistflex' ),
'footer-bg' => __( 'The footer background color.', 'minimalistflex' ),
'header-bg' => __( 'The background color of the header.', 'minimalistflex' ),
'header-menu' => __( 'The background color of the navigation menu dropdown.', 'minimalistflex' ),
'header-sidebar' => __( 'The background color of the sidebar of the navigation menu dropdown.', 'minimalistflex' ),
'header-text' => __( 'The text color of the navigation menu dropdown.', 'minimalistflex' )
);
+43
View File
@@ -0,0 +1,43 @@
<?php
if ( !defined( 'WPINC' ) ) {
die;
}
?>
<?php
require_once 'color-definitions.php';
global $colors;
?>
<style>
:root {
--minimalistflex-header: <?php
$header_textcolor = get_header_textcolor();
if ( preg_match( '/#/', $header_textcolor ) ) {
echo $header_textcolor;
} else {
echo '#' . $header_textcolor;
}
?>;
<?php $color_keys = array_keys( $colors ); ?>
<?php foreach( $color_keys as $color_key ): ?>
--minimalistflex-<?php echo $color_key; ?>: <?php echo esc_html( get_theme_mod( 'minimalistflex_color_' . $color_key, $colors[$color_key] ) ); ?>;
<?php endforeach; ?>
--minimalistflex-max-height: <?php
if ( get_theme_mod( 'minimalistflex_interface_thumbnail_height', 'flexible' ) === 'fixed' ) {
echo esc_html( get_theme_mod( 'minimalistflex_interface_thumbnail_height_px', 300 ) ) . 'px;';
} else {
echo esc_html( 'auto;' );
}
?>
<?php if ( get_theme_mod( 'minimalistflex_color_disable_shadow', 'no' ) == 'yes' ): ?>
--minimalistflex-shadow: transparent;
--minimalistflex-shadow-light: transparent;
<?php else: ?>
--minimalistflex-shadow: rgba(0, 0, 0, 0.19);
--minimalistflex-shadow-light: rgba(200, 200, 200, 0.19);
<?php endif; ?>
}
</style>
+838
View File
@@ -0,0 +1,838 @@
<?php
if ( !defined( 'WPINC' ) ) {
die;
}
require_once 'color-definitions.php';
require_once 'sanitize-callbacks.php';
function minimalistflex_customizer_enqueue_scripts() {
wp_enqueue_script( 'minimalistflex_color_palette', get_template_directory_uri() . '/js/color-palette.js', Array( 'jquery' ), null, true );
}
add_action( 'customize_controls_enqueue_scripts', 'minimalistflex_customizer_enqueue_scripts' );
function minimalistflex_default_featured_image_register( $wp_customize ) {
require_once 'class-multi-image-control.php';
$wp_customize -> add_section( 'minimalistflex_default_featured_image', Array(
'title' => __( 'Default Featured Images', 'minimalistflex' ),
'description' => __( 'The theme can provide the following images as a fallback when there\'s no featured image set for a post. You can also select where to display those images.', 'minimalistflex' ),
'priority' => 50,
'capability' => 'edit_theme_options'
) );
$wp_customize -> add_setting( 'minimalistflex_default_featured_images', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh'
) );
$wp_customize -> add_setting( 'minimalistflex_default_featured_images_location', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'archive',
'sanitize_callback' => 'minimalistflex_sanitize_radio_cb'
) );
$wp_customize -> add_setting( 'minimalistflex_default_featured_images_first_image', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'yes',
'sanitize_callback' => 'minimalistflex_sanitize_radio_cb'
) );
$wp_customize -> add_control( new MinimalistFlex_Multi_Image_Custom_Control( $wp_customize, 'minimalistflex_default_featured_images', Array(
'label' => __( 'Default Images', 'minimalistflex' ),
'description' => __( 'Click on "Add Image" to add an image. Click on the image to remove it. There\'s no limit on how many images you can add.', 'minimalistflex' ),
'priority' => 20,
'section' => 'minimalistflex_default_featured_image',
'suggest_label' => __( 'Suggested Images', 'minimalistflex' ),
'suggest_description' => __( 'We have prepared some pre-built, generic purpose images for you to choose from. Click on an image will add it into the selection.', 'minimalistflex' ),
'suggest_images' => Array( '/defaults/1.png', '/defaults/2.png', '/defaults/3.png', '/defaults/4.png', '/defaults/5.png', '/defaults/6.png' )
) ) );
$wp_customize -> add_control( 'minimalistflex_default_featured_images_location', Array(
'label' => __( 'Location', 'minimalistflex' ),
'description' => __( 'You may decide if and where should the default image show.', 'minimalistflex' ),
'type' => 'radio',
'priority' => 10,
'section' => 'minimalistflex_default_featured_image',
'choices' => Array(
'both' => __( 'Always', 'minimalistflex' ),
'archive' => __( 'Archive Page Only', 'minimalistflex' ),
'single' => __( 'Single Page Only', 'minimalistflex' ),
'no' => __( 'Never', 'minimalistflex' )
)
) );
$wp_customize -> add_control( 'minimalistflex_default_featured_images_first_image', Array(
'label' => __( 'Display First Image', 'minimalistflex' ),
'description' => __( 'The theme can also retrieve the first image in a post if possible. When no image was found, the theme can fallback to the default images set below.', 'minimalistflex' ),
'type' => 'radio',
'priority' => 15,
'section' => 'minimalistflex_default_featured_image',
'choices' => Array(
'yes' => __( 'Yes', 'minimalistflex' ),
'no' => __( 'No', 'minimalistflex' ),
)
) );
}
add_action( 'customize_register', 'minimalistflex_default_featured_image_register' );
function minimalistflex_customize_color_register( $wp_customize ) {
require_once 'class-color-palette-control.php';
$wp_customize -> add_setting( 'minimalistflex_color_placeholder', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options'
) );
$wp_customize -> add_control( new MinimalistFlex_Color_Palette_Custom_Control( $wp_customize, 'minimalistflex_color_placeholder', Array(
'priority' => 1,
'label' => __( 'Color Palettes', 'minimalistflex' ),
'description' => __( 'We had prepared some fine tuned color palettes for you. Select an option and it will automatically apply the palette to your site.', 'minimalistflex' ),
'section' => 'colors'
) ) );
global $colors;
global $labels;
global $desciprtions;
$color_keys = array_keys( $colors );
foreach( $color_keys as $color_key ) {
$wp_customize -> add_setting( 'minimalistflex_color_' . $color_key, Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => $colors[$color_key],
'sanitize_callback' => 'minimalistflex_sanitize_color_cb'
) );
$wp_customize -> add_control( new WP_Customize_Color_Control( $wp_customize, 'minimalistflex_color_' . $color_key, Array(
'label' => $labels[$color_key],
'description' => $desciprtions[$color_key],
'section' => 'colors'
) ) );
};
$wp_customize -> add_setting( 'minimalistflex_color_disable_shadow', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'no',
'sanitize_callback' => 'minimalistflex_sanitize_radio_cb'
) );
$wp_customize -> add_control( 'minimalistflex_color_disable_shadow', Array(
'type' => 'radio',
'label' => __( 'Disable Shadows', 'minimalistflex' ),
'description' => __( 'This option lets you disable the shadow on the site. It should only affect the shadow created by the theme.', 'minimalistflex' ),
'priority' => 2,
'section' => 'colors',
'choices' => Array(
'yes' => __( 'Yes', 'minimalistflex' ),
'no' => __( 'No', 'minimalistflex' )
)
) );
$wp_customize -> get_control( 'background_color' ) -> description = __( 'The default background setting from the WordPress core. If set, it will blend with the content &amp; sidebar background colors set below.', 'minimalistflex' );
$wp_customize -> get_control( 'header_textcolor' ) -> description = __( 'The default header text setting from the WordPress core. Used on the header and the toggle button.', 'minimalistflex' );
}
$metadatas = Array(
/* translators: This line is special. The part before <br> is the description of the section, while the rest is the option name.*/
'description' => __( 'Below are some metadatas that you may configure whether to display or not.<br>Description', 'minimalistflex' ),
'user_registered' => __( 'Registration time', 'minimalistflex' ),
'user_url' => __( 'Website', 'minimalistflex' ),
'user_email' => __( 'Email address', 'minimalistflex' )
);
function minimalistflex_customize_author_elements_register( $wp_customize ) {
global $metadatas;
$metadata_keys = array_keys( $metadatas );
foreach( $metadata_keys as $metadata_key ) {
$wp_customize -> add_setting( 'minimalistflex_layout_author_elements_' . $metadata_key, Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'yes',
'sanitize_callback' => 'minimalistflex_sanitize_radio_cb'
) );
if ( $metadata_key == 'description' ) {
$wp_customize -> add_control( 'minimalistflex_layout_author_elements_' . $metadata_key, Array(
'type' => 'radio',
'priority' => 45,
'capability' => 'edit_theme_options',
'label' => __( 'Metadatas', 'minimalistflex' ),
'description' => $metadatas[$metadata_key],
'section' => 'minimalistflex_layout_author',
'choices' => Array(
'yes' => __( 'Yes', 'minimalistflex' ),
'no' => __( 'No', 'minimalistflex' )
)
) );
} else {
$wp_customize -> add_control( 'minimalistflex_layout_author_elements_' . $metadata_key, Array(
'type' => 'radio',
'priority' => 50,
'capability' => 'edit_theme_options',
'description' => $metadatas[$metadata_key],
'section' => 'minimalistflex_layout_author',
'choices' => Array(
'yes' => __( 'Yes', 'minimalistflex' ),
'no' => __( 'No', 'minimalistflex' )
)
) );
}
}
}
function minimalistflex_customize_register( $wp_customize ) {
// Start adding panels.
$wp_customize -> add_panel( 'minimalistflex_layout', Array(
'title' => _x( 'Layout', 'customizer panel' , 'minimalistflex' ),
'description' => __( 'Here you may configure how different pages on your site looks like.', 'minimalistflex' ),
'priority' => 70,
'capability' => 'edit_theme_options'
) );
// Start adding sections.
$wp_customize -> add_section( 'minimalistflex_layout_home', Array(
'title' => _x( 'Blog Page', 'customizer section' , 'minimalistflex' ),
'description' => __( 'Here you may customize the layout of your blog page.', 'minimalistflex' ),
'panel' => 'minimalistflex_layout',
'priority' => 10,
'capability' => 'edit_theme_options'
) );
$wp_customize -> add_section( 'minimalistflex_layout_front', Array(
'title' => _x( 'Front Page', 'customizer section' , 'minimalistflex' ),
'description' => __( 'Here you may customize the layout of your front page. Only takes effect when using a static front page.', 'minimalistflex' ),
'panel' => 'minimalistflex_layout',
'priority' => 12,
'capability' => 'edit_theme_options'
) );
$wp_customize -> add_section( 'minimalistflex_layout_archive', Array(
'title' => _x( 'Archives', 'customizer section' , 'minimalistflex' ),
'description' => __( 'Here you may customize the layout of your archive pages.', 'minimalistflex' ),
'panel' => 'minimalistflex_layout',
'priority' => 15,
'capability' => 'edit_theme_options'
) );
$wp_customize -> add_section( 'minimalistflex_layout_search', Array(
'title' => _x( 'Search Results', 'customizer section' , 'minimalistflex' ),
'description' => __( 'Here you may customize the layout of your search result pages.', 'minimalistflex' ),
'panel' => 'minimalistflex_layout',
'priority' => 17,
'capability' => 'edit_theme_options'
) );
$wp_customize -> add_section( 'minimalistflex_layout_author', Array(
'title' => _x( 'Author Pages', 'customizer section' , 'minimalistflex' ),
'description' => __( 'Here you may customize the layout of your author pages.', 'minimalistflex' ),
'panel' => 'minimalistflex_layout',
'priority' => 20,
'capability' => 'edit_theme_options'
) );
$wp_customize -> add_section( 'minimalistflex_layout_singular', Array(
'title' => _x( 'Single Posts', 'customizer section' , 'minimalistflex' ),
'description' => __( 'Here you may customize the layout of your posts.', 'minimalistflex' ),
'panel' => 'minimalistflex_layout',
'priority' => 25,
'capability' => 'edit_theme_options'
) );
$wp_customize -> add_section( 'minimalistflex_layout_page', Array(
'title' => _x( 'Pages', 'customizer section' , 'minimalistflex' ),
'description' => __( 'Here you may customize the layout of your pages.', 'minimalistflex' ),
'panel' => 'minimalistflex_layout',
'priority' => 30,
'capability' => 'edit_theme_options'
) );
$wp_customize -> add_section( 'minimalistflex_interface', Array(
'title' => _x( 'Interface &amp; Elements', 'customizer section' , 'minimalistflex' ),
'description' => __( 'You may customize your site\'s interface and the elements displayed here.', 'minimalistflex' ),
'priority' => 71,
'capability' => 'edit_theme_options'
) );
$wp_customize -> add_section( 'minimalistflex_footer', Array(
'title' => _x( 'Footer', 'customizer section', 'minimalistflex' ),
'description' => __( 'You may customize how your footer looks like here.', 'minimalistflex' ),
'priority' => 140,
'capability' => 'edit_theme_options'
) );
// Start adding settings.
$wp_customize -> add_setting( 'minimalistflex_header_link', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'sanitize_callback' => 'esc_url_raw'
) );
$wp_customize -> add_setting( 'minimalistflex_header_label', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'sanitize_callback' => 'esc_attr'
) );
$wp_customize -> add_setting( 'minimalistflex_layout_home_sidebar', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'right',
'sanitize_callback' => 'minimalistflex_sanitize_radio_cb'
) );
$wp_customize -> add_setting( 'minimalistflex_layout_home_header', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'yes',
'sanitize_callback' => 'minimalistflex_sanitize_radio_cb'
) );
$wp_customize -> add_setting( 'minimalistflex_layout_front_sidebar', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'right',
'sanitize_callback' => 'minimalistflex_sanitize_radio_cb'
) );
$wp_customize -> add_setting( 'minimalistflex_layout_front_header', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'yes',
'sanitize_callback' => 'minimalistflex_sanitize_radio_cb'
) );
$wp_customize -> add_setting( 'minimalistflex_layout_archive_sidebar', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'right',
'sanitize_callback' => 'minimalistflex_sanitize_radio_cb'
) );
$wp_customize -> add_setting( 'minimalistflex_layout_archive_header', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'yes',
'sanitize_callback' => 'minimalistflex_sanitize_radio_cb'
) );
$wp_customize -> add_setting( 'minimalistflex_layout_archive_title', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'yes',
'sanitize_callback' => 'minimalistflex_sanitize_radio_cb'
) );
$wp_customize -> add_setting( 'minimalistflex_layout_search_sidebar', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'right',
'sanitize_callback' => 'minimalistflex_sanitize_radio_cb'
) );
$wp_customize -> add_setting( 'minimalistflex_layout_search_header', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'yes',
'sanitize_callback' => 'minimalistflex_sanitize_radio_cb'
) );
$wp_customize -> add_setting( 'minimalistflex_layout_search_title', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'yes',
'sanitize_callback' => 'minimalistflex_sanitize_radio_cb'
) );
$wp_customize -> add_setting( 'minimalistflex_layout_search_form', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'yes',
'sanitize_callback' => 'minimalistflex_sanitize_radio_cb'
) );
$wp_customize -> add_setting( 'minimalistflex_layout_author_sidebar', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'right',
'sanitize_callback' => 'minimalistflex_sanitize_radio_cb'
) );
$wp_customize -> add_setting( 'minimalistflex_layout_author_header', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'yes',
'sanitize_callback' => 'minimalistflex_sanitize_radio_cb'
) );
$wp_customize -> add_setting( 'minimalistflex_layout_author_title', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'yes',
'sanitize_callback' => 'minimalistflex_sanitize_radio_cb'
) );
$wp_customize -> add_setting( 'minimalistflex_layout_author_admin', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'yes',
'sanitize_callback' => 'minimalistflex_sanitize_radio_cb'
) );
$wp_customize -> add_setting( 'minimalistflex_layout_singular_sidebar', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'right',
'sanitize_callback' => 'minimalistflex_sanitize_radio_cb'
) );
$wp_customize -> add_setting( 'minimalistflex_layout_singular_header', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'yes',
'sanitize_callback' => 'minimalistflex_sanitize_radio_cb'
) );
$wp_customize -> add_setting( 'minimalistflex_layout_page_sidebar', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'right',
'sanitize_callback' => 'minimalistflex_sanitize_radio_cb'
) );
$wp_customize -> add_setting( 'minimalistflex_layout_page_header', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'yes',
'sanitize_callback' => 'minimalistflex_sanitize_radio_cb'
) );
$wp_customize -> add_setting( 'minimalistflex_interface_scroll_top', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'yes',
'sanitize_callback' => 'minimalistflex_sanitize_radio_cb'
) );
$wp_customize -> add_setting( 'minimalistflex_interface_excerpt', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 55,
'sanitize_callback' => 'minimalistflex_sanitize_int_cb'
) );
$wp_customize -> add_setting( 'minimalistflex_interface_autoh2label', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'no',
'sanitize_callback' => 'minimalistflex_sanitize_radio_cb'
) );
$wp_customize -> add_setting( 'minimalistflex_interface_comment_count', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'yes',
'sanitize_callback' => 'minimalistflex_sanitize_radio_cb'
) );
$wp_customize -> add_setting( 'minimalistflex_interface_publisher', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'yes',
'sanitize_callback' => 'minimalistflex_sanitize_radio_cb'
) );
$wp_customize -> add_setting( 'minimalistflex_interface_date', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'modify',
'sanitize_callback' => 'minimalistflex_sanitize_radio_cb'
) );
$wp_customize -> add_setting( 'minimalistflex_interface_readlink', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => __( 'Read More', 'minimalistflex' ),
'sanitize_callback' => 'esc_html'
) );
$wp_customize -> add_setting( 'minimalistflex_interface_thumbnail_height', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'default' => 'auto',
'sanitize_callback' => 'minimalistflex_sanitize_radio_cb'
) );
$wp_customize -> add_setting( 'minimalistflex_interface_thumbnail_height_px', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'default' => 300,
'sanitize_callback' => 'minimalistflex_sanitize_int_cb'
) );
$wp_customize -> add_setting( 'minimalistflex_footer_type', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'both',
'sanitize_callback' => 'minimalistflex_sanitize_radio_callback'
) );
$wp_customize -> add_setting( 'minimalistflex_footer_text', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'sanitize_callback' => 'wp_filter_post_kses'
) );
$wp_customize -> add_setting( 'minimalistflex_footer_widget_layout', Array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'one',
'sanitize_callback' => 'minimalistflex_sanitize_radio_callback'
) );
// Start binding controls (UI).
$wp_customize -> add_control( 'minimalistflex_header_link', Array(
'type' => 'url',
'priority' => 50,
'section' => 'header_image',
'label' => __( 'Header Image Link', 'minimalistflex' ),
'description' => __( 'You may link the header image to a URL. Leave blank if you do not want to do so.', 'minimalistflex' )
) );
$wp_customize -> add_control( 'minimalistflex_header_label', Array(
'type' => 'text',
'priority' => 40,
'section' => 'header_image',
'label' => __( 'Header Image Label', 'minimalistflex' ),
'description' => __( 'You may provide a description of your header image. Also will become the label of the link if set. Should be set for better accessibility.', 'minimalistflex' )
) );
$wp_customize -> add_control( 'minimalistflex_layout_home_sidebar', Array(
'type' => 'radio',
'priority' => 10,
'section' => 'minimalistflex_layout_home',
'label' => _x( 'Sidebar', 'layout' , 'minimalistflex' ),
'description' => __( 'Select whether to display the sidebar, and its location.', 'minimalistflex' ),
'choices' => Array(
'left' => __( 'Left sidebar', 'minimalistflex' ),
'right' => __( 'Right sidebar', 'minimalistflex' ),
'no' => __( 'No', 'minimalistflex' )
)
) );
$wp_customize -> add_control( 'minimalistflex_layout_home_header', Array(
'type' => 'radio',
'priority' => 15,
'section' => 'minimalistflex_layout_home',
'label' => _x( 'Header Image', 'layout' , 'minimalistflex' ),
'description' => __( 'Select whether to display the header image.', 'minimalistflex' ),
'choices' => Array(
'yes' => __( 'Yes', 'minimalistflex' ),
'no' => __( 'No', 'minimalistflex' )
)
) );
$wp_customize -> add_control( 'minimalistflex_layout_front_sidebar', Array(
'type' => 'radio',
'priority' => 10,
'section' => 'minimalistflex_layout_front',
'label' => _x( 'Sidebar', 'layout' , 'minimalistflex' ),
'description' => __( 'Select whether to display the sidebar, and its location.', 'minimalistflex' ),
'choices' => Array(
'left' => __( 'Left sidebar', 'minimalistflex' ),
'right' => __( 'Right sidebar', 'minimalistflex' ),
'no' => __( 'No', 'minimalistflex' )
)
) );
$wp_customize -> add_control( 'minimalistflex_layout_front_header', Array(
'type' => 'radio',
'priority' => 15,
'section' => 'minimalistflex_layout_front',
'label' => _x( 'Header Image', 'layout' , 'minimalistflex' ),
'description' => __( 'Select whether to display the header image.', 'minimalistflex' ),
'choices' => Array(
'yes' => __( 'Yes', 'minimalistflex' ),
'no' => __( 'No', 'minimalistflex' )
)
) );
$wp_customize -> add_control( 'minimalistflex_layout_archive_sidebar', Array(
'type' => 'radio',
'priority' => 10,
'section' => 'minimalistflex_layout_archive',
'label' => _x( 'Sidebar', 'layout' , 'minimalistflex' ),
'description' => __( 'Select whether to display the sidebar, and its location.', 'minimalistflex' ),
'choices' => Array(
'left' => __( 'Left sidebar', 'minimalistflex' ),
'right' => __( 'Right sidebar', 'minimalistflex' ),
'no' => __( 'No', 'minimalistflex' )
)
) );
$wp_customize -> add_control( 'minimalistflex_layout_archive_header', Array(
'type' => 'radio',
'priority' => 15,
'section' => 'minimalistflex_layout_archive',
'label' => _x( 'Header Image', 'layout' , 'minimalistflex' ),
'description' => __( 'Select whether to display the header image.', 'minimalistflex' ),
'choices' => Array(
'yes' => __( 'Yes', 'minimalistflex' ),
'no' => __( 'No', 'minimalistflex' )
)
) );
$wp_customize -> add_control( 'minimalistflex_layout_archive_title', Array(
'type' => 'radio',
'priority' => 20,
'section' => 'minimalistflex_layout_archive',
'label' => _x( 'Title', 'layout' , 'minimalistflex' ),
'description' => __( 'Select whether to display the archive title.', 'minimalistflex' ),
'choices' => Array(
'yes' => __( 'Yes', 'minimalistflex' ),
'no' => __( 'No', 'minimalistflex' )
)
) );
$wp_customize -> add_control( 'minimalistflex_layout_search_sidebar', Array(
'type' => 'radio',
'priority' => 10,
'section' => 'minimalistflex_layout_search',
'label' => _x( 'Sidebar', 'layout' , 'minimalistflex' ),
'description' => __( 'Select whether to display the sidebar, and its location.', 'minimalistflex' ),
'choices' => Array(
'left' => __( 'Left sidebar', 'minimalistflex' ),
'right' => __( 'Right sidebar', 'minimalistflex' ),
'no' => __( 'No', 'minimalistflex' )
)
) );
$wp_customize -> add_control( 'minimalistflex_layout_search_header', Array(
'type' => 'radio',
'priority' => 15,
'section' => 'minimalistflex_layout_search',
'label' => _x( 'Header Image', 'layout' , 'minimalistflex' ),
'description' => __( 'Select whether to display the header image.', 'minimalistflex' ),
'choices' => Array(
'yes' => __( 'Yes', 'minimalistflex' ),
'no' => __( 'No', 'minimalistflex' )
)
) );
$wp_customize -> add_control( 'minimalistflex_layout_search_title', Array(
'type' => 'radio',
'priority' => 20,
'section' => 'minimalistflex_layout_search',
'label' => _x( 'Search Query', 'layout' , 'minimalistflex' ),
'description' => __( 'Select whether to display the search query.', 'minimalistflex' ),
'choices' => Array(
'yes' => __( 'Yes', 'minimalistflex' ),
'no' => __( 'No', 'minimalistflex' )
)
) );
$wp_customize -> add_control( 'minimalistflex_layout_search_form', Array(
'type' => 'radio',
'priority' => 20,
'section' => 'minimalistflex_layout_search',
'label' => _x( 'Search Form', 'layout' , 'minimalistflex' ),
'description' => __( 'Select whether to also display the search form.', 'minimalistflex' ),
'choices' => Array(
'yes' => __( 'Yes', 'minimalistflex' ),
'no' => __( 'No', 'minimalistflex' )
)
) );
$wp_customize -> add_control( 'minimalistflex_layout_author_sidebar', Array(
'type' => 'radio',
'priority' => 10,
'section' => 'minimalistflex_layout_author',
'label' => _x( 'Sidebar', 'layout' , 'minimalistflex' ),
'description' => __( 'Select whether to display the sidebar, and its location.', 'minimalistflex' ),
'choices' => Array(
'left' => __( 'Left sidebar', 'minimalistflex' ),
'right' => __( 'Right sidebar', 'minimalistflex' ),
'no' => __( 'No', 'minimalistflex' )
)
) );
$wp_customize -> add_control( 'minimalistflex_layout_author_header', Array(
'type' => 'radio',
'priority' => 15,
'section' => 'minimalistflex_layout_author',
'label' => _x( 'Header Image', 'layout' , 'minimalistflex' ),
'description' => __( 'Select whether to display the header image.', 'minimalistflex' ),
'choices' => Array(
'yes' => __( 'Yes', 'minimalistflex' ),
'no' => __( 'No', 'minimalistflex' )
)
) );
$wp_customize -> add_control( 'minimalistflex_layout_author_title', Array(
'type' => 'radio',
'priority' => 20,
'section' => 'minimalistflex_layout_author',
'label' => _x( 'Author Name', 'layout' , 'minimalistflex' ),
'description' => __( 'Select whether to display the author name.', 'minimalistflex' ),
'choices' => Array(
'yes' => __( 'Yes', 'minimalistflex' ),
'no' => __( 'No', 'minimalistflex' )
)
) );
$wp_customize -> add_control( 'minimalistflex_layout_author_admin', Array(
'type' => 'radio',
'priority' => 40,
'section' => 'minimalistflex_layout_author',
'label' => _x( 'Admin Status', 'layout' , 'minimalistflex' ),
'description' => __( 'Show an indicator in the bottom-right of the avatar if the author is an admin.', 'minimalistflex' ),
'choices' => Array(
'yes' => __( 'Yes', 'minimalistflex' ),
'no' => __( 'No', 'minimalistflex' )
)
) );
$wp_customize -> add_control( 'minimalistflex_layout_singular_sidebar', Array(
'type' => 'radio',
'priority' => 10,
'section' => 'minimalistflex_layout_singular',
'label' => _x( 'Sidebar', 'layout' , 'minimalistflex' ),
'description' => __( 'Select whether to display the sidebar, and its location.', 'minimalistflex' ),
'choices' => Array(
'left' => __( 'Left sidebar', 'minimalistflex' ),
'right' => __( 'Right sidebar', 'minimalistflex' ),
'no' => __( 'No', 'minimalistflex' )
)
) );
$wp_customize -> add_control( 'minimalistflex_layout_singular_header', Array(
'type' => 'radio',
'priority' => 15,
'section' => 'minimalistflex_layout_singular',
'label' => _x( 'Header Image', 'layout' , 'minimalistflex' ),
'description' => __( 'Select whether to display the header image.', 'minimalistflex' ),
'choices' => Array(
'yes' => __( 'Yes', 'minimalistflex' ),
'no' => __( 'No', 'minimalistflex' )
)
) );
$wp_customize -> add_control( 'minimalistflex_layout_page_sidebar', Array(
'type' => 'radio',
'priority' => 10,
'section' => 'minimalistflex_layout_page',
'label' => _x( 'Sidebar', 'layout' , 'minimalistflex' ),
'description' => __( 'Select whether to display the sidebar, and its location.', 'minimalistflex' ),
'choices' => Array(
'left' => __( 'Left sidebar', 'minimalistflex' ),
'right' => __( 'Right sidebar', 'minimalistflex' ),
'no' => __( 'No', 'minimalistflex' )
)
) );
$wp_customize -> add_control( 'minimalistflex_layout_page_header', Array(
'type' => 'radio',
'priority' => 15,
'section' => 'minimalistflex_layout_page',
'label' => _x( 'Header Image', 'layout' , 'minimalistflex' ),
'description' => __( 'Select whether to display the header image.', 'minimalistflex' ),
'choices' => Array(
'yes' => __( 'Yes', 'minimalistflex' ),
'no' => __( 'No', 'minimalistflex' )
)
) );
$wp_customize -> add_control( 'minimalistflex_interface_scroll_top', Array(
'type' => 'radio',
'priority' => 10,
'section' => 'minimalistflex_interface',
'label' => __( 'Scroll to top button', 'minimalistflex' ),
'description' => __( 'Whether to display a "Scroll to top" button in the bottom-right corner.', 'minimalistflex' ),
'choices' => Array(
'yes' => __( 'Yes', 'minimalistflex' ),
'no' => __( 'No', 'minimalistflex' )
)
) );
$wp_customize -> add_control( 'minimalistflex_interface_excerpt', Array(
'type' => 'number',
'priority' => 20,
'section' => 'minimalistflex_interface',
'label' => __( 'Excerpt Word Count', 'minimalistflex' ),
'description' => __( 'The word count of the excerpts on any archive page and the blog page.', 'minimalistflex' )
) );
$wp_customize -> add_control( 'minimalistflex_interface_autoh2label', Array(
'type' => 'radio',
'priority' => 25,
'section' => 'minimalistflex_interface',
'label' => __( 'Auto h2 Label', 'minimalistflex' ),
'description' => __( 'The theme can automatically theme and label the h2 elements in single posts and pages, providing a better visual. May not work well in all circumstances, use with caution.', 'minimalistflex' ),
'choices' => Array(
'yes' => __( 'Yes', 'minimalistflex' ),
'no' => __( 'No', 'minimalistflex' )
)
) );
$wp_customize -> add_control( 'minimalistflex_interface_comment_count', Array(
'type' => 'radio',
'priority' => 30,
'section' => 'minimalistflex_interface',
'label' => __( 'Comment Count', 'minimalistflex' ),
'description' => __( 'Whether to display the comment count of the posts listed in an archive page.', 'minimalistflex' ),
'choices' => Array(
'yes' => __( 'Yes', 'minimalistflex' ),
'no' => __( 'No', 'minimalistflex' )
)
) );
$wp_customize -> add_control( 'minimalistflex_interface_publisher', Array(
'type' => 'radio',
'priority' => 35,
'section' => 'minimalistflex_interface',
'label' => __( 'Publisher', 'minimalistflex' ),
'description' => __( 'Whether to display the publisher.', 'minimalistflex' ),
'choices' => Array(
'yes' => __( 'Yes', 'minimalistflex' ),
'no' => __( 'No', 'minimalistflex' )
)
) );
$wp_customize -> add_control( 'minimalistflex_interface_date', Array(
'type' => 'radio',
'priority' => 40,
'section' => 'minimalistflex_interface',
'label' => __( 'Publish Date', 'minimalistflex' ),
'description' => __( 'Whether to display the published date.', 'minimalistflex' ),
'choices' => Array(
'publish' => __( 'Yes, publish time only.', 'minimalistflex' ),
'modify' => __( 'Yes, and display modified time if possible.', 'minimalistflex' ),
'no' => __( 'No', 'minimalistflex' )
)
) );
$wp_customize -> add_control( 'minimalistflex_interface_readlink', Array(
'type' => 'text',
'priority' => 45,
'section' => 'minimalistflex_interface',
'label' => __( 'Read More Link', 'minimalistflex' ),
'description' => __( 'The text for the "Read More" links.', 'minimalistflex' )
) );
$wp_customize -> add_control( 'minimalistflex_interface_thumbnail_height', Array(
'type' => 'radio',
'priority' => 50,
'section' => 'minimalistflex_interface',
'label' => __( 'Thumbnail Images Size', 'minimalistflex' ),
'description' => __( 'Select whether to enable flexible height for your thumbnail images, or use a fixed height.', 'minimalistflex' ),
'choices' => Array(
'fixed' => __( 'Fixed', 'minimalistflex' ),
'auto' => __( 'Flexible', 'minimalistflex' )
)
) );
$wp_customize -> add_control( 'minimalistflex_interface_thumbnail_height_px', Array(
'type' => 'number',
'priority' => 51,
'section' => 'minimalistflex_interface',
'label' => __( 'Height', 'minimalistflex' ),
'description' => __( 'Enter your desired height here. Should be in pixels.', 'minimalistflex' ),
) );
$wp_customize -> add_control( 'minimalistflex_footer_type', Array(
'type' => 'radio',
'priority' => 9,
'section' => 'minimalistflex_footer',
'label' => __( 'Footer Options', 'minimalistflex' ),
'description' => __( 'Choose what to display in your footer credit section.', 'minimalistflex' ),
'choices' => Array(
'both' => __( 'Both minimalistflex credits and custom footer text.', 'minimalistflex' ),
'minimalistflex' => __( 'minimalistflex credits only.', 'minimalistflex' ),
'custom' => __( 'Custom footer text only.', 'minimalistflex' ),
'none' => __( 'Neither.', 'minimalistflex' )
)
) );
$wp_customize -> add_control( new WP_Customize_Code_Editor_Control( $wp_customize, 'minimalistflex_footer_text', Array(
'code_type' => 'htmlmixed',
'priority' => 15,
'section' => 'minimalistflex_footer',
'label' => __( 'Custom Footer Text', 'minimalistflex' ),
'description' => __( 'Here you may set a custom footer text to be displayed in the footer credits. HTML allowed.', 'minimalistflex' )
) ) );
$wp_customize -> add_control( 'minimalistflex_footer_widget_layout', Array(
'type' => 'radio',
'priority' => 10,
'section' => 'minimalistflex_footer',
'label' => __( 'Footer Widget Layout', 'minimalistflex' ),
'description' => __( 'Choose the layout of the footer widgets.', 'minimalistflex' ),
'choices' => Array(
'one' => __( 'One column. Only shows the "Footer" widget area.', 'minimalistflex' ),
'two' => __( 'Two columns. Also shows the "Footer 2" widget area.', 'minimalistflex' ),
'three' => __( 'Three columns. Also shows the "Footer 3" widget area (aka all areas).', 'minimalistflex' )
)
) );
}
add_action( 'customize_register', 'minimalistflex_customize_register' );
add_action( 'customize_register', 'minimalistflex_customize_color_register' );
add_action( 'customize_register', 'minimalistflex_customize_author_elements_register' );
+15
View File
@@ -0,0 +1,15 @@
<?php
if ( !defined( 'WPINC' ) ) {
die;
}
?>
<style>
:root {
--minimalistflex-featured: "<?php esc_html_e( 'Featured', 'minimalistflex' ) ?>";
--minimalistflex-author: "<?php esc_html_e( 'Post Author', 'minimalistflex' ) ?>";
--minimalistflex-author-admin: "<?php esc_html_e( 'Admin', 'minimalistflex' ) ?>";
}
</style>
+29
View File
@@ -0,0 +1,29 @@
<?php
function minimalistflex_sanitize_radio_cb( $value, $setting ) {
$value = sanitize_key( $value );
$choices = $setting->manager->get_control( $setting->id )->choices;
if ( array_key_exists( $value, $choices ) ) {
return $value;
} else {
return $setting->default;
}
}
function minimalistflex_sanitize_color_cb( $value, $setting ) {
$value = sanitize_hex_color( $value );
if ( isset( $value ) ) {
return $value;
} else {
return $setting->default;
}
}
function minimalistflex_sanitize_int_cb( $number, $setting ) {
$number = absint( $number );
if ( $number ) {
return $number;
} else {
return $setting->default;
}
}