tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/**
* Enable support for Post Thumbnails on posts and pages.
*/
add_theme_support( 'post-thumbnails' );
/**
* Add default posts and comments RSS feed links to head.
*/
add_theme_support( 'automatic-feed-links' );
/**
* Add support for block styles.
*/
add_theme_support( 'wp-block-styles' );
/**
* Add support for responsive embedded content.
*/
add_theme_support( 'responsive-embeds' );
/**
* Add support for wide alignment for blocks.
*/
add_theme_support( 'align-wide' );
register_nav_menus(
array(
'primary' => __( 'Primary Menu', 'brizy-starter' ),
'secondary' => __( 'Secondary Menu', 'brizy-starter' ),
'footer' => __( 'Footer Menu', 'brizy-starter' )
)
);
/**
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support(
'html5',
array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
)
);
/**
* Add support for core custom logo.
*/
add_theme_support(
'custom-logo',
array(
'height' => 150,
'width' => 150,
'flex-width' => true,
'flex-height' => true,
)
);
/**
* Add support for custom background.
*/
add_theme_support(
'custom-background',
array(
'default-color' => 'ffffff',
'default-image' => '',
)
);
/**
* Add support for custom header.
*/
add_theme_support(
'custom-header',
array(
'default-image' => '',
'default-text-color' => '000000',
'width' => 2000,
'height' => 250,
'flex-height' => true,
'wp-head-callback' => '',
'admin-head-callback' => '',
'admin-preview-callback' => '',
)
);
}
}
add_action( 'after_setup_theme', 'brizy_starter_theme_setup' );
/**
* Theme Scripts & Styles
*/
if ( ! function_exists( 'brizy_starter_theme_scripts_styles' ) ) {
function brizy_starter_theme_scripts_styles() {
wp_enqueue_style( 'brizy-starter-style', get_stylesheet_uri(), array(), wp_get_theme()->get( 'Version' ) );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
}
add_action( 'wp_enqueue_scripts', 'brizy_starter_theme_scripts_styles' );
if ( ! function_exists( 'brizy_starter_theme_post_thumbnail' ) ) :
/**
* Displays post thumbnail.
*/
function brizy_starter_theme_post_thumbnail() {
if ( is_singular() ) :
?>
' . esc_html__( 'This is a sample paragraph that you can customize to fit your needs.', 'brizy-starter' ) . '
', ) ); } add_action( 'init', 'brizy_starter_register_block_patterns' ); /** * Add editor style. */ function brizy_starter_add_editor_style() { add_editor_style( 'style.css' ); } add_action( 'after_setup_theme', 'brizy_starter_add_editor_style' ); /** * Set transient on theme activation to show plugin install notice */ function brizy_starter_theme_activation() { set_transient( 'brizy_starter_activation_notice', true, 5 * DAY_IN_SECONDS ); } add_action( 'after_switch_theme', 'brizy_starter_theme_activation' ); /** * Display admin notice to install Brizy plugin */ function brizy_starter_plugin_install_notice() { // Check if transient is set and user has permission if ( ! get_transient( 'brizy_starter_activation_notice' ) ) { return; } // Check if Brizy plugin is already installed or activated $plugin_path = 'brizy/brizy.php'; if ( is_plugin_active( $plugin_path ) ) { delete_transient( 'brizy_starter_activation_notice' ); return; } // Check if plugin is installed but not activated $installed_plugins = get_plugins(); $is_installed = isset( $installed_plugins[ $plugin_path ] ); // Build the plugin install/activate URL if ( $is_installed ) { $action_url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=' . $plugin_path ), 'activate-plugin_' . $plugin_path ); $button_text = __( 'Activate Brizy Plugin', 'brizy-starter' ); } else { $action_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=brizy' ), 'install-plugin_brizy' ); $button_text = __( 'Install Brizy Plugin', 'brizy-starter' ); } // Display the notice ?>