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_photology_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 ); add_action( 'admin_enqueue_scripts', array( $this, 'dashboard_scripts' ) ); // 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 Elipsis. * * @param string $more . * * @return string */ public function excerpt_elipsis( $more ) { if ( is_admin() ) { return $more; } return ''; } /** * Excerpt Length. * * @param int $length . * * @return int */ public function excerpt_length( $length ) { if ( is_admin() ) { return $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; } $button_text = __( 'Check it Now!', 'financio' ); $button_link = wp_nonce_url( self_admin_url( 'themes.php?page=financio-dashboard' ), 'install-plugin_gutenverse' ); ?>
esc_html__( 'Primary', 'photology' ), ) ); 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( 'photology-style', get_stylesheet_uri(), array(), PHOTOLOGY_VERSION ); wp_add_inline_style( 'photology-style', $this->load_font_styles() ); // enqueue additional core css. wp_enqueue_style( 'photology-core-add', PHOTOLOGY_URI . '/assets/css/core-add.css', array(), PHOTOLOGY_VERSION ); // enqueue core animation. wp_enqueue_script( 'photology-animate', PHOTOLOGY_URI . '/assets/js/index.js', array(), PHOTOLOGY_VERSION, true ); wp_enqueue_style( 'photology-animate', PHOTOLOGY_URI . '/assets/css/animation.css', array(), PHOTOLOGY_VERSION ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } /** * Enqueue scripts and styles. */ public function dashboard_scripts() { $screen = get_current_screen(); if ( $screen->id === 'appearance_page_photology-dashboard' ) { // enqueue css. wp_enqueue_style( 'photology-dashboard', PHOTOLOGY_URI . '/assets/css/dashboard.css', array(), PHOTOLOGY_VERSION ); // enqueue js. wp_enqueue_script( 'photology-dashboard', PHOTOLOGY_URI . '/assets/js/dashboard.js', array( 'wp-api-fetch' ), PHOTOLOGY_VERSION, true ); wp_localize_script( 'photology-dashboard', 'GutenThemeConfig', $this->theme_config() ); } } /** * Register static data to be used in theme's js file */ public function theme_config() { return array( 'images' => PHOTOLOGY_URI . '/assets/img/', 'title' => esc_html__( 'Get Advanced Templates for Free!', 'photology' ), 'description' => esc_html__( 'Install and activate Gutenverse plugin now to be able to use this theme\'s advanced templates. With Gutenverse plugin installed, you gain access to both advance version of templates and block patterns for free which all built using Gutenverse blocks.', 'photology' ), 'title2' => esc_html__( 'Comparison Using Gutenverse vs WordPress Core', 'photology' ), 'title3' => esc_html__( 'Benefits for Installing Photology\'s Gutenverse Version', 'photology' ), 'description3' => esc_html__( 'You can customize your website instantly with powerful and lightweight add-ons plugin for Gutenberg/FSE.', 'photology' ), 'note' => esc_html__( 'Note: Clicking the button will both install and activate Gutenverse plugin and templates for this theme. Please first backup your current templates if you have any changes to it.', 'photology' ), 'demo' => esc_html__( 'View Live Demo →', 'photology' ), 'demoUrl' => esc_url( 'https:/gutenverse.com/demo?name=photology' ), 'install' => wp_nonce_url( self_admin_url( 'themes.php?page=photology-dashboard&install-template=gutenverse' ), 'install-template_gutenverse' ), 'pages' => array( 'home' => PHOTOLOGY_URI . '/assets/img/page-home.webp', 'about' => PHOTOLOGY_URI . '/assets/img/page-about.webp', 'services' => PHOTOLOGY_URI . '/assets/img/page-services.webp', 'contact' => PHOTOLOGY_URI . '/assets/img/page-contact.webp', 'port' => PHOTOLOGY_URI . '/assets/img/page-single-portfolio.webp', ), 'table' => array( 'titles' => array( null, esc_html__( 'Gutenverse', 'photology' ), esc_html__( 'WordPress Core', 'photology' ), ), 'features' => array( esc_html__( 'Advanced Templates', 'photology' ), esc_html__( 'Responsive Styling', 'photology' ), esc_html__( 'Variety of Fonts', 'photology' ), esc_html__( 'Icon Library', 'photology' ), esc_html__( 'Animation Effects', 'photology' ), esc_html__( 'Form Builder', 'photology' ), ), ), 'benefits' => array( 'title' => esc_html__( 'Features', 'photology' ), 'features' => array( esc_html__( 'Modern and clean design', 'photology' ), esc_html__( '5+ Ready to use templates', 'photology' ), esc_html__( '15+ template parts', 'photology' ), esc_html__( 'Fully responsive layout', 'photology' ), esc_html__( 'Fully customizable', 'photology' ), ), ), ); } /** * Load Font Styles */ public function load_font_styles() { $font_families = array( 'Prata: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', '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', ); $fonts_url = add_query_arg( array( 'family' => implode( '&family=', $font_families ), 'display' => 'swap', ), 'https://fonts.googleapis.com/css2' ); $contents = wptt_get_webfont_url( esc_url_raw( $fonts_url ), 'woff' ); return "@import url({$contents});"; } /** * Load Editor Styles */ public function load_editor_styles() { wp_add_inline_style( 'wp-block-library', $this->load_font_styles() ); } }