'shapla-page-options', 'title' => __( 'Shapla Settings', 'shapla' ), 'screen' => array( 'page', 'post', 'product' ), 'context' => 'side', 'priority' => 'low', 'fields' => array( array( 'type' => 'spacing', 'id' => 'page_content_padding', 'label' => __( 'Content Padding', 'shapla' ), 'description' => __( 'Leave empty to use value from theme options.', 'shapla' ), 'priority' => 10, 'section' => 'page_section', 'default' => array( 'top' => '', 'bottom' => '', ), 'output' => array( array( 'element' => array( '.site-content .content-area', '.site-content .widget-area', ), 'property' => 'padding', ), ), ), array( 'type' => 'buttonset', 'id' => 'interior_content_width', 'label' => __( 'Interior Content Width', 'shapla' ), 'description' => __( '"100% Width" will take all screen width. Useful when using page builder like Elementor. On block editor, only certain blocks takes 100% width.', 'shapla' ), 'priority' => 15, 'section' => 'page_section', 'default' => 'site-width', 'choices' => array( 'site-width' => __( 'Site Width', 'shapla' ), 'full-width' => __( '100% Width', 'shapla' ), ), ), array( 'type' => 'select', 'id' => 'sidebar_position', 'label' => __( 'Sidebar Position', 'shapla' ), 'description' => __( 'Controls sidebar position for current page.', 'shapla' ), 'priority' => 10, 'section' => 'sidebar_section', 'default' => 'default', 'choices' => array( 'default' => __( 'Default', 'shapla' ), 'left-sidebar' => __( 'Left', 'shapla' ), 'right-sidebar' => __( 'Right', 'shapla' ), 'full-width' => __( 'Disabled', 'shapla' ), ), ), array( 'type' => 'sidebars', 'id' => 'sidebar_widget_area', 'label' => __( 'Sidebar widget area', 'shapla' ), 'description' => __( 'Controls sidebar widget area for current page.', 'shapla' ), 'priority' => 10, 'section' => 'sidebar_section', 'default' => 'default', 'choices' => array( 'default' => __( 'Default', 'shapla' ), 'left' => __( 'Left', 'shapla' ), 'right' => __( 'Right', 'shapla' ), 'disabled' => __( 'Disabled', 'shapla' ), ), ), array( 'type' => 'buttonset', 'id' => 'hide_page_title', 'label' => __( 'Page Title Bar', 'shapla' ), 'description' => __( 'Controls title for current page.', 'shapla' ), 'priority' => 10, 'section' => 'page_title_bar_section', 'default' => 'off', 'choices' => array( 'off' => __( 'Show', 'shapla' ), 'on' => __( 'Hide', 'shapla' ), ), ), array( 'type' => 'buttonset', 'id' => 'show_breadcrumbs', 'label' => __( 'Breadcrumbs', 'shapla' ), 'description' => __( 'Controls breadcrumbs for current page.', 'shapla' ), 'priority' => 20, 'section' => 'page_title_bar_section', 'default' => 'default', 'choices' => array( 'default' => __( 'Default', 'shapla' ), 'on' => __( 'Show', 'shapla' ), 'off' => __( 'Hide', 'shapla' ), ), ), array( 'type' => 'buttonset', 'id' => 'show_post_navigation', 'label' => __( 'Post Navigation', 'shapla' ), 'description' => __( 'Controls navigation for current page.', 'shapla' ), 'priority' => 20, 'section' => 'page_title_bar_section', 'default' => 'default', 'choices' => array( 'default' => __( 'Default', 'shapla' ), 'on' => __( 'Show', 'shapla' ), 'off' => __( 'Hide', 'shapla' ), ), ), array( 'type' => 'buttonset', 'id' => 'transparent_header', 'label' => __( 'Transparent Header', 'shapla' ), 'description' => __( 'Show transparent header.', 'shapla' ), 'priority' => 30, 'section' => 'page_title_bar_section', 'default' => 'default', 'choices' => array( 'default' => __( 'Default', 'shapla' ), 'on' => __( 'Enable', 'shapla' ), 'off' => __( 'Disable', 'shapla' ), ), ), ), ); ( new \Shapla\Metabox\ClassicMetabox() )->add( $options ); } /** * Adds an admin notice upon successful activation. */ public function activation_admin_notice() { global $pagenow; if ( is_admin() && ( 'themes.php' == $pagenow ) && isset( $_GET['activated'] ) ) { add_action( 'admin_notices', array( $this, 'about_page_welcome_admin_notice' ), 99 ); } } public function about_page_welcome_admin_notice() { $welcome_url = admin_url( 'themes.php?page=shapla-welcome' ); $customize_url = admin_url( 'customize.php' ); echo '
'; echo '

' . esc_html__( 'Welcome! Thank you for choosing Shapla! To fully take advantage of the best our theme can offer please make sure you visit our ', 'shapla' ) . '

'; echo '

'; echo '' . esc_html__( 'About Shapla', 'shapla' ) . ''; echo '' . esc_html__( 'Start Customize', 'shapla' ) . ''; echo '

'; echo '
'; } /** * Load theme page scripts */ public function admin_scripts() { wp_enqueue_style( 'thickbox' ); wp_enqueue_script( 'thickbox' ); wp_enqueue_style( 'shapla-admin-style', SHAPLA_THEME_URI . '/assets/css/admin.css' ); } /** * Add custom footer text on plugins page. * * @param string $text * * @return string */ public function admin_footer_text( $text ) { global $hook_suffix; $footer_text = sprintf( esc_html__( 'If you like %1$s Shapla %2$s please leave us a %3$s rating. A huge thanks in advance!', 'shapla' ), '', '', '★★★★★' ); if ( $hook_suffix == 'appearance_page_shapla-welcome' ) { return $footer_text; } return $text; } /** * Add theme page */ public function shapla_admin_menu_page() { add_theme_page( __( 'Shapla', 'shapla' ), __( 'Shapla', 'shapla' ), 'manage_options', 'shapla-welcome', array( $this, 'welcome_page_callback' ) ); } /** * Theme page callback */ public function welcome_page_callback() { $theme = wp_get_theme( 'shapla' ); $ThemeName = $theme->get( 'Name' ); $ThemeVersion = $theme->get( 'Version' ); $ThemeDescription = $theme->get( 'Description' ); $welcome_title = sprintf( __( 'Welcome to %s!', 'shapla' ), $ThemeName ); $welcome_version = sprintf( __( 'Version %s', 'shapla' ), $ThemeVersion ); $tabs = array( 'getting_started' => __( 'Getting Started', 'shapla' ), 'recommended_plugins' => __( 'Useful Plugins', 'shapla' ), 'changelog' => __( 'Change log', 'shapla' ), ); $tab = isset( $_GET['tab'] ) ? wp_unslash( $_GET['tab'] ) : 'getting_started'; echo '
'; if ( ! empty( $welcome_title ) ) { echo '

' . esc_html( $welcome_title ) . '

'; } if ( ! empty( $ThemeDescription ) ) { echo '
' . wp_kses_post( $ThemeDescription ) . '
'; } echo ''; // Tabs echo ''; // Display content for current tab switch ( $tab ) { case 'changelog': $file_path = file_get_contents( SHAPLA_THEME_PATH . '/CHANGELOG.md' ); echo AdminUtils::parse_changelog( $file_path ); break; case 'recommended_plugins': echo '
'; self::recommended_plugins_html(); echo '
'; break; case 'getting_started': default: echo '
'; echo self::getting_started_html(); echo '
'; break; } echo '
'; } private static function getting_started_html() { $contents = array( array( 'title' => __( 'Go to the Customizer', 'shapla' ), 'description' => array( __( 'Using the WordPress Customizer you can easily customize every aspect of the theme.', 'shapla' ), ), 'action' => array( 'text' => __( 'Go to the Customizer', 'shapla' ), 'url' => admin_url( 'customize.php' ), ), ), array( 'title' => __( 'Get support', 'shapla' ), 'description' => array( __( 'If you need support, you can try posting on the theme support forum.', 'shapla' ), ), 'action' => array( 'text' => __( 'Visit support forum', 'shapla' ), 'url' => 'https://wordpress.org/support/theme/shapla', ), ), array( 'title' => __( 'Contribute to Shapla', 'shapla' ), 'description' => array( __( 'Would you like to translate Shapla into your language? You can get involved on WordPress.org', 'shapla' ), ), 'action' => array( 'text' => __( 'Translate Shapla', 'shapla' ), 'url' => 'https://translate.wordpress.org/projects/wp-themes/shapla', ), ), ); $html = '
'; foreach ( $contents as $content ) { $html .= '
'; $html .= '

' . esc_html( $content['title'] ) . '

'; foreach ( $content['description'] as $description ) { $html .= '

' . esc_html( $description ) . '

'; } if ( $content['action'] ) { $html .= '

' . esc_html( $content['action']['text'] ) . '

'; } $html .= '
'; } $html .= '
'; return $html; } private static function recommended_plugins_html() { $recommended_plugins = [ [ 'directory' => 'elementor', 'file' => 'class-coblocks.php' ], [ 'directory' => 'coblocks', 'file' => 'elementor.php' ], [ 'directory' => 'carousel-slider', 'file' => 'carousel-slider.php', ], [ 'directory' => 'filterable-portfolio', 'file' => 'filterable-portfolio.php', ], [ 'directory' => 'contact-form-7', 'file' => 'wp-contact-form-7.php', ], [ 'directory' => 'wordpress-seo', 'file' => 'wp-seo.php', ], [ 'directory' => 'woocommerce', 'file' => 'woocommerce.php', ], [ 'directory' => 'ti-woocommerce-wishlist', 'file' => 'ti-woocommerce-wishlist.php' ], [ 'directory' => 'updraftplus', 'file' => 'updraftplus.php', ], [ 'directory' => 'motopress-hotel-booking-lite', 'file' => 'motopress-hotel-booking.php', ], [ 'directory' => 'give', 'file' => 'give.php', ], [ 'directory' => 'stripe-payments', 'file' => 'accept-stripe-payments.php', ], ]; echo ''; } } } Shapla_Admin::init();