It looks like nothing was found at this location.
/** * Extend default customizer panel. * * @package Mystery Themes * @subpackage News Portal * @since 1.5.0 * * @see WP_Customize_Panel * @access public */ if ( class_exists( 'WP_Customize_Panel' ) ) { /** * Class News_Portal_Customize_Panel * * @since 1.0.0 */ class News_Portal_Customize_Panel extends WP_Customize_Panel { /** * Panel * * @var string */ public $panel; /** * Control type. * * @var string */ public $type = 'news_portal_panel'; /** * Get section parameters for JS. * * @return array Exported parameters. */ public function json() { $array = wp_array_slice_assoc( (array) $this, array( 'id', 'description', 'priority', 'type', 'panel', ) ); $array['title'] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) ); $array['content'] = $this->get_content(); $array['active'] = $this->active(); $array['instanceNumber'] = $this->instance_number; return $array; } } }/** * Extend default customizer section. * * @package Mystery Themes * @subpackage News Portal * @since 1.5.0 * * @see WP_Customize_Section * @access public */ if ( class_exists( 'WP_Customize_Section' ) ) { /** * Class News_Portal_Customize_Section * * @since 1.0.0 */ class News_Portal_Customize_Section extends WP_Customize_Section { /** * Section. * * @var string */ public $section; /** * Type of this section. * * @var string */ public $type = 'news_portal_section'; /** * Gather the parameters passed to client JavaScript via JSON. * * @return array The array to be exported to the client as JSON. */ public function json() { $array = wp_array_slice_assoc( (array) $this, array( 'id', 'description', 'priority', 'panel', 'type', 'description_hidden', 'section', ) ); $array['title'] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) ); $array['content'] = $this->get_content(); $array['active'] = $this->active(); $array['instanceNumber'] = $this->instance_number; if ( $this->panel ) { $array['customizeAction'] = sprintf( esc_html__( 'Customizing ▸ %s', 'news-portal' ), esc_html( $this->manager->get_panel( $this->panel )->title ) ); } else { $array['customizeAction'] = esc_html__( 'Customizing', 'news-portal' ); } return $array; } } }/** * Add Panels/Sections to the Customizer. * * @package Mystery Themes * @subpackage News Portal * @since 1.5.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } add_action( 'customize_register', 'news_portal_register_customizer_panels_sections' ); if ( ! function_exists( 'news_portal_register_customizer_panels_sections' ) ) : /** * Implement the Theme Customizer for Theme Settings. * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function news_portal_register_customizer_panels_sections( $wp_customize ) { /* * Failsafe is safe */ if ( ! isset( $wp_customize ) ) { return; } /*--------------------------- Add Panels -------------------------------------*/ /** * Add Panel for General Settings * * Customize > General Settings * * @uses $wp_customize->add_panel() https://developer.wordpress.org/reference/classes/wp_customize_manager/add_panel/ */ $wp_customize->add_panel( 'news_portal_general_settings_panel', array( 'priority' => 5, 'title' => __( 'General Settings', 'news-portal' ) ) ); /** * Add Panel for Header Settings * * Customize > Header Settings * * @uses $wp_customize->add_panel() https://developer.wordpress.org/reference/classes/wp_customize_manager/add_panel/ */ $wp_customize->add_panel( 'news_portal_header_settings_panel', array( 'priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __( 'Header Settings', 'news-portal' ), ) ); /** * Add Panel for Innerpage Settings * * Customize > Innerpage Settings * * @uses $wp_customize->add_panel() https://developer.wordpress.org/reference/classes/wp_customize_manager/add_panel/ */ $wp_customize->add_panel( 'news_portal_design_settings_panel', array( 'priority' => 15, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __( 'Innerpage Settings', 'news-portal' ), ) ); /** * Add Panel for Footer Settings * * Customize > Footer Settings * * @uses $wp_customize->add_panel() https://developer.wordpress.org/reference/classes/wp_customize_manager/add_panel/ */ $wp_customize->add_panel( 'news_portal_footer_settings_panel', array( 'priority' => 20, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __( 'Footer Settings', 'news-portal' ), ) ); } endif;/** * Customizer helper where define functions related to customizer panel, sections and settings. * * @package Mystery Themes * @subpackage News Portal * @since 1.5.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } /*---------------------- General Panel Choices ----------------------------- --*/ if ( ! function_exists( 'news_portal_site_layout_choices' ) ) : /** * function to return choices of site layout. * * @since 1.5.0 */ function news_portal_site_layout_choices() { $site_layout_choices = apply_filters( 'news_portal_site_layout_choices', array( 'fullwidth_layout' => array( 'title' => __( 'Full Width', 'news-portal' ), 'src' => get_template_directory_uri() . '/assets/images/full-width.png' ), 'boxed_layout' => array( 'title' => __( 'Boxed', 'news-portal' ), 'src' => get_template_directory_uri() . '/assets/images/boxed.png' ) ) ); return $site_layout_choices; } endif; /*---------------------- Preloader Choices ----------------------------- --*/ if ( ! function_exists( 'news_portal_preloader_style_choices' ) ) : /** * function to return choices for preloader styles. * * @since 1.0.0 */ function news_portal_preloader_style_choices() { $preloader_choices = apply_filters( 'news_portal_preloader_style_choices', array( 'three_bounce' => array( 'title' => __( 'Style 1', 'news-portal' ), 'src' => get_template_directory_uri() . '/assets/images/three-bounce-preloader.gif' ), 'wave' => array( 'title' => __( 'Style 2', 'news-portal' ), 'src' => get_template_directory_uri() . '/assets/images/wave-preloader.gif' ), 'folding_cube' => array( 'title' => __( 'Style 3', 'news-portal' ), 'src' => get_template_directory_uri() . '/assets/images/folding-cube-preloader.gif' ), ) ); return $preloader_choices; } endif; /*----------------------Sidebar Layout Choices -------------------------------*/ if ( ! function_exists( 'news_portal_sidebar_layout_choices' ) ) : /** * function to return choices of sidebar layout. * * @since 1.5.0 */ function news_portal_sidebar_layout_choices() { $sidebar_layout_choices = apply_filters( 'news_portal_sidebar_layout_choices', array( 'left_sidebar' => array( 'title' => esc_html__( 'Left Sidebar', 'news-portal' ), 'src' => get_template_directory_uri() . '/assets/images/left-sidebar.png' ), 'right_sidebar' => array( 'title' => esc_html__( 'Right Sidebar', 'news-portal' ), 'src' => get_template_directory_uri() . '/assets/images/right-sidebar.png' ), 'no_sidebar' => array( 'title' => esc_html__( 'No Sidebar', 'news-portal' ), 'src' => get_template_directory_uri() . '/assets/images/no-sidebar.png' ), 'no_sidebar_center' => array( 'title' => esc_html__( 'No Sidebar Center', 'news-portal' ), 'src' => get_template_directory_uri() . '/assets/images/no-sidebar-center.png' ) ) ); return $sidebar_layout_choices; } endif; /*----------------------Archive Layout Choices -------------------------------*/ if ( ! function_exists( 'news_portal_archive_layout_choices' ) ) : /** * function to return choices of archive layout. * * @since 1.5.0 */ function news_portal_archive_layout_choices() { $archive_layout_choices = apply_filters( 'news_portal_archive_layout_choices', array( 'classic' => array( 'title' => esc_html__( 'Classic', 'news-portal' ), 'src' => get_template_directory_uri() . '/assets/images/archive-layout1.png' ), 'grid' => array( 'title' => esc_html__( 'Grid', 'news-portal' ), 'src' => get_template_directory_uri() . '/assets/images/archive-layout2.png' ) ) ); return $archive_layout_choices; } endif; /*----------------------Footer Widget Layout Choices -------------------------------*/ if ( ! function_exists( 'news_portal_footer_widget_layout_choices' ) ) : /** * function to return choices of archive layout. * * @since 1.5.0 */ function news_portal_footer_widget_layout_choices() { $footer_layout_choices = apply_filters( 'news_portal_footer_widget_layout_choices', array( 'column_four' => array( 'title' => esc_html__( 'Columns Four', 'news-portal' ), 'src' => get_template_directory_uri() . '/assets/images/footer-4.png' ), 'column_three' => array( 'title' => esc_html__( 'Columns Three', 'news-portal' ), 'src' => get_template_directory_uri() . '/assets/images/footer-3.png' ), 'column_two' => array( 'title' => esc_html__( 'Columns Two', 'news-portal' ), 'src' => get_template_directory_uri() . '/assets/images/footer-2.png' ), 'column_one' => array( 'title' => esc_html__( 'Column One', 'news-portal' ), 'src' => get_template_directory_uri() . '/assets/images/footer-1.png' ) ) ); return $footer_layout_choices; } endif; /*---------------------------------- Upgrade Control Choices -----------------------------------*/ if ( ! function_exists( 'news_portal_upgrade_choices' ) ) : /** * function to return choices for upgrade to pro. * * @since 1.5.0 */ function news_portal_upgrade_choices( $setting_id ) { $upgrade_info_lists = array( 'preloader' => array( __( "10+ Preloader Styles", 'news-portal' ) ), 'social_icon' => array( __( 'Add unlimited social icons field.', 'news-portal' ) ), 'widget_setting'=> array( __( '10+ Widgets', 'news-portal' ), __( 'Post Format Option', 'news-portal' ), __( 'Post Date Option', 'news-portal' ), __( 'Post Author Option', 'news-portal' ), __( 'Post Comment Option', 'news-portal' ), __( 'Post Review Option', 'news-portal' ) ), 'header_options'=> array( __( "2 More Layouts", 'news-portal' ), __( 'Button on Menu', 'news-portal' ), __( 'Shadow Option on Menu', 'news-portal' ), ), 'ticker' => array( __( "1 More Layouts", 'news-portal' ), __( 'Content Type Options', 'news-portal' ), __( 'Adjustable Post Count Option', 'news-portal' ) ), 'archive_page' => array( __( "2 More Layouts", 'news-portal' ), __( 'Custom 404 Page', 'news-portal' ) ), 'single_page' => array( __( "4 Layouts", 'news-portal' ), __( 'Post Review Option', 'news-portal' ), __( 'Author Option', 'news-portal' ), __( 'Post View Option', 'news-portal' ), ), 'footer_area' => array( __( 'Background Options', 'news-portal' ) ), 'bottom_area' => array( __( "2 Sub Footer Layouts", 'news-portal' ) ), ); $setting_id = explode( 'news_portal_', $setting_id ); $setting_id = $setting_id[1]; return $upgrade_info_lists[$setting_id]; } endif;/** * Active callback function. * * @package Mystery Themes * @subpackage News Portal * @since 1.5.0 */ if ( ! function_exists( 'news_portal_has_enable_preloader' ) ) : /** * check the setting preloader is enable or not. * * @since 1.0.0 */ function news_portal_has_enable_preloader( $control ) { if ( false !== $control->manager->get_setting( 'news_portal_preloader_option' )->value() ) { return true; } else { return false; } } endif; if ( ! function_exists( 'news_portal_has_enable_header_top_area' ) ) : /** * check the setting header top area is enable or not. * * @since 1.0.0 */ function news_portal_has_enable_header_top_area( $control ) { if ( false !== $control->manager->get_setting( 'news_portal_top_header_option' )->value() ) { return true; } else { return false; } } endif; if ( ! function_exists( 'news_portal_has_enable_ticker' ) ) : /** * check the setting ticker is enable or not. * * @since 1.0.0 */ function news_portal_has_enable_ticker( $control ) { if ( false !== $control->manager->get_setting( 'news_portal_ticker_option' )->value() ) { return true; } else { return false; } } endif; if ( ! function_exists( 'news_portal_has_enable_related_post' ) ) : /** * check the setting related post is enable or not. * * @since 1.0.0 */ function news_portal_has_enable_related_post( $control ) { if ( false !== $control->manager->get_setting( 'news_portal_related_posts_option' )->value() ) { return true; } else { return false; } } endif; if ( ! function_exists( 'news_portal_has_enable_footer_widget' ) ) : /** * check the setting footer widget is enable or not. * * @since 1.0.0 */ function news_portal_has_enable_footer_widget( $control ) { if ( false !== $control->manager->get_setting( 'news_portal_footer_widget_option' )->value() ) { return true; } else { return false; } } endif; if ( ! function_exists( 'news_portal_has_enable_site_mode_switcher' ) ) : /** * check the setting related post is enable or not. * * @since 1.5.2 */ function news_portal_has_enable_site_mode_switcher( $control ) { if ( false !== $control->manager->get_setting( 'news_portal_site_mode_switcher_option' )->value() ) { return false; } else { return true; } } endif;/** * File to sanitize customizer field * * @package Mystery Themes * @subpackage News Portal * @since 1.0.0 */ if ( ! function_exists( 'news_portal_sanitize_select' ) ) : /** * Sanitize select. * * @param mixed $input The value to sanitize. * @param WP_Customize_Setting $setting WP_Customize_Setting instance. * @return mixed Sanitized value. * * @since 1.0.0 */ function news_portal_sanitize_select( $input, $setting ) { // Ensure input is a slug. $input = sanitize_key( $input ); // Get list of choices from the control associated with the setting. $choices = $setting->manager->get_control( $setting->id )->choices; // If the input is a valid key, return it; otherwise, return the default. return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); } endif; if ( ! function_exists( 'news_portal_sanitize_checkbox' ) ) : /** * Sanitize checkbox value * * @param bool $checked Whether the checkbox is checked. * @return bool Whether the checkbox is checked. */ function news_portal_sanitize_checkbox( $input ) { return ( ( isset( $input ) && true === $input ) ? true : false ); } endif; /** * Sanitize repeater value * * @since 1.0.0 */ function news_portal_sanitize_repeater( $input ){ $input_decoded = json_decode( $input, true ); if ( !empty( $input_decoded ) ) { foreach ( $input_decoded as $boxes => $box ){ foreach ( $box as $key => $value ){ $input_decoded[$boxes][$key] = wp_kses_post( $value ); } } return json_encode( $input_decoded ); } return $input; } /** * Sanitize site layout * * @since 1.0.0 */ function news_portal_sanitize_site_layout( $input ) { $valid_keys = array( 'fullwidth_layout' => __( 'Fullwidth Layout', 'news-portal' ), 'boxed_layout' => __( 'Boxed Layout', 'news-portal' ) ); if ( array_key_exists( $input, $valid_keys ) ) { return $input; } else { return ''; } } /** * switch option (show/hide) * * @since 1.0.0 */ function news_portal_sanitize_switch_option( $input ) { $valid_keys = array( 'show' => __( 'Show', 'news-portal' ), 'hide' => __( 'Hide', 'news-portal' ) ); if ( array_key_exists( $input, $valid_keys ) ) { return $input; } else { return ''; } } /*-----------------------------------------------------------------------------------------------------------------------*/ /** * Render the site title for the selective refresh partial. * * @since News Portal 1.0.1 * @see news_portal_customize_register() * * @return void */ function news_portal_customize_partial_blogname() { bloginfo( 'name' ); } /** * Render the site title for the selective refresh partial. * * @since News Portal 1.0.1 * @see news_portal_customize_register() * * @return void */ function news_portal_customize_partial_blogdescription() { bloginfo( 'description' ); } /** * Render the site title for the selective refresh partial. * * @since News Portal 1.0.1 * @see news_portal_footer_settings_register() * * @return void */ function news_portal_customize_partial_copyright() { return get_theme_mod( 'news_portal_copyright_text' ); } /** * Render the site title for the selective refresh partial. * * @since News Portal 1.0.1 * @see news_portal_design_settings_register() * * @return void */ function news_portal_customize_partial_related_title() { return get_theme_mod( 'news_portal_related_posts_title' ); } /** * Render the site title for the selective refresh partial. * * @since News Portal 1.0.1 * @see news_portal_design_settings_register() * * @return void */ function news_portal_customize_partial_archive_more() { return get_theme_mod( 'news_portal_archive_read_more_text' ); } /** * Render the site title for the selective refresh partial. * * @since News Portal 1.0.1 * @see news_portal_header_settings_register() * * @return void */ function news_portal_customize_partial_ticker_caption() { return get_theme_mod( 'news_portal_ticker_caption' ); }/** * Add extended Global and Categories section and it's fields inside Colors Section. * * @package Mystery Themes * @subpackage News Portal * @since 1.5.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } add_action( 'customize_register', 'news_portal_register_theme_colors_options' ); if ( ! function_exists( 'news_portal_register_theme_colors_options' ) ) : /** * Register theme options for Colors section. * * @param WP_Customize_Manager $wp_customize Object that holds the customizer data. * @since 1.0.0 */ function news_portal_register_theme_colors_options( $wp_customize ) { /* * Failsafe is safe */ if ( ! isset( $wp_customize ) ) { return; } /** * Add Color Section * * General Settings > Colors * * @uses $wp_customize->add_section() https://developer.wordpress.org/reference/classes/wp_customize_manager/add_section/ * @since 1.0.0 */ $wp_customize->add_section( new News_Portal_Customize_Section ( $wp_customize, 'news_portal_section_colors', array( 'priority' => 20, 'panel' => 'news_portal_general_settings_panel', 'title' => __( 'Colors', 'news-portal' ), ) ) ); /** * Add Base Colors Section * * General Settings > Colors * * @uses $wp_customize->add_section() https://developer.wordpress.org/reference/classes/wp_customize_manager/add_section/ * @since 1.0.0 */ $wp_customize->add_section( new News_Portal_Customize_Section ( $wp_customize, 'news_portal_section_colors_base', array( 'priority' => 10, 'panel' => 'news_portal_general_settings_panel', 'section' => 'news_portal_section_colors', 'title' => __( 'Base Colors', 'news-portal' ), ) ) ); /** * Color Picker field for Primary Theme Color * * General Settings > Colors > Base Colors * * @since 1.0.0 */ $wp_customize->add_setting( 'news_portal_theme_color', array( 'default' => news_portal_get_customizer_default ( 'news_portal_theme_color' ), 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'news_portal_theme_color', array( 'priority' => 5, 'section' => 'news_portal_section_colors_base', 'settings' => 'news_portal_theme_color', 'label' => __( 'Primary Theme Color', 'news-portal' ) ) ) ); /** * Color Picker field for Header Text Color * * General Settings > Colors > Base Colors * * @since 1.0.0 */ $wp_customize->add_setting( 'news_portal_site_title_color', array( 'default' => news_portal_get_customizer_default ( 'news_portal_site_title_color' ), 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'news_portal_site_title_color', array( 'priority' => 10, 'section' => 'news_portal_section_colors_base', 'settings' => 'news_portal_site_title_color', 'label' => __( 'Header Text Color', 'news-portal' ) ) ) ); /** * Category Color Section * * @since 1.0.0 */ $wp_customize->add_section( new News_Portal_Customize_Section ( $wp_customize, 'news_portal_categories_color_section', array( 'priority' => 10, 'panel' => 'news_portal_general_settings_panel', 'section' => 'news_portal_section_colors', 'title' => __( 'Categories Color', 'news-portal' ), ) ) ); $priority = 5; $categories = get_categories( array( 'hide_empty' => 1 ) ); $wp_category_list = array(); foreach ( $categories as $category_list ) { $wp_customize->add_setting( 'news_portal_category_color_'.esc_html( strtolower( $category_list->slug ) ), array( 'default' => '#00a9e0', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_hex_color' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'news_portal_category_color_'.esc_html( strtolower( $category_list->slug ) ), array( 'label' => sprintf( esc_html__( ' %s', 'news-portal' ), esc_html( $category_list->name ) ), 'section' => 'news_portal_categories_color_section', 'priority' => $priority ) ) ); $priority++; } } endif;/** * Add extended Global and Categories section and it's fields inside Social icons Section. * * @package Mystery Themes * @subpackage News Portal * @since 1.5.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } add_action( 'customize_register', 'news_portal_register_social_icons_options' ); if ( ! function_exists( 'news_portal_register_social_icons_options' ) ) : /** * Register theme options for Social Icons section. * * @param WP_Customize_Manager $wp_customize Object that holds the customizer data. * @since 1.0.0 */ function news_portal_register_social_icons_options( $wp_customize ) { /* * Failsafe is safe */ if ( ! isset( $wp_customize ) ) { return; } /** * Social Icons Section * * @since 1.0.0 */ $wp_customize->add_section( 'news_portal_social_icons_section', array( 'title' => esc_html__( 'Social Icons', 'news-portal' ), 'panel' => 'news_portal_general_settings_panel', 'priority' => 25, ) ); /** * Repeater field for social media icons * * @since 1.0.0 */ $wp_customize->add_setting( 'social_media_icons', array( 'sanitize_callback' => 'news_portal_sanitize_repeater', 'default' => json_encode(array( array( 'social_icon_class' => 'fab fa-facebook-f', 'social_icon_url' => '', ) )) ) ); $wp_customize->add_control( new News_Portal_Repeater_Controler( $wp_customize, 'social_media_icons', array( 'label' => __( 'Social Media Icons', 'news-portal' ), 'section' => 'news_portal_social_icons_section', 'settings' => 'social_media_icons', 'priority' => 5, 'news_portal_box_label' => __( 'Social Media Icon','news-portal' ), 'news_portal_box_add_control' => __( 'Add Icon','news-portal' ) ), array( 'social_icon_class' => array( 'type' => 'social_icon', 'label' => __( 'Social Media Logo', 'news-portal' ), 'description' => __( 'Choose social media icon.', 'news-portal' ) ), 'social_icon_url' => array( 'type' => 'url', 'label' => __( 'Social Icon Url', 'news-portal' ), 'description' => __( 'Enter social media url.', 'news-portal' ) ) ) ) ); /** * Upgrade field for social icons * * @since 1.5.0 */ $wp_customize->add_setting( 'news_preloader_upgrade_social_icons', array( 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( new News_Portal_Control_Upgrade( $wp_customize, 'news_preloader_upgrade_social_icons', array( 'priority' => 200, 'section' => 'news_portal_social_icons_section', 'settings' => 'news_preloader_upgrade_social_icons', 'label' => __( 'More Features with News Portal Pro', 'news-portal' ), 'choices' => news_portal_upgrade_choices( 'news_portal_social_icon' ) ) ) ); } endif;/** * Add extended Global and Categories section and it's fields inside Colors Section. * * @package Mystery Themes * @subpackage News Portal * @since 1.5.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } add_action( 'customize_register', 'news_portal_register_template_settings_options' ); if ( ! function_exists( 'news_portal_register_template_settings_options' ) ) : /** * Register theme options for Template Settings section. * * @param WP_Customize_Manager $wp_customize Object that holds the customizer data. * @since 1.0.0 */ function news_portal_register_template_settings_options( $wp_customize ) { /* * Failsafe is safe */ if ( ! isset( $wp_customize ) ) { return; } /** * Templates Settings * * @since 1.0.0 */ $wp_customize->add_section( 'news_portal_templates_settings_section', array( 'title' => __( 'Template Settings', 'news-portal' ), 'description' => __( 'Manage the settings for available templates.', 'news-portal' ), 'priority' => 45, 'panel' => 'news_portal_general_settings_panel', ) ); /** * Toggle option for homepage template content show hide * * @since 1.0.0 */ $wp_customize->add_setting( 'news_portal_home_template_content_option', array( 'default' => news_portal_get_customizer_default( 'news_portal_home_template_content_option' ), 'sanitize_callback' => 'news_portal_sanitize_checkbox' ) ); $wp_customize->add_control( new News_Portal_Control_Toggle( $wp_customize, 'news_portal_home_template_content_option', array( 'priority' => 10, 'section' => 'news_portal_templates_settings_section', 'settings' => 'news_portal_home_template_content_option', 'label' => __( 'Home Page Template', 'news-portal' ), 'description' => __( 'Show/Hide option to display content of the pages that uses home page template.', 'news-portal' ) ) ) ); /** * Toggle option for block base widget editor. * * @since 1.3.0 */ $wp_customize->add_setting( 'np_block_base_widget_editor_option', array( 'default' => news_portal_get_customizer_default( 'np_block_base_widget_editor_option' ), 'sanitize_callback' => 'news_portal_sanitize_checkbox' ) ); $wp_customize->add_control( new News_Portal_Control_Toggle( $wp_customize, 'np_block_base_widget_editor_option', array( 'priority' => 20, 'section' => 'news_portal_templates_settings_section', 'settings' => 'np_block_base_widget_editor_option', 'label' => __( 'Block Widget Editor Option', 'news-portal' ), 'description' => __( 'Enable/disable Block-based Widgets Editor(since WordPress 5.8).', 'news-portal' ) ) ) ); } endif;/** * Add extended Global and Categories section and it's fields inside header top area Section. * * @package Mystery Themes * @subpackage News Portal * @since 1.5.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } add_action( 'customize_register', 'news_portal_register_header_top_area_options' ); if ( ! function_exists( 'news_portal_register_header_top_area_options' ) ) : /** * Register theme options for top header area section. * * @param WP_Customize_Manager $wp_customize Object that holds the customizer data. * @since 1.0.0 */ function news_portal_register_header_top_area_options( $wp_customize ) { /* * Failsafe is safe */ if ( ! isset( $wp_customize ) ) { return; } /** * Top Header Section */ $wp_customize->add_section( 'news_portal_top_header_section', array( 'title' => __( 'Top Header Section', 'news-portal' ), 'priority' => 20, 'panel' => 'news_portal_header_settings_panel' ) ); /** * Toggle option for Top Header * * @since 1.0.0 */ $wp_customize->add_setting( 'news_portal_top_header_option', array( 'default' => news_portal_get_customizer_default( 'news_portal_top_header_option' ), 'sanitize_callback' => 'news_portal_sanitize_checkbox' ) ); $wp_customize->add_control( new News_Portal_Control_Toggle( $wp_customize, 'news_portal_top_header_option', array( 'priority' => 5, 'section' => 'news_portal_top_header_section', 'settings' => 'news_portal_top_header_option', 'label' => __( 'Top Header Section', 'news-portal' ), 'description' => __( 'Show/Hide option for top header section.', 'news-portal' ) ) ) ); /** * Toggle option for Current Date * * @since 1.0.0 */ $wp_customize->add_setting( 'news_portal_top_date_option', array( 'default' => news_portal_get_customizer_default( 'news_portal_top_date_option' ), 'sanitize_callback' => 'news_portal_sanitize_checkbox' ) ); $wp_customize->add_control( new News_Portal_Control_Toggle( $wp_customize, 'news_portal_top_date_option', array( 'priority' => 10, 'section' => 'news_portal_top_header_section', 'settings' => 'news_portal_top_date_option', 'label' => __( 'Current Date', 'news-portal' ), 'description' => __( 'Show/Hide option for current date at top header section.', 'news-portal' ), 'active_callback' => 'news_portal_has_enable_header_top_area' ) ) ); /** * Toggle option for Social Icon * * @since 1.0.0 */ $wp_customize->add_setting( 'news_portal_top_social_option', array( 'default' => news_portal_get_customizer_default( 'news_portal_top_social_option' ), 'sanitize_callback' => 'news_portal_sanitize_checkbox' ) ); $wp_customize->add_control( new News_Portal_Control_Toggle( $wp_customize, 'news_portal_top_social_option', array( 'priority' => 15, 'section' => 'news_portal_top_header_section', 'settings' => 'news_portal_top_social_option', 'label' => __( 'Social Icons', 'news-portal' ), 'description' => __( 'Show/Hide option for social media icons at top header section.', 'news-portal' ), 'active_callback' => 'news_portal_has_enable_header_top_area' ) ) ); } endif;/** * Add extended Global and Categories section and it's fields inside archive settings Section. * * @package Mystery Themes * @subpackage News Portal * @since 1.5.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } add_action( 'customize_register', 'news_portal_register_archive_settings_options' ); if ( ! function_exists( 'news_portal_register_archive_settings_options' ) ) : /** * Register theme options for archive settings section. * * @param WP_Customize_Manager $wp_customize Object that holds the customizer data. * @since 1.0.0 */ function news_portal_register_archive_settings_options( $wp_customize ) { /* * Failsafe is safe */ if ( ! isset( $wp_customize ) ) { return; } /** * Archive Settings * * @since 1.0.0 */ $wp_customize->add_section( 'news_portal_archive_settings_section', array( 'title' => esc_html__( 'Archive Settings', 'news-portal' ), 'panel' => 'news_portal_design_settings_panel', 'priority' => 5, ) ); /** * Image Radio field for archive layout * * @since 1.0.0 */ $wp_customize->add_setting( 'news_portal_archive_layout', array( 'default' => news_portal_get_customizer_default( 'news_portal_archive_layout' ), 'sanitize_callback' => 'news_portal_sanitize_select', ) ); $wp_customize->add_control( new News_Portal_Control_Radio_Image( $wp_customize, 'news_portal_archive_layout', array( 'priority' => 10, 'label' => esc_html__( 'Archive Layouts', 'news-portal' ), 'description' => esc_html__( 'Choose layout from available layouts', 'news-portal' ), 'section' => 'news_portal_archive_settings_section', 'choices' => news_portal_archive_layout_choices(), ) ) ); /** * Text field for archive read more * * @since 1.0.0 */ $wp_customize->add_setting( 'news_portal_archive_read_more_text', array( 'default' => news_portal_get_customizer_default( 'news_portal_archive_read_more_text' ), 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'news_portal_archive_read_more_text', array( 'type' => 'text', 'label' => esc_html__( 'Read More Text', 'news-portal' ), 'description' => __( 'Enter read more button text for archive page.', 'news-portal' ), 'section' => 'news_portal_archive_settings_section', 'priority' => 15 ) ); /** * Upgrade field for archive page * * @since 1.5.0 */ $wp_customize->add_setting( 'news_preloader_upgrade_archive_page', array( 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( new News_Portal_Control_Upgrade( $wp_customize, 'news_preloader_upgrade_archive_page', array( 'priority' => 200, 'section' => 'news_portal_archive_settings_section', 'settings' => 'news_preloader_upgrade_archive_page', 'label' => __( 'More Features with News Portal Pro', 'news-portal' ), 'choices' => news_portal_upgrade_choices( 'news_portal_archive_page' ) ) ) ); $wp_customize->selective_refresh->add_partial( 'news_portal_archive_read_more_text', array( 'selector' => '.np-archive-more > a', 'render_callback' => 'news_portal_customize_partial_archive_more', ) ); } endif;/** * Add extended Global and Categories section and it's fields inside footer main area Section. * * @package Mystery Themes * @subpackage News Portal * @since 1.5.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } add_action( 'customize_register', 'news_portal_register_footer_main_area_options' ); if ( ! function_exists( 'news_portal_register_footer_main_area_options' ) ) : /** * Register theme options for footer main area section. * * @param WP_Customize_Manager $wp_customize Object that holds the customizer data. * @since 1.0.0 */ function news_portal_register_footer_main_area_options( $wp_customize ) { /* * Failsafe is safe */ if ( ! isset( $wp_customize ) ) { return; } /** * Widget Area Section * * @since 1.0.0 */ $wp_customize->add_section( 'news_portal_footer_widget_section', array( 'title' => esc_html__( 'Widget Area', 'news-portal' ), 'panel' => 'news_portal_footer_settings_panel', 'priority' => 5, ) ); /** * Toggle option for footer widget area * * @since 1.0.0 */ $wp_customize->add_setting( 'news_portal_footer_widget_option', array( 'default' => news_portal_get_customizer_default( 'news_portal_footer_widget_option' ), 'sanitize_callback' => 'news_portal_sanitize_checkbox' ) ); $wp_customize->add_control( new News_Portal_Control_Toggle( $wp_customize, 'news_portal_footer_widget_option', array( 'priority' => 5, 'section' => 'news_portal_footer_widget_section', 'settings' => 'news_portal_footer_widget_option', 'label' => __( 'Footer Widget Section', 'news-portal' ), 'description' => __( 'Show/Hide option for footer widget area section.', 'news-portal' ) ) ) ); /** * Image Radio field for widget area column * * @since 1.0.0 */ $wp_customize->add_setting( 'footer_widget_layout', array( 'default' => news_portal_get_customizer_default( 'footer_widget_layout' ), 'sanitize_callback' => 'news_portal_sanitize_select', ) ); $wp_customize->add_control( new News_Portal_Control_Radio_Image( $wp_customize, 'footer_widget_layout', array( 'priority' => 10, 'label' => esc_html__( 'Footer Widget Layout', 'news-portal' ), 'description' => esc_html__( 'Choose layout from available layouts', 'news-portal' ), 'section' => 'news_portal_footer_widget_section', 'choices' => news_portal_footer_widget_layout_choices(), 'active_callback' => 'news_portal_has_enable_footer_widget' ) ) ); /** * Upgrade field for footer main area * * @since 1.5.0 */ $wp_customize->add_setting( 'news_preloader_upgrade_footer_main_area', array( 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( new News_Portal_Control_Upgrade( $wp_customize, 'news_preloader_upgrade_footer_main_area', array( 'priority' => 200, 'section' => 'news_portal_footer_widget_section', 'settings' => 'news_preloader_upgrade_footer_main_area', 'label' => __( 'More Features with News Portal Pro', 'news-portal' ), 'choices' => news_portal_upgrade_choices( 'news_portal_footer_area' ) ) ) ); } endif;/** * Add extended Global and Categories section and it's fields inside bottom footer Section. * * @package Mystery Themes * @subpackage News Portal * @since 1.5.0 */ // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } add_action( 'customize_register', 'news_portal_register_footer_bottom_options' ); if ( ! function_exists( 'news_portal_register_footer_bottom_options' ) ) : /** * Register theme options for bottom footer section. * * @param WP_Customize_Manager $wp_customize Object that holds the customizer data. * @since 1.0.0 */ function news_portal_register_footer_bottom_options( $wp_customize ) { /* * Failsafe is safe */ if ( ! isset( $wp_customize ) ) { return; } /** * Bottom Section * * @since 1.0.0 */ $wp_customize->add_section( 'news_portal_footer_bottom_section', array( 'title' => esc_html__( 'Bottom Section', 'news-portal' ), 'panel' => 'news_portal_footer_settings_panel', 'priority' => 10, ) ); /** * Text field for copyright * * @since 1.0.0 */ $wp_customize->add_setting( 'news_portal_copyright_text', array( 'default' => news_portal_get_customizer_default( 'news_portal_copyright_text' ), 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'news_portal_copyright_text', array( 'type' => 'text', 'label' => esc_html__( 'Copyright Text', 'news-portal' ), 'section' => 'news_portal_footer_bottom_section', 'priority' => 5 ) ); /** * Upgrade field for footer bottom area * * @since 1.5.0 */ $wp_customize->add_setting( 'news_preloader_upgrade_footer_bottom_area', array( 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( new News_Portal_Control_Upgrade( $wp_customize, 'news_preloader_upgrade_footer_bottom_area', array( 'priority' => 200, 'section' => 'news_portal_footer_bottom_section', 'settings' => 'news_preloader_upgrade_footer_bottom_area', 'label' => __( 'More Features with News Portal Pro', 'news-portal' ), 'choices' => news_portal_upgrade_choices( 'news_portal_bottom_area' ) ) ) ); $wp_customize->selective_refresh->add_partial( 'news_portal_copyright_text', array( 'selector' => 'span.np-copyright-text', 'render_callback' => 'news_portal_customize_partial_copyright', ) ); } endif;/** * Jetpack Compatibility File * * @link https://jetpack.com/ * * @package Mystery Themes * @subpackage News Portal * @since 1.0.0 */ /** * Jetpack setup function. * * See: https://jetpack.com/support/infinite-scroll/ * See: https://jetpack.com/support/responsive-videos/ */ function news_portal_jetpack_setup() { // Add theme support for Infinite Scroll. add_theme_support( 'infinite-scroll', array( 'container' => 'main', 'render' => 'news_portal_infinite_scroll_render', 'footer' => 'page', ) ); // Add theme support for Responsive Videos. add_theme_support( 'jetpack-responsive-videos' ); } add_action( 'after_setup_theme', 'news_portal_jetpack_setup' ); /** * Custom render function for Infinite Scroll. */ function news_portal_infinite_scroll_render() { while ( have_posts() ) { the_post(); if ( is_search() ) : get_template_part( 'template-parts/content', 'search' ); else : get_template_part( 'template-parts/content', get_post_format() ); endif; } }/** * News Portal custom function and work related to widgets. * * @package Mystery Themes * @subpackage News Portal * @since 1.0.0 */ /*-----------------------------------------------------------------------------------------------------------------------*/ /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function news_portal_widgets_init() { /** * Register right sidebar * * @since 1.0.0 */ register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'news-portal' ), 'id' => 'sidebar-1', 'description' => esc_html__( 'Add widgets here.', 'news-portal' ), 'before_widget' => '
', 'before_title' => 'It looks like nothing was found at this location.