Untitled

 avatar
unknown
plain_text
a month ago
1.4 kB
3
Indexable
<?php
/**
 * Core plugin functionality.
 *
 * @package BmacxCore
 */

namespace BmacxCore\Core;

use function BlackstoneCore\Utility\get_current_site;

/**
 * Default setup routine
 *
 * @return void
 */
function setup() {
    $n = function( $function ) {
        return __NAMESPACE__ . "\\$function";
    };

    // Hook into the Gutenberg editor and customize template options
    add_action( 'enqueue_block_editor_assets', $n( 'customize_gutenberg_template_options' ) );
    do_action( 'bmacx_core_loaded' );
}

/**
 * Customize Gutenberg Template Options for bmacx Site
 */
function customize_gutenberg_template_options() {
    $current_site = get_current_site();
    $current_theme = wp_get_theme()->get( 'Name' );

    // Check if we are on bmacx site and using the Blackstone V2 theme
    if ( $current_site === 'bmacx' && $current_theme === 'Blackstone V2' ) {
        // Filter the allowed template options in Gutenberg
        add_filter( 'blackstone_template_options_meta_keys', function( $meta_keys ) {
            // Only return the 'no_header_nav_key' and 'no_footer_nav_key' options for bmacx
            return [
                'no_header_nav_key' => $meta_keys['no_header_nav_key'],
                'no_footer_nav_key' => $meta_keys['no_footer_nav_key'],
            ];
        });
    }
}
Editor is loading...
Leave a Comment