load_hooks(); } /** * Load initial hooks. */ private function load_hooks() { // actions. add_action( 'init', array( $this, 'add_theme_templates' ) ); add_action( 'after_setup_theme', array( $this, 'theme_setup' ) ); add_action( 'after_theme_setup', array( $this, 'content_width' ), 0 ); add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); add_action( 'admin_notices', array( $this, 'notice_install_plugin' ) ); add_action( 'wp_ajax_startupzy_set_admin_notice_viewed', array( $this, 'notice_closed' ) ); add_action( 'admin_init', array( $this, 'load_editor_styles' ) ); add_action( 'admin_menu', array( $this, 'admin_menu' ) ); add_action( 'init', array( $this, 'register_block_patterns' ), 9 ); add_action( 'init', array( $this, 'register_block_styles' ), 9 ); // filters. add_filter( 'the_category', array( $this, 'render_categories' ) ); add_filter( 'excerpt_length', array( $this, 'excerpt_length' ) ); add_filter( 'excerpt_more', array( $this, 'excerpt_elipsis' ) ); } /** * Register Block Pattern. */ public function register_block_patterns() { new Block_Patterns(); } /** * Register Block Style. */ public function register_block_styles() { new Block_Styles(); } /** * Excerpt Length. * * @return int */ public function excerpt_elipsis() { return ''; } /** * Excerpt Length. * * @return int */ public function excerpt_length() { return 100; } /** * Render Categories. * * @param String $thelist String rendered. * * @return string */ public function render_categories( $thelist ) { return "
{$thelist}
"; } /** * Notice Closed */ public function notice_closed() { update_user_meta( get_current_user_id(), 'gutenverse_install_notice', 'true' ); die; } /** * Show notification to install Gutenverse Plugin. */ public function notice_install_plugin() { // Skip if gutenverse block activated. if ( defined( 'GUTENVERSE' ) ) { return; } // Skip if gutenverse pro activated. if ( defined( 'GUTENVERSE_PRO' ) ) { return; } $screen = get_current_screen(); if ( isset( $screen->parent_file ) && 'plugins.php' === $screen->parent_file && 'update' === $screen->id ) { return; } if ( 'true' === get_user_meta( get_current_user_id(), 'gutenverse_install_notice', true ) ) { return; } $plugin = 'gutenverse/gutenverse.php'; $installed_plugins = get_plugins(); $is_gutenverse_installed = isset( $installed_plugins[ $plugin ] ); if ( $is_gutenverse_installed ) { if ( ! current_user_can( 'activate_plugins' ) ) { return; } $button_text = __( 'Activate Gutenverse Plugin', 'startupzy' ); $button_link = wp_nonce_url( 'plugins.php?action=activate&plugin=' . $plugin . '&plugin_status=all&paged=1&s', 'activate-plugin_' . $plugin ); } else { if ( ! current_user_can( 'install_plugins' ) ) { return; } $button_text = __( 'Install Gutenverse Plugin', 'startupzy' ); $button_link = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=gutenverse' ), 'install-plugin_gutenverse' ); } ?>
Startupzy

' ) ) ) { ?>
esc_html__( 'Primary', 'startupzy' ), ) ); add_editor_style( array( './assets/css/core-add.css', ) ); add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', 'style', 'script', ) ); add_theme_support( 'customize-selective-refresh-widgets' ); } /** * Set the content width. */ public function content_width() { $GLOBALS['content_width'] = apply_filters( 'gutenverse_content_width', 960 ); } /** * Enqueue scripts and styles. */ public function enqueue_scripts() { wp_enqueue_style( 'startupzy-style', get_stylesheet_uri(), array(), STARTUPZY_VERSION ); wp_add_inline_style( 'startupzy-style', $this->load_font_styles() ); // enqueue additional core css. wp_enqueue_style( 'startupzy-core-add', STARTUPZY_URI . '/assets/css/core-add.css', array(), STARTUPZY_VERSION ); // enqueue core animation. wp_enqueue_script( 'startupzy-animate', STARTUPZY_URI . '/assets/js/index.js', array(), STARTUPZY_VERSION, true ); wp_enqueue_style( 'startupzy-animate', STARTUPZY_URI . '/assets/css/animation.css', array(), STARTUPZY_VERSION ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } /** * Load Font Styles */ public function load_font_styles() { return " @import url('https://fonts.googleapis.com/css2?family=Helvetica:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;1,100;1,200;1,300;1,400;1,500;1,600&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Heebo:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;1,100;1,200;1,300;1,400;1,500;1,600&display=swap'); "; } /** * Load Editor Styles */ public function load_editor_styles() { wp_add_inline_style( 'wp-block-library', $this->load_font_styles() ); } }