e's design and stylesheet. * * Priority 0 to make it available to lower Priority callbacks. * * @global int $content_width */ function tripp_content_width() { /** * Filter Tripp content width of the theme. * * @param int $content_width Content width in pixels. */ $GLOBALS['content_width'] = apply_filters( 'tripp_content_width', 768 ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound, WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound } add_action( 'after_setup_theme', 'tripp_content_width', 0 ); /** * Registers sidebars and widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function tripp_register_sidebars() { register_sidebar( array( 'name' => esc_html__( 'Main Sidebar', 'tripp' ), 'id' => 'main', 'description' => esc_html__( 'Add widgets here to appear in the main sidebar on your site.', 'tripp' ), 'before_widget' => '
', 'before_title' => ' ', ) ); register_sidebar( array( 'name' => esc_html__( 'Desktop Menu', 'tripp' ), 'id' => 'menu', 'description' => esc_html__( 'Add widgets here to appear in the main navigation menu.', 'tripp' ), 'before_widget' => ' ', 'before_title' => ' ', ) ); register_sidebar( array( 'name' => esc_html__( 'Mobile Menu', 'tripp' ), 'id' => 'mobile-menu', 'description' => esc_html__( 'Add widgets here to appear in the mobile menu.', 'tripp' ), 'before_widget' => ' ', 'before_title' => ' ', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer #1', 'tripp' ), 'id' => 'footer-1', 'description' => esc_html__( 'Add widgets here to appear in the first column of the footer.', 'tripp' ), 'before_widget' => ' ', 'before_title' => ' ', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer #2', 'tripp' ), 'id' => 'footer-2', 'description' => esc_html__( 'Add widgets here to appear in the second column of the footer.', 'tripp' ), 'before_widget' => ' ', 'before_title' => ' ', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer #3', 'tripp' ), 'id' => 'footer-3', 'description' => esc_html__( 'Add widgets here to appear in the third column of the footer.', 'tripp' ), 'before_widget' => ' ', 'before_title' => ' ', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer #4', 'tripp' ), 'id' => 'footer-4', 'description' => esc_html__( 'Add widgets here to appear in the fourth column of the footer.', 'tripp' ), 'before_widget' => ' ', 'before_title' => ' ', ) ); } add_action( 'widgets_init', 'tripp_register_sidebars' ); /** * Registers styles and scripts. */ function tripp_register_assets() { $theme_version = wp_get_theme()->get( 'Version' ); /** * CSS Styles */ $style_deps = array(); if ( wp_style_is( 'flextension-extensions', 'registered' ) ) { $style_deps[] = 'flextension-extensions'; } if ( wp_style_is( 'flextension-elements', 'registered' ) ) { $style_deps[] = 'flextension-elements'; } /** * Filters an array of registered style handles this style depends on. * * @since 0.2.0 * * @param string[] $style_deps An array of registered style handles this style depends on. */ $style_deps = apply_filters( 'tripp_style_deps', $style_deps ); // Main CSS. wp_register_style( 'tripp', get_template_directory_uri() . '/style.css', $style_deps, $theme_version ); wp_style_add_data( 'tripp', 'rtl', 'replace' ); /** * JavaScrips */ // ScrollMagic. wp_register_script( 'scrollmagic', get_theme_file_uri( 'assets/js/vendor/ScrollMagic.min.js' ), array(), '2.0.7', true ); $script_deps = array( 'scrollmagic' ); if ( wp_script_is( 'flextension', 'registered' ) ) { $style_deps[] = 'flextension'; } /** * Filters an array of registered script handles this script depends on. * * @since 0.2.0 * * @param string[] $script_deps An array of registered script handles this script depends on. */ $script_deps = apply_filters( 'tripp_script_deps', $script_deps ); // Main App. wp_register_script( 'tripp', get_theme_file_uri( 'assets/js/main.js' ), $script_deps, $theme_version, true ); // Admin App. wp_register_script( 'tripp-editor', get_theme_file_uri( 'assets/js/editor.js' ), array( 'wp-data' ), $theme_version, true ); } add_action( 'init', 'tripp_register_assets' ); /** * Enqueues styles and scripts. */ function tripp_enqueue_assets() { wp_enqueue_style( 'tripp' ); tripp_add_custom_styles( 'tripp' ); $settings = array( 'ajaxUrl' => esc_url_raw( admin_url( 'admin-ajax.php' ) ), 'ajaxNonce' => wp_create_nonce( 'tripp_ajax' ), 'desktopMenuBreakpoint' => tripp_menu_breakpoint(), ); /** * Filters the theme settings. * * @param array $settings The current settings for the theme. */ $settings = apply_filters( 'tripp_settings', $settings ); wp_localize_script( 'tripp', 'trippSettings', $settings ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } wp_enqueue_script( 'tripp' ); } add_action( 'wp_enqueue_scripts', 'tripp_enqueue_assets' ); /** * Enqueues admin scripts and styles. */ function tripp_login_enqueue_assets() { $theme_version = wp_get_theme()->get( 'Version' ); // Admin CSS. wp_enqueue_style( 'tripp-login-page', get_theme_file_uri( 'assets/css/login-page.css' ), array(), $theme_version ); wp_style_add_data( 'tripp-login-page', 'rtl', 'replace' ); tripp_add_custom_styles( 'tripp-login-page' ); wp_enqueue_script( 'tripp-login-page', get_theme_file_uri( 'assets/js/login-page.js' ), array(), $theme_version, true ); } add_action( 'login_enqueue_scripts', 'tripp_login_enqueue_assets' ); /** * Enqueues block editor scripts and styles. */ function tripp_enqueue_block_editor_assets() { // Block Editor CSS. wp_enqueue_style( 'tripp-editor', get_theme_file_uri( 'assets/css/block-editor.css' ), array( 'wp-block-editor' ), wp_get_theme()->get( 'Version' ) ); wp_style_add_data( 'tripp-editor', 'rtl', 'replace' ); tripp_add_custom_styles( 'tripp-editor' ); // Admin App. wp_enqueue_script( 'tripp-editor' ); } add_action( 'enqueue_block_editor_assets', 'tripp_enqueue_block_editor_assets' ); /** * Walker Destination class. */ require get_parent_theme_file_path( 'inc/class-tripp-walker-destination.php' ); /** * Additional template functions. */ require get_parent_theme_file_path( 'inc/template-functions.php' ); /** * Loads co-authors template tags if the Co-Authors Plus plugin is active. */ if ( function_exists( 'get_coauthors' ) ) { require get_parent_theme_file_path( 'inc/co-authors-template-tags.php' ); } /** * Custom template tags for this theme. */ require get_parent_theme_file_path( 'inc/template-tags.php' ); /** * Custom template tags for coupons, promo codes, discounts & deals. */ require get_parent_theme_file_path( 'inc/coupon-template-tags.php' ); /** * Custom template tags for reviews. */ require get_parent_theme_file_path( 'inc/review-template-tags.php' ); /** * Template hooks. */ require get_parent_theme_file_path( 'inc/template-hooks.php' ); /** * WooCommerce template functions and hooks. */ if ( class_exists( 'WooCommerce', false ) ) { require get_parent_theme_file_path( 'inc/wc-template-functions.php' ); } /** * Breadcrumb Generator. */ require get_parent_theme_file_path( 'inc/class-tripp-breadcrumb-generator.php' ); /** * Theme Customizer. */ require get_parent_theme_file_path( 'inc/customizer/customizer.php' ); /** * TGM Plugin Activation */ require get_parent_theme_file_path( 'inc/vendor/class-tgm-plugin-activation.php' ); /** * Registers the recommended plugins for this theme. */ function tripp_register_plugins() { // Recommended plugins. $plugins = array( array( 'name' => esc_html__( 'Flextension', 'tripp' ), 'slug' => 'flextension', 'version' => '1.3.2', 'source' => 'https://wydethemes.com/plugins/flextension/flextension.1.3.2.zip', ), array( 'name' => esc_html__( 'Tripp XT', 'tripp' ), 'slug' => 'tripp-xt', 'version' => '1.1.2', 'source' => 'https://wydethemes.com/plugins/tripp-xt/tripp-xt.1.1.2.zip', ), ); /** * Filters the recommended plugins for the theme. * * @param array $plugins An array list of the recommended plugins. */ $plugins = apply_filters( 'tripp_plugins', $plugins ); // Configuration settings. $config = array( 'id' => 'tripp-1.3.0', 'menu' => 'install-plugins', 'strings' => array( 'page_title' => esc_html__( 'Install Plugins', 'tripp' ), ), ); tgmpa( $plugins, $config ); } add_action( 'tgmpa_register', 'tripp_register_plugins' ); /** * Note: Do not add any custom code here. Please use a Child theme or a custom plugin so that your customizations aren't lost during updates. * https://developer.wordpress.org/themes/advanced-topics/child-themes/ */