register_customizer_section( 'basics', array( 'title' => __( 'General Layout / Styles', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_section( 'headfoot', array( 'title' => __( 'Header / Footer', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_section( 'navbar', array( 'title' => __( 'Navigation Bar', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_section( 'titlebar', array( 'title' => __( 'Title Bar', 'accelerate-by-amp-publisher' ), 'description' => __( 'Pages and posts have a page title bar that falls below the header/nav bars. You may choose which page types will display it, and the colors/style for the bar.', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_section( 'archives', array( 'title' => __( 'Archives / Posts Lists', 'accelerate-by-amp-publisher' ), ) ); /** * Access default registration values and option arrays. * * @since 1.0.7 * * @param string $how Command for which value to return. */ function ampacc_regit( $how ) { $fontsizes = array(); for ( $i = 10;$i <= 20; $i++ ) { $fontsizes[ $i . 'px' ] = $i . 'px';} if ( 'menu-font-size' === $how ) { return $fontsizes;} $nfontsizes = array(); for ( $i = 5;$i <= 40; $i++ ) { $nfontsizes[ $i . '0%' ] = $i . '0%';} if ( 'font-size' === $how ) { return $nfontsizes;} if ( 'font-color' === $how ) { return '#08356C';} if ( 'hover-color' === $how ) { return '#8e8b85';} if ( 'bar-color' === $how ) { return '#FFFFFF';} $hovers = array(); $hovers[''] = __( 'None', 'accelerate-by-amp-publisher' ); $hovers['brackets'] = __( 'Brackets', 'accelerate-by-amp-publisher' ); $hovers['dropul'] = __( 'Underline Drop', 'accelerate-by-amp-publisher' ); $hovers['roof'] = __( 'Raise the Roof', 'accelerate-by-amp-publisher' ); $hovers['dots3'] = __( 'Dots', 'accelerate-by-amp-publisher' ); if ( 'hover-effects' === $how ) { return $hovers;} } $ampacc->register_customizer_setting( 'site_wrapconstrain', array( 'type' => 'select', 'title' => __( 'Content Max Width', 'accelerate-by-amp-publisher' ), 'code' => 'site-max-width', 'default' => '1400px', 'choices' => array( '100%' => __( 'No Limit', 'accelerate-by-amp-publisher' ), '900px' => '900px', '1000px' => '1000px', '1100px' => '1100px', '1200px' => '1200px', '1300px' => '1300px', '1400px' => '1400px', '1500px' => '1500px', '1600px' => '1600px', ), 'description' => __( 'Set a maximum width for the header, nav and page contents. Banner/section colors still extend to the browser edges.', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_setting( 'site_wrappad', array( 'type' => 'select', 'title' => __( 'Standard Padding', 'accelerate-by-amp-publisher' ), 'code' => 'site-padding', 'choices' => array( '20px' => '20px', '30px' => '30px', '40px' => '40px', '50px' => '50px', '60px' => '60px', '80px' => '80px', '100px' => '100px', ), 'default' => '50px', 'description' => __( 'Choose a standard padding size for a number of elements that use it. (IE: margins, body, image, post separation)', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_setting( 'site_sidebarwidth', array( 'type' => 'select', 'title' => __( 'Sidebar Width', 'accelerate-by-amp-publisher' ), 'code' => 'sidebar-width', 'choices' => array( '100px' => '100px', '150px' => '150px', '200px' => '200px', '250px' => '250px', '300px' => '300px', '350px' => '350px', '400px' => '400px', ), 'default' => '200px', 'description' => __( 'Choose a static width for the sidebar on pages that display it.', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_setting( 'site_sidebarhome', array( 'type' => 'checkbox', 'title' => __( 'Display Sidebar on Home Page', 'accelerate-by-amp-publisher' ), 'default' => '1', ) ); $ampacc->register_customizer_setting( 'site_sidebarblog', array( 'type' => 'checkbox', 'title' => __( 'Display Sidebar on Blog Page', 'accelerate-by-amp-publisher' ), 'default' => '1', ) ); $ampacc->register_customizer_setting( 'site_sidebarpage', array( 'type' => 'checkbox', 'title' => __( 'Display Sidebar on Pages', 'accelerate-by-amp-publisher' ), 'default' => '1', ) ); $ampacc->register_customizer_setting( 'site_sidebarpost', array( 'type' => 'checkbox', 'title' => __( 'Display Sidebar on Posts', 'accelerate-by-amp-publisher' ), 'default' => '1', ) ); $ampacc->register_customizer_setting( 'site_sidebarcats', array( 'type' => 'checkbox', 'title' => __( 'Display Sidebar on Categories', 'accelerate-by-amp-publisher' ), 'default' => '1', ) ); $ampacc->register_customizer_setting( 'site_accentcolor', array( 'type' => 'color', 'title' => __( 'Accent Color', 'accelerate-by-amp-publisher' ), 'code' => 'accent-color', 'default' => '#cccccc', 'description' => __( 'Used in a number of ways including shadows, accent lines, and title block patterns.', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_setting( 'titlebar_home', array( 'type' => 'checkbox', 'title' => __( 'Title Bar - Home', 'accelerate-by-amp-publisher' ), 'default' => '1', ) ); $ampacc->register_customizer_setting( 'titlebar_blog', array( 'type' => 'checkbox', 'title' => __( 'Title Bar - Blog', 'accelerate-by-amp-publisher' ), 'default' => '1', ) ); $ampacc->register_customizer_setting( 'titlebar_page', array( 'type' => 'checkbox', 'title' => __( 'Title Bar - Pages', 'accelerate-by-amp-publisher' ), 'default' => '1', ) ); $ampacc->register_customizer_setting( 'titlebar_post', array( 'type' => 'checkbox', 'title' => __( 'Title Bar - Posts', 'accelerate-by-amp-publisher' ), 'default' => '1', ) ); $ampacc->register_customizer_setting( 'titlebar_cats', array( 'type' => 'checkbox', 'title' => __( 'Title Bar - Categories', 'accelerate-by-amp-publisher' ), 'default' => '1', ) ); $ampacc->register_customizer_setting( 'hero_color', array( 'type' => 'color', 'title' => __( 'Text Color', 'accelerate-by-amp-publisher' ), 'code' => 'hero-font-color', 'default' => ampacc_regit( 'bar-color' ), ) ); $ampacc->register_customizer_setting( 'hero_bgcolor', array( 'type' => 'color', 'title' => __( 'Background Color', 'accelerate-by-amp-publisher' ), 'code' => 'hero-background-color', 'default' => ampacc_regit( 'font-color' ), ) ); $ampacc->register_customizer_setting( 'hero_align', array( 'type' => 'select', 'title' => __( 'Text Alignment', 'accelerate-by-amp-publisher' ), 'code' => 'hero-align', 'default' => 'center', 'choices' => array( 'left' => __( 'Left', 'accelerate-by-amp-publisher' ), 'center' => __( 'Center', 'accelerate-by-amp-publisher' ), 'right' => __( 'Right', 'accelerate-by-amp-publisher' ), ), ) ); $ampacc->register_customizer_setting( 'site_postsdisplaymode', array( 'type' => 'select', 'title' => __( 'Posts Page / Archives Display Mode', 'accelerate-by-amp-publisher' ), 'code' => 'posts-display-mode', 'target' => '.posts-content', 'classes' => 'posts-', 'default' => 'particle', 'choices' => array( 'particle' => __( 'Article', 'accelerate-by-amp-publisher' ), 'pimage' => __( 'Image Grid', 'accelerate-by-amp-publisher' ), 'pboth' => __( 'Image & Article', 'accelerate-by-amp-publisher' ), ), 'description' => __( 'Choose a responsive style for displaying posts in category/blog post lists.', 'accelerate-by-amp-publisher' ), ) ); $ampacc_gridhits = array_merge( array( '' => '[default] 300px' ), $ampacc->get_size_choices( 'fifty' ) ); $ampacc->register_customizer_setting( 'site_postsdisplayheight', array( 'type' => 'select', 'title' => __( 'Image Grid Max-Height', 'accelerate-by-amp-publisher' ), 'code' => 'image-grid-height', 'choices' => $ampacc_gridhits, 'default' => '300px', ) ); $ampacc->register_customizer_setting( 'site_imagelinks', array( 'type' => 'checkbox', 'title' => __( 'Post Images as Links', 'accelerate-by-amp-publisher' ), 'default' => '1', 'description' => __( 'This only applies to wider screens, the links are disabled in mobile mode (width 900px or less).', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_setting( 'site_fontsize', array( 'type' => 'select', 'title' => __( 'Base Font Size', 'accelerate-by-amp-publisher' ), 'code' => 'site-font-size', 'default' => '100%', 'choices' => ampacc_regit( 'font-size' ), ) ); $ampacc->register_customizer_setting( 'site_h1fontsize', array( 'type' => 'select', 'title' => 'H1 ' . __( 'Font Size', 'accelerate-by-amp-publisher' ), 'code' => 'h1-font-size', 'default' => '300%', 'choices' => ampacc_regit( 'font-size' ), ) ); $ampacc->register_customizer_setting( 'site_h2fontsize', array( 'type' => 'select', 'title' => 'H2 ' . __( 'Font Size', 'accelerate-by-amp-publisher' ), 'code' => 'h2-font-size', 'default' => '200%', 'choices' => ampacc_regit( 'font-size' ), ) ); $ampacc->register_customizer_setting( 'site_h3fontsize', array( 'type' => 'select', 'title' => 'H3 ' . __( 'Font Size', 'accelerate-by-amp-publisher' ), 'code' => 'h3-font-size', 'default' => '150%', 'choices' => ampacc_regit( 'font-size' ), ) ); $ampacc->register_customizer_setting( 'site_h4fontsize', array( 'type' => 'select', 'title' => 'H4 ' . __( 'Font Size', 'accelerate-by-amp-publisher' ), 'code' => 'h4-font-size', 'default' => '120%', 'choices' => ampacc_regit( 'font-size' ), ) ); $ampacc->register_customizer_setting( 'site_h5fontsize', array( 'type' => 'select', 'title' => 'H5 ' . __( 'Font Size', 'accelerate-by-amp-publisher' ), 'code' => 'h5-font-size', 'default' => '100%', 'choices' => ampacc_regit( 'font-size' ), ) ); $ampacc->register_customizer_setting( 'site_h6fontsize', array( 'type' => 'select', 'title' => 'H6 ' . __( 'Font Size', 'accelerate-by-amp-publisher' ), 'code' => 'h6-font-size', 'default' => '80%', 'choices' => ampacc_regit( 'font-size' ), ) ); $ampacc->register_customizer_setting( 'site_lineheight', array( 'type' => 'select', 'title' => __( 'Body Line Height Muliplier', 'accelerate-by-amp-publisher' ), 'code' => 'site-line-height', 'default' => '1.8', 'choices' => array( '1' => '1', '1.1' => '1.1', '1.2' => '1.2', '1.3' => '1.3', '1.4' => '1.4', '1.5' => '1.5', '1.6' => '1.6', '1.7' => '1.7', '1.8' => '1.8', '1.9' => '1.9', '2' => '2', '2.1' => '2.1', '2.2' => '2.2', '2.3' => '2.3', '2.4' => '2.4', '2.5' => '2.5', ), ) ); $ampacc->register_customizer_setting( 'site_fontcolor', array( 'type' => 'color', 'title' => __( 'Base Font Color', 'accelerate-by-amp-publisher' ), 'code' => 'site-font-color', 'default' => ampacc_regit( 'font-color' ), ) ); $ampacc->register_customizer_setting( 'site_linkcolor', array( 'type' => 'color', 'title' => __( 'Base Link Color', 'accelerate-by-amp-publisher' ), 'code' => 'site-link-color', 'default' => ampacc_regit( 'font-color' ), ) ); $ampacc->register_customizer_setting( 'site_linkhovercolor', array( 'type' => 'color', 'title' => __( 'Base Link Hover Color', 'accelerate-by-amp-publisher' ), 'code' => 'site-link-hover-color', 'default' => ampacc_regit( 'hover-color' ), ) ); $ampacc->register_customizer_setting( 'header_maxheight', array( 'type' => 'select', 'title' => __( 'Header Base Height', 'accelerate-by-amp-publisher' ), 'code' => 'banner-max-height', 'choices' => $ampacc->get_size_choices( 'thumbhead' ), 'default' => '100px', 'description' => __( 'Specify a base height for the header (text/logo plus vertical padding). It will grow bigger to accomodate the header text height.', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_setting( 'header_vpad', array( 'type' => 'select', 'title' => __( 'Header Vertical Padding', 'accelerate-by-amp-publisher' ), 'code' => 'banner-vpad', 'choices' => array( '0' => __( 'None', 'accelerate-by-amp-publisher' ), '10px' => '10px', '20px' => '20px', '30px' => '30px', '40px' => '40px', '50px' => '50px', '60px' => '60px', '70px' => '70px', '80px' => '80px', '90px' => '90px', '100px' => '100px', ), 'default' => '10px', ) ); $ampacc->register_customizer_setting( 'header_textalign', array( 'type' => 'select', 'title' => __( 'Header Text Alignment', 'accelerate-by-amp-publisher' ), 'code' => 'banner-text-align', 'choices' => array( '0' => __( 'None', 'accelerate-by-amp-publisher' ), 'left' => __( 'Left', 'accelerate-by-amp-publisher' ), 'center' => __( 'Center', 'accelerate-by-amp-publisher' ), 'right' => __( 'Right', 'accelerate-by-amp-publisher' ), ), 'default' => 'left', ) ); $ampacc->register_customizer_setting( 'header_bgcolor', array( 'type' => 'color', 'title' => __( 'Header Background Color', 'accelerate-by-amp-publisher' ), 'code' => 'banner-background-color', 'default' => ampacc_regit( 'bar-color' ), ) ); $ampacc->register_customizer_setting( 'header_display_blogname', array( 'type' => 'checkbox', 'title' => __( 'Display Site Title', 'accelerate-by-amp-publisher' ), 'section' => 'title_tagline', 'code' => 'site-title-display', 'pos' => 'block', 'neg' => 'none', 'default' => '1', ) ); $ampacc->register_customizer_setting( 'header_display_blogdesc', array( 'type' => 'checkbox', 'title' => __( 'Display Site Tagline', 'accelerate-by-amp-publisher' ), 'section' => 'title_tagline', 'code' => 'tagline-display', 'pos' => 'block', 'neg' => 'none', 'default' => '1', ) ); $ampacc->register_customizer_setting( 'header_display_blogdesc', array( 'type' => 'checkbox', 'title' => __( 'Display Site Tagline', 'accelerate-by-amp-publisher' ), 'section' => 'title_tagline', 'code' => 'tagline-display', 'pos' => 'block', 'neg' => 'none', 'default' => '1', ) ); $ampacc->register_customizer_setting( 'navmenu_menufontsize', array( 'type' => 'select', 'title' => __( 'Text Size', 'accelerate-by-amp-publisher' ), 'code' => 'navigatorbar-font-size', 'default' => '18px', 'choices' => ampacc_regit( 'menu-font-size' ), ) ); $ampacc->register_customizer_setting( 'navmenu_menucase', array( 'type' => 'select', 'title' => __( 'Text Case', 'accelerate-by-amp-publisher' ), 'code' => 'navigatorbar-font-case', 'default' => 'none', 'choices' => array( 'none' => __( 'None', 'accelerate-by-amp-publisher' ), 'capitalize' => __( 'Capitalize', 'accelerate-by-amp-publisher' ), 'uppercase' => __( 'Upper Case', 'accelerate-by-amp-publisher' ), 'lowercase' => __( 'Lower Case', 'accelerate-by-amp-publisher' ), ), ) ); $ampacc->register_customizer_setting( 'navmenu_hovereffect', array( 'type' => 'select', 'title' => __( 'Menu Hover Effect (animation)', 'accelerate-by-amp-publisher' ), 'code' => 'navigatorbar-hover-effect', 'default' => '', 'target' => '.mnav', 'classes' => '', 'choices' => ampacc_regit( 'hover-effects' ), ) ); $ampacc->register_customizer_setting( 'subheader_bgcolor', array( 'type' => 'color', 'title' => __( 'Background Color', 'accelerate-by-amp-publisher' ), 'code' => 'navigatorbar-background-color', 'default' => ampacc_regit( 'bar-color' ), ) ); $ampacc->register_customizer_setting( 'subheader_menuactivecolor', array( 'type' => 'color', 'title' => __( 'Active Item / Effect Color', 'accelerate-by-amp-publisher' ), 'code' => 'navigatorbar-active-color', 'default' => ampacc_regit( 'font-color' ), ) ); $ampacc->register_customizer_setting( 'subheader_txtcolor', array( 'type' => 'color', 'title' => __( 'Text Color', 'accelerate-by-amp-publisher' ), 'code' => 'navigatorbar-font-color', 'default' => ampacc_regit( 'font-color' ), ) ); $ampacc->register_customizer_setting( 'subheader_menuhovertext', array( 'type' => 'color', 'title' => __( 'Hover Text Color', 'accelerate-by-amp-publisher' ), 'code' => 'navigatorbar-font-hover-color', 'default' => ampacc_regit( 'hover-color' ), ) ); $ampacc->register_customizer_setting( 'header_displaynavbar', array( 'type' => 'checkbox', 'title' => __( 'Display Navigation Bar', 'accelerate-by-amp-publisher' ), 'code' => 'navigatorbar-display', 'pos' => 'block', 'neg' => 'none', 'default' => '1', 'description' => __( 'The navigation bar below the header has a number of custom styling options. It includes the Main Menu (top level only) and an optional Search Box. This setting will not affect the mobile menu.', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_setting( 'navmenu_searchhome', array( 'type' => 'checkbox', 'title' => __( 'Display Search Box on Home Page', 'accelerate-by-amp-publisher' ), 'default' => '1', ) ); $ampacc->register_customizer_setting( 'navmenu_searchblog', array( 'type' => 'checkbox', 'title' => __( 'Display Search Box on Blog Page', 'accelerate-by-amp-publisher' ), 'default' => '1', ) ); $ampacc->register_customizer_setting( 'navmenu_searchcats', array( 'type' => 'checkbox', 'title' => __( 'Display Search Box on Categories', 'accelerate-by-amp-publisher' ), 'default' => '1', ) ); $ampacc->register_customizer_setting( 'navmenu_searchpage', array( 'type' => 'checkbox', 'title' => __( 'Display Search Box on Pages', 'accelerate-by-amp-publisher' ), 'default' => '1', ) ); $ampacc->register_customizer_setting( 'navmenu_searchpost', array( 'type' => 'checkbox', 'title' => __( 'Display Search Box on Posts', 'accelerate-by-amp-publisher' ), 'default' => '1', ) ); $ampacc->register_customizer_setting( 'footer_copyrighttext', array( 'type' => 'text', 'title' => __( 'Copyright Text', 'accelerate-by-amp-publisher' ), 'code' => 'copyright', 'default' => '', 'description' => __( 'If left blank, it uses the Site Title and year. The © symbol is included automatically.', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_setting( 'footer_bgcolor', array( 'type' => 'color', 'title' => __( 'Footer Background Color', 'accelerate-by-amp-publisher' ), 'code' => 'footer-background-color', 'default' => ampacc_regit( 'bar-color' ), ) ); $ampacc->register_customizer_setting( 'footer_textcolor', array( 'type' => 'color', 'title' => __( 'Footer Text Color', 'accelerate-by-amp-publisher' ), 'code' => 'footer-font-color', 'default' => ampacc_regit( 'font-color' ), ) ); $ampacc->register_customizer_setting( 'footer_texthovercolor', array( 'type' => 'color', 'title' => __( 'Footer Menu Hover Text Color', 'accelerate-by-amp-publisher' ), 'code' => 'footer-font-hover-color', 'default' => ampacc_regit( 'hover-color' ), ) ); $ampacc->init(); /* Not sure why these aren't supported by default, we like them. Theme Check recommends suporting title-tag, but it still requires a support call? */ add_theme_support( 'post-thumbnails' ); add_theme_support( 'title-tag' ); add_theme_support( 'automatic-feed-links' ); add_theme_support( 'html5', array( 'comment-list', 'search-form', 'comment-form' ) ); /* Add support for custom header and background in Customizer interface. */ add_theme_support( 'custom-header', array( 'default-text-color' => '08356C', 'header-text' => false, ) ); add_theme_support( 'custom-background' ); /* FIX 1.0.2 - Switched to custom-logo support. */ add_theme_support( 'custom-logo' ); if ( ! isset( $content_width ) ) { $content_width = 1200; } /* Register navigation menu locations: main and footer. */ register_nav_menus( array( 'main-nav' => __( 'Main Menu', 'accelerate-by-amp-publisher' ), 'footer-nav' => __( 'Footer Menu', 'accelerate-by-amp-publisher' ), ) ); /** * Add action for enqueueing scripts. * * @since 1.0 */ function ampacc_init() { add_action( 'wp_enqueue_scripts', 'ampacc_init_scripts' ); } add_action( 'init', 'ampacc_init', 9999 ); /** * Enqueue scripts and styles used in the theme. * * @since 1.0 */ function ampacc_init_scripts() { wp_enqueue_style( 'ampacc-fa-style', ampacc_publisher( 'fontawesome' ), array(), '5.5.0' ); /* Must have an empty dependant stylesheet in order to load the processed main stylesheet into the header using wp_add_inline_style()... yah, I know, right? */ wp_enqueue_style( 'ampacc-processed-theme-stylesheet', get_template_directory_uri() . '/istyle.css', array(), '1.0.8' ); wp_add_inline_style( 'ampacc-processed-theme-stylesheet', ampacc_publisher( 'stylesheet' ) ); wp_enqueue_style( 'ampacc-google-fonts', 'http://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,700,700i', array(), '1.0' ); } /** * Add bolding to Customizer interface labels to distinguish labels from other text. * * @since 1.0 */ function ampacc_admin_scripts() { if ( is_customize_preview() ) { add_editor_style( ampacc_publisher( 'fontawesome' ) ); $custom_css = '#customize-controls label, .customize-control-title{font-weight:bold;}'; wp_enqueue_style( 'ampacc-admin-style', get_template_directory_uri() . '/istyle.css', array(), '1.0.8' ); wp_add_inline_style( 'ampacc-admin-style', $custom_css ); } } add_action( 'admin_enqueue_scripts', 'ampacc_admin_scripts' ); /** * This function is used in the theme functions and template files for accessing class methods. It is available to admins for modifying or creating a child theme. * * @since 1.0 * * @param string $command Base command used for class method calls from theme, see template files for examples. * @param string $pass Variable used used by some class method calls to determine action. * @return mixed $ret Most methods echo requested output, some return a boolean value for checks, and some return processed or Customizer values. */ function ampacc_publisher( $command = '', $pass = '' ) { global $ampacc; $ret = $ampacc->ampacc_publisher( $command, $pass ); return $ret; } /** * Register sidebar for including WP widgets. Sidebar can be excluded from certain page types in the Customizer. * * @since 1.0 */ function ampacc_widgets_init() { register_sidebar( array( 'id' => 'mainsidebar', 'name' => __( 'Sidebar', 'accelerate-by-amp-publisher' ), 'description' => __( 'Choose page types to display the sidebar in the Customizer.', 'accelerate-by-amp-publisher' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'ampacc_widgets_init' ); /** * Prompt admin to install and activate the XWP AMP Plugin. * * @since 1.0 */ function ampacc_recommend_plugin() { if ( is_admin() && current_user_can( 'activate_plugins' ) && ( ! function_exists( 'amp_init' ) ) ) { if ( ! get_option( 'ampacc_recampplugin_dismissed', false ) ) { $gets = wp_unslash( $_GET );// input var okay; WPCS: CSRF ok. if ( isset( $gets['ampacc-hide-notice'] ) && 'recampplugin' === esc_attr( $gets['ampacc-hide-notice'] ) && isset( $gets['nonce'] ) && wp_verify_nonce( esc_attr( $gets['nonce'] ), 'ampacc-hide-notice' ) ) { update_option( 'ampacc_recampplugin_dismissed', true ); wp_safe_redirect( admin_url( '' ) ); exit; } else { add_action( 'admin_notices', 'ampacc_recommend_plugin_notice' ); if ( ! defined( 'AMPACC_PLUGIN_NOTICE_RECOMMENDED' ) ) { define( 'AMPACC_PLUGIN_NOTICE_RECOMMENDED', true ); } } } } } add_action( 'admin_init', 'ampacc_recommend_plugin' ); /** * Add styles for notice dismiss link. * * @since 1.0 */ function ampacc_notice_script() { if ( defined( 'AMPACC_PLUGIN_NOTICE_RECOMMENDED' ) ) { echo ''; } } add_action( 'admin_print_scripts', 'ampacc_notice_script' ); /** * Notice content for prompting admin to install and activate the XWP AMP Plugin. * * @since 1.0 */ function ampacc_recommend_plugin_notice() { echo '
'; echo '

'; echo '

' . esc_html__( 'AMP Plugin Recommended', 'accelerate-by-amp-publisher' ) . '
'; echo esc_html__( 'This theme recommends using the ', 'accelerate-by-amp-publisher' ) . ' ' . esc_html__( 'AMP plugin by XWP', 'accelerate-by-amp-publisher' ) . '.'; echo '

'; $nonce = wp_create_nonce( 'ampacc-hide-notice' ); $url = add_query_arg( array( 'ampacc-hide-notice' => 'recampplugin', 'nonce' => $nonce, ), admin_url( '' ) ); echo '' . esc_html__( 'Dismiss', 'accelerate-by-amp-publisher' ) . ''; echo '
'; }