register_meta( 'HeroFeatured', array( 'type' => 'checkbox', 'name' => 'Hero Banner Featured Image', 'default' => '', 'desc' => __( 'Check to use this page/post featured image for the hero banner. If not checked, it defaults to the sitewide banner image is one is chosen, or color scheme.', 'accelerate-by-amp-publisher' ), 'post_type' => array( 'post', 'page' ), ) ); $ampacc->register_meta( 'HeroButton', array( 'type' => 'text', 'name' => 'Hero Button Link', 'desc' => __( 'Enter a link to include an action button in the hero Banner on this page, leave it blank to leave out the button.', 'accelerate-by-amp-publisher' ), 'post_type' => array( 'post', 'page' ), ) ); $ampacc->register_meta( 'HeroButtonText', array( 'type' => 'text', 'name' => 'Hero Button Text', 'desc' => __( 'Enter a text label to use in your action button if applicable (default as "Read More").', 'accelerate-by-amp-publisher' ), 'post_type' => array( 'post', 'page' ), ) ); $ampacc->register_customizer_section( 'primary', array( 'title' => __( 'Primary Theme Settings', 'accelerate-by-amp-publisher' ) ) ); $ampacc->register_customizer_section( 'basics', array( 'title' => __( 'General Layout / Styles', 'accelerate-by-amp-publisher' ) ) ); $ampacc->register_customizer_section( 'header', array( 'title' => __( 'Header', 'accelerate-by-amp-publisher' ) ) ); $ampacc->register_customizer_section( 'navbar', array( 'title' => __( 'Navigation Bars', 'accelerate-by-amp-publisher' ) ) ); $ampacc->register_customizer_section( 'archives', array( 'title' => __( 'Archives / Posts Lists', 'accelerate-by-amp-publisher' ) ) ); $ampacc->register_customizer_section( 'hero', array( 'title' => __( 'Title Bar / Hero Banner', 'accelerate-by-amp-publisher' ), 'description' => __( 'Pages and posts have a page title bar that falls below the header/nav bars. You choose the default colors/style for the bar, then add Hero Shot image support as desired.', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_section( 'socbar', array( 'title' => __( 'Social Button Bar', 'accelerate-by-amp-publisher' ) ) ); $ampacc->register_customizer_section( 'footer', array( 'title' => __( 'Footer', 'accelerate-by-amp-publisher' ) ) ); $ampacc->register_customizer_section( 'gutenberg', array( 'title' => __( 'Gutenberg Blocks', 'accelerate-by-amp-publisher' ) ) ); $thicksizes = array(); for ( $i = 0;$i <= 10; $i++ ) { $thicksizes[ $i . 'px' ] = $i . 'px';} $fontsizes = array(); for ( $i = 10;$i <= 20; $i++ ) { $fontsizes[ $i . 'px' ] = $i . 'px';} $menusizes = $fontsizes; for ( $i = 22;$i <= 40; $i += 2 ) { $fontsizes[ $i . 'px' ] = $i . 'px';} $nfontsizes = array(); for ( $i = 5;$i <= 40; $i++ ) { $nfontsizes[ $i . '0%' ] = $i . '0%';} $fweights = array(); $fweights['300'] = '300 Light'; $fweights['400'] = '400 Normal'; $fweights['500'] = '500 Medium'; $fweights['600'] = '600 Semi-Bold'; $fweights['700'] = '700 Bold'; $fweights['800'] = '800 Extra-Bold'; $fweights['900'] = '900 Black'; $defclr = '#08356C'; $defhov = '#8e8b85'; $defacc = '#cccccc'; $defnav = '#FFFFFF'; $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_accentlinecolor', array( 'type' => 'color', 'title' => __( 'Accent Color', 'accelerate-by-amp-publisher' ), 'code' => 'accent-color', 'default' => $defacc, 'description' => __( 'Used in a number of ways including shadows, accent lines, and title block patterns.', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_setting( 'hero_home', array( 'type' => 'checkbox', 'title' => __( 'Hero Banner - Home', 'accelerate-by-amp-publisher' ), 'default' => '1', 'description' => __( 'Use the Featured Image in the Hero Banner below the header. If no featured image is assigned, the Default Hero Image will be used instead. If left un-checked, you may still include a hero shot on a page-by-page (or post) basis.', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_setting( 'hero_blog', array( 'type' => 'checkbox', 'title' => __( 'Hero Banner - Blog', 'accelerate-by-amp-publisher' ), 'default' => '1', ) ); $ampacc->register_customizer_setting( 'hero_page', array( 'type' => 'checkbox', 'title' => __( 'Hero Banner - Pages', 'accelerate-by-amp-publisher' ), 'default' => '1', ) ); $ampacc->register_customizer_setting( 'hero_post', array( 'type' => 'checkbox', 'title' => __( 'Hero Banner - Posts', 'accelerate-by-amp-publisher' ), 'default' => '1', ) ); $ampacc->register_customizer_setting( 'hero_cats', array( 'type' => 'checkbox', 'title' => __( 'Hero Banner - Categories', 'accelerate-by-amp-publisher' ), 'default' => '1', 'description' => __( 'Categories have no local setting for using their Featured Image in the Hero Banner.', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_setting( 'titlebar_home', array( 'type' => 'checkbox', 'title' => __( 'Title Bar - Home', 'accelerate-by-amp-publisher' ), 'default' => '1', 'description' => __( 'Include the textual Title Bar on the Home page when using a static page as your home page, and not using the Featured Image as the Hero Banner.', 'accelerate-by-amp-publisher' ), ) ); $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_height', array( 'type' => 'select', 'title' => __( 'Maximum Height', 'accelerate-by-amp-publisher' ), 'code' => 'hero-height', 'choices' => $ampacc->get_size_choices( 'hero' ), 'default' => '400px', ) ); $ampacc->register_customizer_setting( 'hero_color', array( 'type' => 'color', 'title' => __( 'Text Color', 'accelerate-by-amp-publisher' ), 'code' => 'hero-font-color', 'default' => $defnav, ) ); $ampacc->register_customizer_setting( 'hero_bgcolor', array( 'type' => 'color', 'title' => __( 'Background Color', 'accelerate-by-amp-publisher' ), 'code' => 'hero-background-color', 'default' => $defclr, ) ); $ampacc->register_customizer_setting( 'hero_align', array( 'type' => 'select', 'title' => __( 'Text & Button 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( 'hero_defaultimage', array( 'type' => 'image', 'title' => __( 'Default Hero Image', 'accelerate-by-amp-publisher' ), 'code' => 'default-image', 'default' => '', ) ); $ampacc->register_customizer_setting( 'site_trimwords', array( 'type' => 'select', 'title' => __( 'Excerpt Trim Word Count', 'accelerate-by-amp-publisher' ), 'code' => 'excerpt-trim', 'default' => '50', 'choices' => array( '10' => '10', '15' => '15', '20' => '20', '25' => '25', '30' => '30', '35' => '35', '40' => '40', '45' => '45', '50' => '50', '55' => '55', '60' => '60', '70' => '70', '80' => '80', '90' => '90', '100' => '100', ), 'description' => 'Choose how many words to include before the post snippet is trimmed.', ) ); $displaymodes = array( 'particle' => __( 'Article', 'accelerate-by-amp-publisher' ), 'pimage' => __( 'Image Grid', 'accelerate-by-amp-publisher' ), 'pboth' => __( 'Image & Article', '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' => $displaymodes, 'description' => __( 'Choose a responsive style for displaying posts in category/blog post lists.', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_setting( 'home_postsdisplaymode', array( 'type' => 'select', 'title' => __( 'Home Page Posts Display Mode', 'accelerate-by-amp-publisher' ), 'code' => 'home-posts-display-mode', 'target' => '.posts-content', 'classes' => 'posts-', 'default' => 'pimage', 'choices' => $displaymodes, ) ); $ampacc->register_customizer_setting( 'blog_postsdisplaymode', array( 'type' => 'select', 'title' => __( 'Blog Page Posts Display Mode', 'accelerate-by-amp-publisher' ), 'code' => 'blog-posts-display-mode', 'target' => '.posts-content', 'classes' => 'posts-', 'default' => 'pboth', 'choices' => $displaymodes, ) ); $igridhits = 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' => $igridhits, 'default' => '300px', ) ); $ampacc->register_customizer_setting( 'site_displaybyline', array( 'type' => 'checkbox', 'title' => __( 'Display Byline (Date/Author)', 'accelerate-by-amp-publisher' ), 'code' => 'byline-display', 'pos' => 'block', 'neg' => 'none', 'default' => '1', ) ); $ampacc->register_customizer_setting( 'site_displaycommentflag', array( 'type' => 'checkbox', 'title' => __( 'Display Comment Count Flags', 'accelerate-by-amp-publisher' ), 'code' => 'comment-flag-display', 'pos' => 'block', 'neg' => 'none', 'default' => '1', ) ); $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_fontfamily', array( 'type' => 'text', 'title' => __( 'Font Family', 'accelerate-by-amp-publisher' ), 'default' => 'Open Sans', ) ); $ampacc->register_customizer_setting( 'site_googlefont', array( 'type' => 'checkbox', 'title' => __( 'Google Font', 'accelerate-by-amp-publisher' ), 'default' => '', 'description' => __( 'This box must be checked if you wish to load a Google Font for your Font Family.', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_setting( 'site_fontweight', array( 'type' => 'select', 'title' => __( 'Base Font Weight', 'accelerate-by-amp-publisher' ), 'code' => 'site-font-weight', 'default' => '300', 'choices' => $fweights, 'description' => __( 'Most fonts do not support all available font weights, they will default either Normal or Bold if the chosen weight is not supported.', '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' => $nfontsizes, ) ); $ampacc->register_customizer_setting( 'site_h1fontsize', array( 'type' => 'select', 'title' => 'H1 ' . __( 'Font Size', 'accelerate-by-amp-publisher' ), 'code' => 'h1-font-size', 'default' => '300%', 'choices' => $nfontsizes, ) ); $ampacc->register_customizer_setting( 'site_h2fontsize', array( 'type' => 'select', 'title' => 'H2 ' . __( 'Font Size', 'accelerate-by-amp-publisher' ), 'code' => 'h2-font-size', 'default' => '200%', 'choices' => $nfontsizes, ) ); $ampacc->register_customizer_setting( 'site_h3fontsize', array( 'type' => 'select', 'title' => 'H3 ' . __( 'Font Size', 'accelerate-by-amp-publisher' ), 'code' => 'h3-font-size', 'default' => '150%', 'choices' => $nfontsizes, ) ); $ampacc->register_customizer_setting( 'site_h4fontsize', array( 'type' => 'select', 'title' => 'H4 ' . __( 'Font Size', 'accelerate-by-amp-publisher' ), 'code' => 'h4-font-size', 'default' => '120%', 'choices' => $nfontsizes, ) ); $ampacc->register_customizer_setting( 'site_h5fontsize', array( 'type' => 'select', 'title' => 'H5 ' . __( 'Font Size', 'accelerate-by-amp-publisher' ), 'code' => 'h5-font-size', 'default' => '100%', 'choices' => $nfontsizes, ) ); $ampacc->register_customizer_setting( 'site_h6fontsize', array( 'type' => 'select', 'title' => 'H6 ' . __( 'Font Size', 'accelerate-by-amp-publisher' ), 'code' => 'h6-font-size', 'default' => '80%', 'choices' => $nfontsizes, ) ); $ampacc->register_customizer_setting( 'site_bylinesize', array( 'type' => 'select', 'title' => __( 'Byline Font Size (Date/Author)', 'accelerate-by-amp-publisher' ), 'code' => 'byline-font-size', 'default' => '80%', 'choices' => $nfontsizes, ) ); $ampacc->register_customizer_setting( 'site_breadcrumbsize', array( 'type' => 'select', 'title' => __( 'Breadcrumb Font Size', 'accelerate-by-amp-publisher' ), 'code' => 'crumbs-font-size', 'default' => '80%', 'choices' => $nfontsizes, ) ); $lineheightchoices = 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_lineheight', array( 'type' => 'select', 'title' => __( 'Body Line Height Muliplier', 'accelerate-by-amp-publisher' ), 'code' => 'site-line-height', 'default' => '1.8', 'choices' => $lineheightchoices, ) ); $ampacc->register_customizer_setting( 'site_fontcolor', array( 'type' => 'color', 'title' => __( 'Base Font Color', 'accelerate-by-amp-publisher' ), 'code' => 'site-font-color', 'default' => $defclr, ) ); $ampacc->register_customizer_setting( 'site_linkcolor', array( 'type' => 'color', 'title' => __( 'Base Link Color', 'accelerate-by-amp-publisher' ), 'code' => 'site-link-color', 'default' => $defclr, ) ); $ampacc->register_customizer_setting( 'site_linkhovercolor', array( 'type' => 'color', 'title' => __( 'Base Link Hover Color', 'accelerate-by-amp-publisher' ), 'code' => 'site-link-hover-color', 'default' => $defhov, ) ); $ampacc->register_customizer_setting( 'site_buttoncolor', array( 'type' => 'color', 'title' => __( 'Button Font Color', 'accelerate-by-amp-publisher' ), 'code' => 'button-font-color', 'default' => $defnav, ) ); $ampacc->register_customizer_setting( 'site_buttonhcolor', array( 'type' => 'color', 'title' => __( 'Button Hover Font Color', 'accelerate-by-amp-publisher' ), 'code' => 'button-font-hover-color', 'default' => $defclr, ) ); $ampacc->register_customizer_setting( 'site_buttonbgcolor', array( 'type' => 'color', 'title' => __( 'Button Color', 'accelerate-by-amp-publisher' ), 'code' => 'button-color', 'default' => $defclr, ) ); $ampacc->register_customizer_setting( 'site_buttonbghcolor', array( 'type' => 'color', 'title' => __( 'Button Hover Color', 'accelerate-by-amp-publisher' ), 'code' => 'button-hover-color', 'default' => $defnav, ) ); $ampacc->register_customizer_setting( 'site_buttonbordercolor', array( 'type' => 'color', 'title' => __( 'Button Border Color', 'accelerate-by-amp-publisher' ), 'code' => 'button-border-color', 'default' => $defacc, ) ); $ampacc->register_customizer_setting( 'site_buttonborderwidth', array( 'type' => 'select', 'title' => __( 'Button Border Width', 'accelerate-by-amp-publisher' ), 'code' => 'button-border-width', 'default' => '1px', 'choices' => $thicksizes, ) ); $ampacc->register_customizer_setting( 'site_imageborderwidth', array( 'type' => 'select', 'title' => __( 'Image Border Width', 'accelerate-by-amp-publisher' ), 'code' => 'image-border-width', 'default' => '0px', 'choices' => $thicksizes, 'description' => __( 'Used on post list images, including WooCommerce store items. No border is displayed when set to 0px.', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_setting( 'site_imagebordercolor', array( 'type' => 'color', 'title' => __( 'Image Border Color', 'accelerate-by-amp-publisher' ), 'code' => 'image-border-color', 'default' => '', ) ); $ampacc->register_customizer_setting( 'site_defaultimage', array( 'type' => 'image', 'title' => __( 'Default Missing Image', 'accelerate-by-amp-publisher' ), 'code' => 'default-image', 'default' => '', 'description' => __( 'When a post has no featured image, a default image is used instead. You may assign a different image from the Media Library.', 'accelerate-by-amp-publisher' ), ) ); $tbkmodes = array(); $tbkmodes['basic'] = __( 'Basic', 'accelerate-by-amp-publisher' ); $tbkmodes['lines'] = __( 'Lines', 'accelerate-by-amp-publisher' ); $tbkmodes['doubles'] = __( 'Double Lines', 'accelerate-by-amp-publisher' ); $tbkmodes['rounds'] = __( 'Rounds', 'accelerate-by-amp-publisher' ); $tbkmodes['dblrounds'] = __( 'Double Rounds', 'accelerate-by-amp-publisher' ); $tbkmodes['hashed'] = __( 'Hash Bars V1', 'accelerate-by-amp-publisher' ); $tbkmodes['hashed1'] = __( 'Hash Bars V2', 'accelerate-by-amp-publisher' ); $tbkmodes['hashed2'] = __( 'Hash Bars V3', 'accelerate-by-amp-publisher' ); $tbkmodes['hashed3'] = __( 'Hash Bars V4', 'accelerate-by-amp-publisher' ); $ampacc->register_customizer_setting( 'site_tbkdisplay', array( 'type' => 'select', 'title' => 'Gutenberg Heading Block Style', 'code' => 'title-block-style', 'choices' => $tbkmodes, 'default' => 'lines', 'description' => 'Add styling to the Gutenberg Heading Blocks in page or post content with bars using the site font, background and accent colors you have chosen in the Customizer. Individual Heading Block style and alignment settings will override these settings.', ) ); $ampacc->register_customizer_setting( 'site_tbkh1', array( 'type' => 'checkbox', 'title' => __( 'Style H1 Blocks', 'accelerate-by-amp-publisher' ), 'code' => 'h1-style', 'default' => '1', ) ); $ampacc->register_customizer_setting( 'site_tbkh2', array( 'type' => 'checkbox', 'title' => __( 'Style H2 Blocks', 'accelerate-by-amp-publisher' ), 'code' => 'h2-style', 'default' => '1', ) ); $ampacc->register_customizer_setting( 'site_tbkh3', array( 'type' => 'checkbox', 'title' => __( 'Style H3 Blocks', 'accelerate-by-amp-publisher' ), 'code' => 'h3-style', 'default' => '1', ) ); $ampacc->register_customizer_setting( 'site_tbkh4', array( 'type' => 'checkbox', 'title' => __( 'Style H4 Blocks', 'accelerate-by-amp-publisher' ), 'code' => 'h4-style', 'default' => '', ) ); $ampacc->register_customizer_setting( 'site_tbkh5', array( 'type' => 'checkbox', 'title' => __( 'Style H5 Blocks', 'accelerate-by-amp-publisher' ), 'code' => 'h5-style', 'default' => '', ) ); $ampacc->register_customizer_setting( 'site_tbkh6', array( 'type' => 'checkbox', 'title' => __( 'Style H6 Blocks', 'accelerate-by-amp-publisher' ), 'code' => 'h6-style', 'default' => '', ) ); $ampacc->register_customizer_setting( 'site_tbkalign', array( 'type' => 'select', 'title' => 'Text Alignment', 'code' => 'title-block-align', 'default' => 'center', 'choices' => array( 'left' => 'Left', 'center' => 'Center', 'right' => 'Right', ), ) ); $ampacc->register_customizer_setting( 'header_maxheight', array( 'type' => 'select', 'title' => __( 'Maximum Height', 'accelerate-by-amp-publisher' ), 'code' => 'banner-max-height', 'choices' => $ampacc->get_size_choices( 'thumbhead' ), 'default' => '100px', 'description' => __( 'Specify a max-height for the header (text/logo plus vertical padding).', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_setting( 'header_vpad', array( 'type' => 'select', 'title' => __( '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' => __( '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' => __( 'Background Color', 'accelerate-by-amp-publisher' ), 'code' => 'banner-background-color', 'default' => $defnav, ) ); $ampacc->register_customizer_setting( 'header_logoimage', array( 'type' => 'image', 'title' => __( 'Logo Image', 'accelerate-by-amp-publisher' ), 'code' => 'logo', 'default' => '', ) ); $ampacc->register_customizer_setting( 'header_display_blogname', array( 'type' => 'checkbox', 'title' => __( 'Display Blog Name', 'accelerate-by-amp-publisher' ), 'code' => 'site-title-display', 'pos' => 'block', 'neg' => 'none', 'default' => '1', ) ); $ampacc->register_customizer_setting( 'header_display_blogdesc', array( 'type' => 'checkbox', 'title' => __( 'Display Blog Description', 'accelerate-by-amp-publisher' ), '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' => $menusizes, ) ); $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' ), ), ) ); $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' ); $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' => $hovers, ) ); $ampacc->register_customizer_setting( 'subheader_bgcolor', array( 'type' => 'color', 'title' => __( 'Background Color', 'accelerate-by-amp-publisher' ), 'code' => 'navigatorbar-background-color', 'default' => $defnav, ) ); $ampacc->register_customizer_setting( 'subheader_bordertop', array( 'type' => 'color', 'title' => __( 'Top Border Color', 'accelerate-by-amp-publisher' ), 'code' => 'navigatorbar-border-top', 'default' => $defnav, ) ); $ampacc->register_customizer_setting( 'subheader_borderbot', array( 'type' => 'color', 'title' => __( 'Bottom Border Color', 'accelerate-by-amp-publisher' ), 'code' => 'navigatorbar-border-bottom', 'default' => $defnav, ) ); $ampacc->register_customizer_setting( 'subheader_menuactivecolor', array( 'type' => 'color', 'title' => __( 'Active Item / Effect Color', 'accelerate-by-amp-publisher' ), 'code' => 'navigatorbar-active-color', 'default' => $defclr, ) ); $ampacc->register_customizer_setting( 'subheader_txtcolor', array( 'type' => 'color', 'title' => __( 'Text Color', 'accelerate-by-amp-publisher' ), 'code' => 'navigatorbar-font-color', 'default' => $defclr, ) ); $ampacc->register_customizer_setting( 'subheader_menuhovertext', array( 'type' => 'color', 'title' => __( 'Hover Text Color', 'accelerate-by-amp-publisher' ), 'code' => 'navigatorbar-font-hover-color', 'default' => $defhov, ) ); $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 it\'s own set of styles. It includes the Main Menu (one level) and a Search Box.

You can also add a secondary Navbar below it popluated with links for WordPress and WooCommerce categories. Choose which pages will include them below.', '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( 'header_displayhomecatbar', array( 'type' => 'checkbox', 'title' => __( 'Home - Category Navbar', 'accelerate-by-amp-publisher' ), 'code' => 'home-categorybar-display', 'pos' => 'block', 'neg' => 'none', 'default' => false, 'target' => 'body', 'class' => 'homenav', 'description' => __( 'Includes top-level Wordpress categories.', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_setting( 'header_displayblogcatbar', array( 'type' => 'checkbox', 'title' => __( 'Blog - Category Navbar', 'accelerate-by-amp-publisher' ), 'code' => 'blog-categorybar-display', 'pos' => 'block', 'neg' => 'none', 'default' => false, 'target' => 'body', 'class' => 'blognav', 'description' => __( 'Includes top-level Wordpress categories.', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_setting( 'header_displaycatbar', array( 'type' => 'checkbox', 'title' => __( 'Child Category Navbar', 'accelerate-by-amp-publisher' ), 'code' => 'categorybar-display', 'pos' => 'block', 'neg' => 'none', 'default' => true, 'target' => 'body', 'class' => 'catnav', 'description' => __( 'Includes child categories on WordPress category pages.', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_setting( 'header_displaywoobar', array( 'type' => 'checkbox', 'title' => __( 'WooCommerce Product Category Bar', 'accelerate-by-amp-publisher' ), 'code' => 'woo-categorybar-display', 'pos' => 'block', 'neg' => 'none', 'default' => true, 'target' => 'body', 'class' => 'woonav', 'description' => __( 'Includes top-level product categories on the Shop/Store page, and children on product category pages. (requires WooCommerce)', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_setting( 'subheader_catbgcolor', array( 'type' => 'color', 'title' => __( 'Category Bar Background Color', 'accelerate-by-amp-publisher' ), 'code' => 'categorybar-background-color', 'default' => $defnav, 'neg' => '', ) ); $ampacc->register_customizer_setting( 'subheader_cattxtcolor', array( 'type' => 'color', 'title' => __( 'Category Bar Text Color', 'accelerate-by-amp-publisher' ), 'code' => 'categorybar-font-color', 'default' => $defclr, 'neg' => '', ) ); $ampacc->register_customizer_setting( 'subheader_catmenuhovertext', array( 'type' => 'color', 'title' => __( 'Category Bar Hover Text Color', 'accelerate-by-amp-publisher' ), 'code' => 'categorybar-font-hover-color', 'default' => $defhov, 'neg' => '', ) ); $ampacc->register_customizer_setting( 'subheader_catmenuactivecolor', array( 'type' => 'color', 'title' => __( 'Category Bar Active Item / Effect Color', 'accelerate-by-amp-publisher' ), 'code' => 'categorybar-active-color', 'default' => $defclr, 'pos' => '1', 'neg' => '', ) ); $ampacc->register_customizer_setting( 'subheader_catbordertop', array( 'type' => 'color', 'title' => __( 'Category Bar Top Border Color', 'accelerate-by-amp-publisher' ), 'code' => 'categorybar-border-top', 'default' => $defacc, 'description' => 'You may add a top border to separate the category bar from the nav bar. This is a separate setting from the Navigation Bar\'s matching setting.', ) ); $ampacc->register_customizer_setting( 'footer_displaysocial', array( 'type' => 'checkbox', 'title' => __( 'Display Social Button Bar', 'accelerate-by-amp-publisher' ), 'code' => 'footer-social-display', 'pos' => 'block', 'neg' => 'none', 'default' => '1', 'description' => __( 'You may add links to your page on popular social websites as icons in their own footer bar. To include an icon/button enter a URL into the associated Social Provider field below.', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_setting( 'social_footerbarcolor', array( 'type' => 'color', 'title' => __( 'Bar Background Color', 'accelerate-by-amp-publisher' ), 'code' => 'footer-social-background-color', 'default' => $defclr, ) ); $ampacc->register_customizer_setting( 'social_footervpad', array( 'type' => 'select', 'title' => __( 'Vertical Padding', 'accelerate-by-amp-publisher' ), 'code' => 'social-footer-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' => '30px', ) ); $ampacc->register_customizer_setting( 'social_footerstyle', array( 'type' => 'select', 'title' => __( 'Button Shape', 'accelerate-by-amp-publisher' ), 'code' => 'footer-social-style', 'default' => '', 'choices' => array( '' => __( 'No Button', 'accelerate-by-amp-publisher' ), 'square' => __( 'Square', 'accelerate-by-amp-publisher' ), 'round' => __( 'Rounded Square', 'accelerate-by-amp-publisher' ), 'circle' => __( 'Circle', 'accelerate-by-amp-publisher' ), ), ) ); $ampacc->register_customizer_setting( 'social_footersize', array( 'type' => 'select', 'title' => __( 'Footer Button Size', 'accelerate-by-amp-publisher' ), 'code' => 'footer-social-size', 'default' => '', 'choices' => array( '' => __( 'Normal', 'accelerate-by-amp-publisher' ), 'big' => __( 'Big', 'accelerate-by-amp-publisher' ), 'bigger' => __( 'Bigger', 'accelerate-by-amp-publisher' ), 'biggest' => __( 'Biggest', 'accelerate-by-amp-publisher' ), ), ) ); $ampacc->register_customizer_setting( 'social_footerfontcolor', array( 'type' => 'color', 'title' => __( 'Font Color', 'accelerate-by-amp-publisher' ), 'code' => 'footer-social-font-color', 'default' => $defnav, ) ); $ampacc->register_customizer_setting( 'social_footericoncolor', array( 'type' => 'color', 'title' => __( 'Icon Color', 'accelerate-by-amp-publisher' ), 'code' => 'footer-social-icon-color', 'default' => $defnav, ) ); $ampacc->register_customizer_setting( 'social_footericonhovercolor', array( 'type' => 'color', 'title' => __( 'Icon Hover Color', 'accelerate-by-amp-publisher' ), 'code' => 'footer-social-icon-hover-color', 'default' => $defnav, ) ); $ampacc->register_customizer_setting( 'social_footerbgcolor', array( 'type' => 'color', 'title' => __( 'Button Color', 'accelerate-by-amp-publisher' ), 'code' => 'footer-social-background-color', 'default' => $defnav, ) ); $ampacc->register_customizer_setting( 'social_footerbghovercolor', array( 'type' => 'color', 'title' => __( 'Button Hover Color', 'accelerate-by-amp-publisher' ), 'code' => 'footer-social-background-hover-color', 'default' => $defhov, ) ); $ampacc->register_customizer_setting( 'social_footerbordercolor', array( 'type' => 'color', 'title' => __( 'Button Border Color', 'accelerate-by-amp-publisher' ), 'code' => 'footer-social-border-color', 'default' => $defnav, ) ); $ampacc->register_customizer_setting( 'social_footertext', array( 'type' => 'text', 'title' => __( 'Social Bar Text', 'accelerate-by-amp-publisher' ), 'code' => 'social-footer-text', 'default' => '', 'description' => __( 'Enter text you wish to display before the icons in the Footer Social Bar.', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_setting( 'social_footerfontsize', array( 'type' => 'select', 'title' => __( 'Social Bar Font Size', 'accelerate-by-amp-publisher' ), 'code' => 'social-footer-font-size', 'default' => '20px', 'choices' => $fontsizes, ) ); $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 Blog Name and year. The © symbol is included automatically.', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_setting( 'footer_bgcolor', array( 'type' => 'color', 'title' => __( 'Background Color', 'accelerate-by-amp-publisher' ), 'code' => 'footer-background-color', 'default' => $defnav, ) ); $ampacc->register_customizer_setting( 'footer_textcolor', array( 'type' => 'color', 'title' => __( 'Text Color', 'accelerate-by-amp-publisher' ), 'code' => 'footer-font-color', 'default' => $defclr, ) ); $ampacc->register_customizer_setting( 'footer_texthovercolor', array( 'type' => 'color', 'title' => __( 'Menu Hover Text Color', 'accelerate-by-amp-publisher' ), 'code' => 'footer-font-hover-color', 'default' => $defhov, ) ); $ampacc->register_customizer_setting( 'seo_displaybreadcrumb', array( 'type' => 'checkbox', 'title' => __( 'Display Breadcrumbs', 'accelerate-by-amp-publisher' ), 'code' => 'crumbs-display', 'pos' => 'block', 'neg' => 'none', 'default' => '1', 'description' => __( 'Check to include the breadcrumb links on archives (category) and posts.', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_setting( 'seo_boldlast', array( 'type' => 'checkbox', 'title' => __( 'Bold Last Breadcrumb', 'accelerate-by-amp-publisher' ), 'code' => 'crumbs-bold-last', 'pos' => 'bold', 'neg' => 'normal', 'default' => '', ) ); $ampacc->register_customizer_setting( 'seo_displaylast', array( 'type' => 'checkbox', 'title' => __( 'Display Last Breadcrumb', 'accelerate-by-amp-publisher' ), 'code' => 'crumbs-hide-last', 'pos' => 'inline-block', 'neg' => 'none', 'default' => '1', ) ); $ampacc->register_customizer_setting( 'seo_breadcrumbsep', array( 'type' => 'text', 'title' => __( 'Breadcrumb Separator', 'accelerate-by-amp-publisher' ), 'code' => 'crumbs-separator', 'default' => '-', 'filter' => 'none', 'description' => __( 'Enter any normal character, or a FontAwesome icon code (IE: fa-angle-right).', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_setting( 'site_gdprconsent', array( 'type' => 'checkbox', 'title' => __( 'GDPR Consent (EU)', 'accelerate-by-amp-publisher' ), 'default' => '1', 'description' => __( 'Check this box to serve a cookie usage notification to users in the EU per GDPR requirements. It will not affect site behavior for non-EU visitors.', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_setting( 'site_consentlink', array( 'type' => 'text', 'title' => __( 'Consent Link', 'accelerate-by-amp-publisher' ), 'default' => '', 'filter' => 'none', 'description' => __( 'You may add a button to the GDPR consent form to link your Privacy Policy or Terms of Service page by entering a link to it here. If left blank, the button will not be displayed.', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_setting( 'site_consentbutton', array( 'type' => 'text', 'title' => __( 'Consent Link Button Text', 'accelerate-by-amp-publisher' ), 'default' => 'More Info', 'filter' => 'none', 'description' => __( 'Enter text for the added link button. If left blank, the button defaults to More Info.', 'accelerate-by-amp-publisher' ), ) ); $ampacc->register_customizer_setting( 'site_consenttext', array( 'type' => 'textarea', 'title' => __( 'Consent Text', 'accelerate-by-amp-publisher' ), 'default' => 'This site uses cookies to offer you a better browsing experience. By continuing to navigate through this site or by clicking Accept, you consent to the use of cookies on your device as described in our privacy notice.', 'filter' => 'none', ) ); $sprovs = $ampacc->amp_social_providers(); foreach ( $sprovs as $dex => $vex ) { $ampacc->register_customizer_setting( 'social_' . $dex, array( 'type' => 'text', 'title' => $vex, 'default' => '', 'filter' => 'none', ) ); } $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' ) ); add_theme_support( 'custom-background' ); /* Content width specification recommended by Theme Check. Not used by anything in the theme. */ if ( ! isset( $content_width ) ) { $content_width = 1200; } /* Register navigation menu locations: main and footer. */ register_nav_menus( array( 'main-nav' => 'Main Menu', 'footer-nav' => 'Footer Menu', ) ); /** * 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', amp_publisher( 'fontawesome' ) ); if ( ! is_admin() ) { if ( amp_publisher( 'nonamp' ) ) { wp_enqueue_script( 'ampnonamp-script', 'https://cdn.ampproject.org/v0.js' ); $gdprconsent = amp_publisher( 'customizer', 'site_gdprconsent' ); if ( true === $gdprconsent ) { wp_enqueue_script( 'ampnonamp-script-consent', 'https://cdn.ampproject.org/v0/amp-consent-0.1.js' ); wp_enqueue_script( 'ampnonamp-script-geo', 'https://cdn.ampproject.org/v0/amp-geo-0.1.js' ); } if ( function_exists( 'accpro_extends_amp_nonamp_script' ) ) { accpro_extends_amp_nonamp_script(); } } } /* 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( 'processed-theme-stylesheet', get_template_directory_uri() . '/istyle.css' ); wp_add_inline_style( 'processed-theme-stylesheet', amp_publisher( 'stylesheet' ) ); $goog = amp_publisher( 'customizer', 'site_googlefont' ); $font = amp_publisher( 'customizer', 'site_fontfamily' ); if ( $goog || '' === $font || 'Open Sans' === $font ) { $font = str_replace( ' ', '+', $font ); $weight = amp_publisher( 'customizer', 'site_fontweight' ); $weights = array(); $weights['400'] = '400'; $weights['400i'] = '400i'; $weights['700'] = '700'; $weights['700i'] = '700i'; $weights[ $weight ] = $weight; $weights[ $weight . 'i' ] = $weight . 'i'; wp_enqueue_style( 'ampacc-google-fonts', 'http://fonts.googleapis.com/css?family=' . $font . ':' . implode( ',', $weights ), false ); } } /** * Add bolding to Customizer interface labels to distinguish checkbox labels from other text. * * @since 1.0 */ function ampacc_admin_scripts() { add_editor_style( amp_publisher( 'fontawesome' ) ); $custom_css = '#customize-controls label{font-weight:bold;}'; wp_enqueue_style( 'ampacc-admin-style', get_template_directory_uri() . '/istyle.css' ); wp_add_inline_style( 'ampacc-admin-style', $custom_css ); } add_action( 'admin_enqueue_scripts', 'ampacc_admin_scripts' ); /** * Add style options to Gutenberg core Heading block. Load script file as enqueue, and styles as inline. * * @since 1.0 */ function ampacc_gutenberg_scripts() { wp_enqueue_script( 'ampacc-gutenberg-script', get_template_directory_uri() . '/gutenberg.js', array( 'wp-blocks', 'wp-dom-ready', 'wp-edit-post' ) ); wp_enqueue_style( 'ampacc-gutenberg-style', get_template_directory_uri() . '/istyle.css' ); wp_add_inline_style( 'ampacc-gutenberg-style', amp_publisher( 'gutenberg css' ) ); } add_action( 'enqueue_block_editor_assets', 'ampacc_gutenberg_scripts' ); /** * Display a Return to Shop button on WooCommerce Cart page. Setup for Comodo functionality used in one of our plugins. * * @since 1.0 */ function ampacc_before_cart() { if ( function_exists( 'wc_get_page_id' ) ) { $url = get_permalink( wc_get_page_id( 'shop' ) ); echo '
'; echo '' . esc_html__( 'Return to shop', 'accelerate-by-amp-publisher' ) . ''; if ( function_exists( 'ampacc_comodo' ) ) { ampacc_comodo();} echo '
'; } } add_action( 'woocommerce_before_cart', 'ampacc_before_cart', 999 ); /** * 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 amp_publisher( $command = '', $pass = '' ) { global $ampacc; $ret = $ampacc->amp_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' ); /** * Specify theme support for WooCommerce. * * @since 1.0 */ function woocommerce_support() { add_theme_support( 'woocommerce' ); } add_action( 'after_setup_theme', 'woocommerce_support' ); /** * Add "Featured Image" for categories. * * @since 1.0 */ function ampacc_add_category_fields() { amp_publisher( 'category fields', 'add' ); } add_action( 'category_add_form_fields', 'ampacc_add_category_fields' ); /** * Editor handler used by "Featured Image" for categories. * * @since 1.0 * * @param object $term Taxonomy data for category being edited. */ function ampacc_edit_category_fields( $term ) { amp_publisher( 'category fields', $term ); } add_action( 'category_edit_form_fields', 'ampacc_edit_category_fields', 10 ); /** * Editor save handler used by "Featured Image" for categories. * * PHPCodeSniffer WPCS : "Processing form data without nonce verification." No nonce is needed in this case, forcing ABSINT for variable (media ID), ignores any non-integer input. * * @since 1.0 * * @param integer $term_id Category ID for category being saved. */ function ampacc_save_category_fields( $term_id ) { if ( ! empty( $_POST['category_thumbnail_id'] ) ) {// input var okay;. $ctid = absint( $_POST['category_thumbnail_id'] );// input var okay;. if ( $ctid > 0 ) { update_term_meta( $term_id, 'thumbnail_id', $ctid ); } } } add_action( 'created_term', 'ampacc_save_category_fields', 10, 1 ); add_action( 'edit_term', 'ampacc_save_category_fields', 10, 1 ); /** * Prompt admin to install and activate the XWP AMP Plugin. * * @since 1.0 */ function ampacc_requires_plugin() { if ( is_admin() && current_user_can( 'activate_plugins' ) && ( ! function_exists( 'amp_init' ) ) ) { add_action( 'admin_notices', 'ampacc_requires_plugin_notice' ); } } add_action( 'admin_init', 'ampacc_requires_plugin' ); /** * Notice content for prompting admin to install and activate the XWP AMP Plugin. * * @since 1.0 */ function ampacc_requires_plugin_notice() { echo '
'; echo '

'; echo '

' . esc_html__( 'AMP PLUGIN REQUIRED', 'accelerate-by-amp-publisher' ) . '

'; echo esc_html__( 'This theme requires the ', 'accelerate-by-amp-publisher' ) . ' ' . esc_html__( 'AMP plugin by XWP', 'accelerate-by-amp-publisher' ) . '.'; echo '

'; echo '
'; }