Untitled
in this file we want to get that template options only o header and no footer so when this plugin is activated then that gutenberg block should parse only those 2 here only so update code here accordingly for this file <?php /** * Core plugin functionality. * * @package BmacxCore */ namespace BmacxCore\Core; use BmacxCore\KitForms; use BmacxCore\Settings; use BlackstoneCore\EnableDarkTheme; use BlackstoneCore\CampaignHeader; use BlackstoneCore\FootnoteModals; use BlackstoneCore\Settings\SiteWideModal as SettingsSiteWideModal; use function BlackstoneCore\Utility\should_not_hide_content; use function BlackstoneCore\Utility\get_current_site; /** * Default setup routine * * @return void */ function setup() { $n = function( $function ) { return __NAMESPACE__ . "\\$function"; }; add_filter( 'bx_site_post_types', function() { return [ 'press-release', 'document', 'people', 'reusable-content', 'insight', 'modal', 'navigation-widget', 'portfolio-company', 'footnote' ]; } ); add_action( 'init', $n( 'init' ) ); add_filter( 'body_class', $n( 'body_classes' ) ); add_filter( 'blackstone_main_current_site', $n( 'set_current_site' ) ); add_action( 'after_setup_theme', $n( 'theme_setup' ) ); add_filter( 'bx_header_logo_link', $n( 'disable_header_logo_link' ) ); add_action( 'admin_init', $n( 'enable_theme_dark_theme_for_footer' ) ); do_action( 'bmacx_core_loaded' ); } /** * Initializes the plugin and fires an action other plugins can hook into. * * @return void */ function init() { $campaign_header = new CampaignHeader(); $campaign_header->register(); $settings_enable_dark_theme = new EnableDarkTheme(); $settings_enable_dark_theme->register(); $footnotemodal = new FootnoteModals(); $footnotemodal->register(); do_action( 'bmacx_core_init' ); } function theme_setup() { add_theme_support( 'announcement-banner' ); // add_theme_support( 'country-attestation-gating' ); // add_theme_support( 'sitewide-modal' ); } /** * Add additional body classes. * * @param array $classes Body classes. * @return array */ function body_classes( $classes ) { if ( should_not_hide_content() ) { return $classes; } $classes[] = 'hide-site-content'; return $classes; } /** * Set the Current Site Slug * * @return string */ function set_current_site() { return 'bmacx'; } /** * Disable Header Logo Link * * @param bool $enabled Logo link. * @return bool */ // function disable_header_logo_link( $enabled ) { // $is_fr = i18n\is_french_user(); // $current_template = get_page_template_slug(); // $no_link_template = [ // 'templates/page-no-header-navigation.php', // 'templates/page-no-header-footer-navigation.php', // ]; // if ( $is_fr && is_page() && in_array( $current_template, $no_link_template, true ) ) { // return false; // } // return $enabled; // } function enable_theme_dark_theme_for_footer() { register_setting( 'reading', 'bx_v2_theme_footer_color_theme', [ 'type' => 'string', 'sanitize_callback' => 'sanitize_text_field', ] ); // Add settings section add_settings_section( 'bx_theme_switcher_reading', esc_html__( 'Blackstone V2 Theme Switcher', 'blackstone' ), '__return_false', 'reading' ); // Add settings field add_settings_field( 'bx_v2_theme_footer_color_theme', esc_html__( 'Footer Color Theme', 'blackstone' ), function() { $color_themes = get_v2_color_themes(); $selected = get_option( 'bx_v2_theme_footer_color_theme', 'default' ); ?> <select name="bx_v2_theme_footer_color_theme"> <?php foreach ( $color_themes as $color_theme ) { ?> <option value="<?php echo esc_attr( $color_theme['value'] ); ?>" <?php selected( $selected, $color_theme['value'] ); ?> > <?php echo esc_html( $color_theme['label'] ); ?> </option> <?php } ?> </select> <p class="description"><?php esc_html_e( 'The color theme of the V2 Theme\'s Footer.', 'blackstone' ); ?></p> <?php }, 'reading', 'bx_theme_switcher_reading' ); } function get_v2_color_themes() { return [ [ 'label' => 'Default', 'value' => 'default' ], [ 'label' => 'Dark', 'value' => 'dark' ], ]; }
Leave a Comment