2021-08-01 17:32:46 +00:00
< ? php
/**
2021-08-01 17:45:36 +00:00
* Portage Theme Customizer
2021-08-01 17:32:46 +00:00
*
2021-08-01 17:45:36 +00:00
* @ package Portage
2021-08-01 17:32:46 +00:00
*/
/**
* Binds JS handlers to make Theme Customizer preview reload changes asynchronously .
*/
2021-08-01 17:45:36 +00:00
function portage_customize_preview_js () {
wp_enqueue_script ( 'portage_customizer' , get_template_directory_uri () . '/js/customizer.js' , array ( 'customize-preview' ), '20130508' , true );
2021-08-01 17:32:46 +00:00
}
2021-08-01 17:45:36 +00:00
add_action ( 'customize_preview_init' , 'portage_customize_preview_js' );
2021-08-01 17:32:46 +00:00
// Add some Customizer stuff
// developer.wordpress.org/themes/advanced-topics/customizer-api/
2021-08-01 17:45:36 +00:00
add_action ( 'customize_register' , 'portage_customize_register' , 11 );
function portage_customize_register ( $wp_customize ) {
2021-08-01 17:32:46 +00:00
// Add postMessage support for site title and description for the Theme Customizer
$wp_customize -> get_setting ( 'blogname' ) -> transport = 'postMessage' ;
$wp_customize -> get_setting ( 'blogdescription' ) -> transport = 'postMessage' ;
$wp_customize -> get_setting ( 'header_textcolor' ) -> transport = 'postMessage' ;
2021-08-01 20:13:48 +00:00
$wp_customize -> add_panel ( 'portage' , array (
'title' => __ ( 'Portage Theme Options' , 'portage' ),
'description' => __ ( 'The Portage theme has many options. Vist the theme\'s <a href="http://www.example.com/">home page</a> for complete instructions.' , 'portage' ),
2021-08-01 17:32:46 +00:00
'priority' => 05 ,
) );
// Widget Areas
2021-08-01 17:45:36 +00:00
$wp_customize -> add_section ( 'portage_widget_areas' , array (
2021-08-01 20:13:48 +00:00
'title' => __ ( 'Widget Areas' , 'portage' ),
2021-08-01 17:32:46 +00:00
'capability' => 'edit_theme_options' ,
'priority' => 30 ,
2021-08-01 20:13:48 +00:00
'description' => __ ( 'Select which action hook widget areas you would like to activate.' , 'portage' ),
'panel' => 'portage' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_before_header' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_before_header' , array (
'section' => 'portage_widget_areas' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Before Header' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_after_top_menu' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_after_top_menu' , array (
'section' => 'portage_widget_areas' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'After Top Menu' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_before_social_media' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_before_social_media' , array (
'section' => 'portage_widget_areas' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Before Social Media' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_before_primary_menu' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_before_primary_menu' , array (
'section' => 'portage_widget_areas' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Before Primary Menu' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_after_header' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_after_header' , array (
'section' => 'portage_widget_areas' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'After Header' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_container_top' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_container_top' , array (
'section' => 'portage_widget_areas' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Top of Container' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_before_post_title' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_before_post_title' , array (
'section' => 'portage_widget_areas' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Before Post Title' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
/*
* We 've removed this action hook, but let' s leave this control in place
* in case we find a use for it later .
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_before_post_content' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_before_post_content' , array (
'section' => 'portage_widget_areas' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Before Post Content' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
*/
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_post_top' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_post_top' , array (
'section' => 'portage_widget_areas' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Top of Post' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_post_bottom' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_post_bottom' , array (
'section' => 'portage_widget_areas' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Bottom of Post' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_after_post_content' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_after_post_content' , array (
'section' => 'portage_widget_areas' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'After Post Content' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_before_post_meta' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_before_post_meta' , array (
'section' => 'portage_widget_areas' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Before Post Meta' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_after_post_meta' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_after_post_meta' , array (
'section' => 'portage_widget_areas' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'After Post Meta' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_before_comments' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_before_comments' , array (
'section' => 'portage_widget_areas' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Before Comments' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_after_comments' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_after_comments' , array (
'section' => 'portage_widget_areas' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'After Comments' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_before_comment_form' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_before_comment_form' , array (
'section' => 'portage_widget_areas' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Before Comment Form' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_after_comment_form' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_after_comment_form' , array (
'section' => 'portage_widget_areas' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'After Comment Form' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_container_bottom' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_container_bottom' , array (
'section' => 'portage_widget_areas' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Bottom of Container' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_before_footer_menu' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_before_footer_menu' , array (
'section' => 'portage_widget_areas' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Before Footer Menu' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_footer_top' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_footer_top' , array (
'section' => 'portage_widget_areas' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Top of Footer' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_footer_bottom' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_footer_bottom' , array (
'section' => 'portage_widget_areas' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Bottom of Footer' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_after_footer' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_after_footer' , array (
'section' => 'portage_widget_areas' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'After Footer' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
// Post Format Title Options
2021-08-01 17:45:36 +00:00
$wp_customize -> add_section ( 'portage_post_format_title_options' , array (
2021-08-01 20:13:48 +00:00
'title' => __ ( 'Post Format Title Options' , 'portage' ),
2021-08-01 17:32:46 +00:00
'capability' => 'edit_theme_options' ,
'priority' => 10 ,
2021-08-01 20:13:48 +00:00
'description' => __ ( 'Select whether titles should appear for various post formats.' , 'portage' ),
'panel' => 'portage' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_aside_title' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_aside_title' , array (
'section' => 'portage_post_format_title_options' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Display title for asides' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_link_title' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_link_title' , array (
'section' => 'portage_post_format_title_options' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Display title for links' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_quote_title' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_quote_title' , array (
'section' => 'portage_post_format_title_options' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Display title for quotes' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_status_title' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_status_title' , array (
'section' => 'portage_post_format_title_options' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Display title for statuses' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
// Post Format Excerpt Options
2021-08-01 17:45:36 +00:00
$wp_customize -> add_section ( 'portage_post_format_excerpt_options' , array (
2021-08-01 20:13:48 +00:00
'title' => __ ( 'Post Format Excerpt Options' , 'portage' ),
2021-08-01 17:32:46 +00:00
'capability' => 'edit_theme_options' ,
'priority' => 20 ,
2021-08-01 20:13:48 +00:00
'description' => __ ( 'By default, the aside, link, quote, and statu post format will display full content on the home page. You can choose to show excerpts instead.' , 'portage' ),
'panel' => 'portage' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_aside_excerpt' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_aside_excerpt' , array (
'section' => 'portage_post_format_excerpt_options' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Display excerpt for asides' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_link_excerpt' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_link_excerpt' , array (
'section' => 'portage_post_format_excerpt_options' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Display excerpt for links' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_quote_excerpt' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_quote_excerpt' , array (
'section' => 'portage_post_format_excerpt_options' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Display excerpt for quotes' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_status_excerpt' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_status_excerpt' , array (
'section' => 'portage_post_format_excerpt_options' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Display excerpt for statuses' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 20:13:48 +00:00
$default_readmore = __ ( '…read more…' , 'portage' );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_readmore' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
'default' => $default_readmore ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_text' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_readmore' , array (
'section' => 'portage_post_format_excerpt_options' ,
2021-08-01 17:32:46 +00:00
'type' => 'text' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Text for ‘read more’ link (in all excerpts)' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
// Copyright Information
2021-08-01 17:45:36 +00:00
$wp_customize -> add_section ( 'portage_copyright' , array (
2021-08-01 20:13:48 +00:00
'title' => __ ( 'Copyright Information' , 'portage' ),
2021-08-01 17:32:46 +00:00
'capability' => 'edit_theme_options' ,
'priority' => 50 ,
2021-08-01 20:13:48 +00:00
'description' => __ ( 'Copyright information will appear in the footer, and at the bottom of printed pages. (Make sure you have not disabled this function under "Miscellaneous Options")' , 'portage' ),
'panel' => 'portage' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_copyright' , array (
2021-08-01 20:27:28 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
'default' => $default_copyright ,
'sanitize_callback' => 'wp_kses_post' ,
2021-08-01 17:32:46 +00:00
) );
$default_copyright = '<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Creative Commons License" id="cc-button" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a>This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License</a>.' ;
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_copyright' , array (
'section' => 'portage_copyright' ,
2021-08-01 17:32:46 +00:00
'default' => $default_copyright ,
'type' => 'textarea' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Enter your copyright information. (HTML is allowed.)' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
// Print Options
2021-08-01 17:45:36 +00:00
$wp_customize -> add_section ( 'portage_print' , array (
2021-08-01 20:13:48 +00:00
'title' => __ ( 'Print Options' , 'portage' ),
2021-08-01 17:32:46 +00:00
'capability' => 'edit_theme_options' ,
'priority' => 40 ,
2021-08-01 20:13:48 +00:00
'panel' => 'portage' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_print_url' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_print_url' , array (
'section' => 'portage_print' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Print URL information at end of post' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_print_copyright' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_print_copyright' , array (
'section' => 'portage_print' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Print copyright information at end of post' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
// Social Media Options
2021-08-01 17:45:36 +00:00
$wp_customize -> add_section ( 'portage_social_media' , array (
2021-08-01 20:13:48 +00:00
'title' => __ ( 'Social Media Options' , 'portage' ),
2021-08-01 17:32:46 +00:00
'capability' => 'edit_theme_options' ,
'priority' => 90 ,
2021-08-01 20:13:48 +00:00
'panel' => 'portage' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_rss' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_rss' , array (
'section' => 'portage_social_media' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Display link to RSS feed' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_twitter' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_url' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_twitter' , array (
'section' => 'portage_social_media' ,
2021-08-01 17:32:46 +00:00
'type' => 'url' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Enter Twitter URL' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_twitter2' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_url' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_twitter2' , array (
'section' => 'portage_social_media' ,
2021-08-01 17:32:46 +00:00
'type' => 'url' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Enter second Twitter URL' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_facebook' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_url' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_facebook' , array (
'section' => 'portage_social_media' ,
2021-08-01 17:32:46 +00:00
'type' => 'url' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Enter Facebook URL' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_instagram' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_url' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_instagram' , array (
'section' => 'portage_social_media' ,
2021-08-01 17:32:46 +00:00
'type' => 'text' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Enter Instagram URL' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_youtube' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_url' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_youtube' , array (
'section' => 'portage_social_media' ,
2021-08-01 17:32:46 +00:00
'type' => 'url' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Enter YouTube URL' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_pinterest' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_url' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_pinterest' , array (
'section' => 'portage_social_media' ,
2021-08-01 17:32:46 +00:00
'type' => 'url' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Enter Pinterest Profile URL' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_amazon' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_url' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_amazon' , array (
'section' => 'portage_social_media' ,
2021-08-01 17:32:46 +00:00
'type' => 'url' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Enter Amazon Wish List URL' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
// Mobile Menu Options
2021-08-01 17:45:36 +00:00
$wp_customize -> add_section ( 'portage_mobile_menu_options' , array (
2021-08-01 20:13:48 +00:00
'title' => __ ( 'Mobile Menu Options' , 'portage' ),
2021-08-01 17:32:46 +00:00
'capability' => 'edit_theme_options' ,
'priority' => 110 ,
2021-08-01 20:13:48 +00:00
'description' => __ ( 'Menu settings for mobile appearance. <b>Note:</b> The breakpoint settings will override the "mobile breakpoint" setting.' , 'portage' ),
'panel' => 'portage' ,
2021-08-01 17:32:46 +00:00
) );
// Top Menu Options
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_top_menu_name' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_text' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_top_menu_name' , array (
'section' => 'portage_mobile_menu_options' ,
2021-08-01 17:32:46 +00:00
'type' => 'text' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Mobile display name for top menu' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_top_menu_type' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_mobile_menu_type' ,
2021-08-01 17:32:46 +00:00
'default' => 'select' ,
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_top_menu_type' , array (
'section' => 'portage_mobile_menu_options' ,
2021-08-01 17:32:46 +00:00
'type' => 'select' ,
'choices' => array (
'select' => 'Select Menu' ,
'dropdown' => 'Flat Menu' ,
'multitoggle' => 'Dropdown Menu' ,
),
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Display the top menu as' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_top_menu_breakpoint' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_int' ,
2021-08-01 17:32:46 +00:00
'default' => 640 ,
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_top_menu_breakpoint' , array (
'section' => 'portage_mobile_menu_options' ,
2021-08-01 17:32:46 +00:00
'type' => 'integer' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Breakpoint to display top menu as mobile' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
// Main Menu Options
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_main_menu_name' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_text' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_main_menu_name' , array (
'section' => 'portage_mobile_menu_options' ,
2021-08-01 17:32:46 +00:00
'type' => 'text' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Mobile display name for main menu' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_main_menu_type' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_mobile_menu_type' ,
2021-08-01 17:32:46 +00:00
'default' => 'select' ,
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_main_menu_type' , array (
'section' => 'portage_mobile_menu_options' ,
2021-08-01 17:32:46 +00:00
'type' => 'select' ,
'choices' => array (
'select' => 'Select Menu' ,
'dropdown' => 'Flat Menu' ,
'multitoggle' => 'Dropdown Menu' ,
),
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Display the menu menu as' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_main_menu_breakpoint' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_int' ,
2021-08-01 17:32:46 +00:00
'default' => 640 ,
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_main_menu_breakpoint' , array (
'section' => 'portage_mobile_menu_options' ,
2021-08-01 17:32:46 +00:00
'type' => 'integer' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Breakpoint to display main menu as mobile' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
// Footer Menu Options
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_footer_menu_name' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_text' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_footer_menu_name' , array (
'section' => 'portage_mobile_menu_options' ,
2021-08-01 17:32:46 +00:00
'type' => 'text' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Mobile display name for footer menu' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_footer_menu_type' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_mobile_menu_type' ,
2021-08-01 17:32:46 +00:00
'default' => 'select' ,
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_footer_menu_type' , array (
'section' => 'portage_mobile_menu_options' ,
2021-08-01 17:32:46 +00:00
'type' => 'select' ,
'choices' => array (
'select' => 'Select Menu' ,
'dropdown' => 'Flat Menu' ,
'multitoggle' => 'Dropdown Menu' ,
),
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Display the footer menu as' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_footer_menu_breakpoint' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_int' ,
2021-08-01 17:32:46 +00:00
'default' => 640 ,
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_footer_menu_breakpoint' , array (
'section' => 'portage_mobile_menu_options' ,
2021-08-01 17:32:46 +00:00
'type' => 'integer' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Breakpoint to display footer menu as mobile' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
// Mobile Options Options
2021-08-01 17:45:36 +00:00
$wp_customize -> add_section ( 'portage_mobile' , array (
2021-08-01 20:13:48 +00:00
'title' => __ ( 'Mobile Options' , 'portage' ),
2021-08-01 17:32:46 +00:00
'capability' => 'edit_theme_options' ,
'priority' => 100 ,
2021-08-01 20:13:48 +00:00
'panel' => 'portage' ,
2021-08-01 17:32:46 +00:00
'description' => 'Fine-tune your mobile appearance' ,
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_mobile_breakpoint' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
'default' => '640' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_int' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_mobile_breakpoint' , array (
'section' => 'portage_mobile' ,
2021-08-01 17:32:46 +00:00
'type' => 'text' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Breakpoint to display mobile version of theme' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_post_top_link' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
'default' => '0' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_post_top_link' , array (
'section' => 'portage_mobile' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Display \'Return to Top\' link after post content' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_footer_top_link' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
'default' => '0' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_footer_top_link' , array (
'section' => 'portage_mobile' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Display \'Return to Top\' link before footer content' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
// Miscellaneous Options
2021-08-01 17:45:36 +00:00
$wp_customize -> add_section ( 'portage_misc' , array (
2021-08-01 20:13:48 +00:00
'title' => __ ( 'Miscellaneous Options' , 'portage' ),
2021-08-01 17:32:46 +00:00
'capability' => 'edit_theme_options' ,
'priority' => 200 ,
2021-08-01 20:13:48 +00:00
'panel' => 'portage' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_display_copyright' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
'default' => '1' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_display_copyright' , array (
'section' => 'portage_misc' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Display copyright information in footer' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_display_credits' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
'default' => '1' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_display_credits' , array (
'section' => 'portage_misc' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Display developer credits in footer' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_edit_post_link' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
'default' => '1' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_checkbox' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_edit_post_link' , array (
'section' => 'portage_misc' ,
2021-08-01 17:32:46 +00:00
'type' => 'checkbox' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Display "Edit this post" link if user is logged in' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_setting ( 'portage_excerpt_length' , array (
2021-08-01 17:32:46 +00:00
'type' => 'theme_mod' ,
'transport' => 'postMessage' ,
'default' => '20' ,
2021-08-01 17:45:36 +00:00
'sanitize_callback' => 'portage_sanitize_excerpt' ,
2021-08-01 17:32:46 +00:00
) );
2021-08-01 17:45:36 +00:00
$wp_customize -> add_control ( 'portage_excerpt_length' , array (
'section' => 'portage_misc' ,
2021-08-01 17:32:46 +00:00
'type' => 'text' ,
2021-08-01 20:13:48 +00:00
'label' => __ ( 'Excerpt length in number of words (maximum = 100)' , 'portage' ),
2021-08-01 17:32:46 +00:00
) );
// Preview some of our options
/*
if ( $wp_customize -> is_preview () && ! is_admin () )
2021-08-01 17:45:36 +00:00
add_action ( 'wp_footer' , 'portage_customize_preview' , 21 );
2021-08-01 17:32:46 +00:00
function themename_customize_preview () {
?>
< script type = " text/javascript " >
( function ( $ ){
wp . customize ( 'setting_name' , function ( value ) {
value . bind ( function ( to ) {
$ ( '.posttitle' ) . css ( 'color' , to ? to : '' );
});
});
} )( jQuery )
</ script >
< ? php
}
*/
} // End register function
// Sanitizer Functions
2021-08-01 17:45:36 +00:00
function portage_sanitize_checkbox ( $input ) {
2021-08-01 17:32:46 +00:00
if ( $input == 1 ) {
return 1 ;
} else {
return '' ;
}
}
2021-08-01 17:45:36 +00:00
function portage_sanitize_text ( $input ) {
2021-08-01 17:32:46 +00:00
return wp_kses_post ( force_balance_tags ( $input ) );
}
2021-08-01 17:45:36 +00:00
function portage_sanitize_excerpt ( $input ) {
2021-08-01 17:32:46 +00:00
$input = absint ( $input );
if ( $input > 100 ) { $input = 100 ; }
return $input ;
}
2021-08-01 17:45:36 +00:00
function portage_sanitize_html ( $input ) {
2021-08-01 17:32:46 +00:00
wp_kses ( $input ,
array (),
array (
'http' => array (),
'https' => array (),
)
);
}
2021-08-01 17:45:36 +00:00
function portage_sanitize_url ( $url ) {
2021-08-01 17:32:46 +00:00
return esc_url_raw ( $url );
}
2021-08-01 17:45:36 +00:00
function portage_sanitize_mobile_menu_type ( $input ){
2021-08-01 17:32:46 +00:00
$valid = array (
'select' => 'Select Menu' ,
'dropdown' => 'Flat Menu' ,
'multitoggle' => 'Dropdown Menu' ,
);
if ( array_key_exists ( $input , $valid ) ) {
return $input ;
} else {
return '' ;
}
}
2021-08-01 17:45:36 +00:00
function portage_sanitize_int ( $input ){
2021-08-01 17:32:46 +00:00
if ( is_numeric ( $input ) ) {
return intval ( $input );
}
}