tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); /* * Enable support for Post Thumbnails on posts and pages. * * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ */ add_theme_support( 'post-thumbnails' ); // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'primary' => esc_html__( 'Primary', 'ampface' ), ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', ) ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'ampface_custom_background_args', array( 'default-color' => 'ffffff', 'default-image' => '', ) ) ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); /** * Add support for core custom logo. * * @link https://codex.wordpress.org/Theme_Logo */ add_theme_support( 'custom-logo', array( 'height' => 250, 'width' => 250, 'flex-width' => true, 'flex-height' => true, ) ); } endif; add_action( 'after_setup_theme', 'ampface_setup' ); /** * Set the content width in pixels, based on the theme's design and stylesheet. * * Priority 0 to make it available to lower priority callbacks. * * @global int $content_width */ function ampface_content_width() { // This variable is intended to be overruled from themes. // Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}. // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound $GLOBALS['content_width'] = apply_filters( 'ampface_content_width', 640 ); } add_action( 'after_setup_theme', 'ampface_content_width', 0 ); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function ampface_widgets_init() { register_sidebar( array( 'name' => __( 'Sidebar Left', 'ampface' ), 'id' => 'sidebar-left', 'description' => __( 'Add widgets here to appear in your left sidebar.', 'ampface' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Sidebar Right', 'ampface' ), 'id' => 'sidebar-right', 'description' => __( 'Add widgets here to appear in your right sidebar.', 'ampface' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Content Bottom 1', 'ampface' ), 'id' => 'content-bottom-1', 'description' => __( 'Appears at the bottom of the content on posts and pages.', 'ampface' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Content Bottom 2', 'ampface' ), 'id' => 'content-bottom-2', 'description' => __( 'Appears at the bottom of the content on posts and pages.', 'ampface' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'ampFaceSlider', 'ampface' ), 'id' => 'ampfaceslider', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => 'Footer 1 Widget', 'id' => 'footer_1', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => 'Footer 2 Widget', 'id' => 'footer_2', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => 'Footer 3 Widget', 'id' => 'footer_3', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => 'Color 1 Widget', 'id' => 'color_1', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => 'Color 2 Widget', 'id' => 'color_2', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => 'Color 3 Widget', 'id' => 'color_3', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => 'Top 1 Widget', 'id' => 'top_1', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => 'Top 2 Widget', 'id' => 'top_2', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => 'Top 3 Widget', 'id' => 'top_3', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => 'Base 1 Widget', 'id' => 'base_1', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => 'Base 2 Widget', 'id' => 'base_2', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => 'Base 3 Widget', 'id' => 'base_3', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'ampface_widgets_init' ); /** * Enqueue scripts and styles. */ function ampface_scripts() { wp_enqueue_style( 'ampface-style', get_stylesheet_uri() ); wp_enqueue_script( 'ampface-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true ); if (is_plugin_inactive('amp/amp.php')) { wp_enqueue_script( 'amp-library', get_template_directory_uri() . 'https://cdn.ampproject.org/v0.js', '', '', false ); wp_enqueue_script( 'amp-bind', get_template_directory_uri() . 'https://cdn.ampproject.org/v0/amp-bind-0.1.js','', '', false ); wp_enqueue_script( 'amp-sidebar', get_template_directory_uri() . 'https://cdn.ampproject.org/v0/amp-sidebar-0.1.js', '', '', false); wp_enqueue_script( 'amp-accordion', get_template_directory_uri() . 'https://cdn.ampproject.org/v0/amp-accordion-0.1.js', '', '', false ); wp_enqueue_script( 'amp-fx-collection', get_template_directory_uri() . 'https://cdn.ampproject.org/v0/amp-fx-collection-0.1.js', '', '', false ); wp_enqueue_script( 'amp-selector', get_template_directory_uri() . '"https://cdn.ampproject.org/v0/amp-selector-0.1.js','', '', false ); wp_enqueue_script( 'amp-social-share', get_template_directory_uri() . 'https://cdn.ampproject.org/v0/amp-social-share-0.1.js','', '', false ); wp_enqueue_script( 'amp-user-notification', get_template_directory_uri() . 'https://cdn.ampproject.org/v0/amp-user-notification-0.1.js','', '', false ); wp_enqueue_script( 'amp-animation', get_template_directory_uri() . 'https://cdn.ampproject.org/v0/amp-animation-0.1.js', '', '', false ); wp_enqueue_script( 'amp-position-observer', get_template_directory_uri() . 'https://cdn.ampproject.org/v0/amp-position-observer-0.1.js','', '', false ); wp_enqueue_script( 'amp-bind', get_template_directory_uri() . 'https://cdn.ampproject.org/v0/amp-bind-0.1.js','', '', false ); } if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'ampface_scripts' ); /** * Implement the Custom Header feature. */ require get_template_directory() . '/inc/custom-header.php'; /** * Custom template tags for this theme. */ require get_template_directory() . '/inc/template-tags.php'; /** * Functions which enhance the theme by hooking into WordPress. */ require get_template_directory() . '/inc/template-functions.php'; /** * Customizer additions. */ require get_template_directory() . '/inc/customizer.php'; /** * Load Jetpack compatibility file. */ if ( defined( 'JETPACK__VERSION' ) ) { require get_template_directory() . '/inc/jetpack.php'; } /** * AMPFace Defaults */ function ampface_defaults( $setting ) { $defaults = array( 'default_setting_ampface_base_width' => __( 'narrow','ampface' ), 'default_link_color' => __( '#3e7fb7','ampface' ), ); return isset ($defaults[$setting]) ? $defaults[$setting] : false; } class Slidemenu_Walker extends Walker_Nav_Menu { public function start_lvl( &$output, $depth = 0, $args = array() ) { $output .= ' '; } // Displays start of an element. E.g '
  • Item Name' // @see Walker::start_el() function start_el(&$output, $item, $depth=0, $args=array(), $id = 0) { $object = $item->object; $type = $item->type; $title = $item->title; $description = $item->description; $permalink = $item->url; $output .= "classes) . "'>"; //Add SPAN if no Permalink if( $permalink && $permalink != '#' ) { $output .= ''; } else { $output .= ''; } $output .= $title; if( $description != '' && $depth == 0 ) { $output .= '' . $description . ''; } if( $permalink && $permalink != '#' ) { $output .= ''; } else { $output .= ''; } } function end_el( &$output, $item, $depth = 0, $args = array() ) { $output .= ''; } public function end_lvl( &$output, $depth = 0, $args = array() ) { $output .= ''; } } class Dropdown_Walker extends Walker_Nav_Menu { static $count=0; public function start_lvl( &$output, $depth = 0, $args = array() ) { } // Displays start of an element. E.g '
  • Item Name' // @see Walker::start_el() function start_el(&$output, $item, $depth=0, $args=array(), $id = 0) { if($depth == 0 and $count == 0 and $args->walker->has_children) { $output .= '
  • '; } self::$count++; } public function end_lvl( &$output, $depth = 0, $args = array() ) { if($args->walker->has_children) { $output .= ' '; } $output .= ''; } } function ampFace_customize_css() { ?> max_num_pages <= 1 ) return; $paged = get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1; $max = intval( $wp_query->max_num_pages ); /** Add current page to the array */ if ( $paged >= 1 ) $links[] = $paged; /** Add the pages around the current page to the array */ if ( $paged >= 3 ) { $links[] = $paged - 1; $links[] = $paged - 2; } if ( ( $paged + 2 ) <= $max ) { $links[] = $paged + 2; $links[] = $paged + 1; } echo '' . "\n"; } /** end af navigation */ /** * Filters the default archive titles. */ function ampface_archivetitles() { if ( is_category() ) { $title = __( '', 'ampface' ) . '' . single_term_title( '', false ) . ''; } elseif ( is_tag() ) { $title = __( 'Tags: ', 'ampface' ) . '' . single_term_title( '', false ) . ''; } elseif ( is_author() ) { $title = __( 'Authors: ', 'ampface' ) . '' . get_the_author_meta( 'display_name' ) . ''; } elseif ( is_year() ) { $title = __( 'Yearly Archives: ', 'ampface' ) . '' . get_the_date( _x( 'Y', 'yearly archives date format', 'ampface' ) ) . ''; } elseif ( is_month() ) { $title = __( 'Monthly Archives: ', 'ampface' ) . '' . get_the_date( _x( 'F Y', 'monthly archives date format', 'ampface' ) ) . ''; } elseif ( is_day() ) { $title = __( 'Daily Archives: ', 'ampface' ) . '' . get_the_date() . ''; } elseif ( is_post_type_archive() ) { $title = __( 'Post Type Archives: ', 'ampface' ) . '' . post_type_archive_title( '', false ) . ''; } elseif ( is_tax() ) { $tax = get_taxonomy( get_queried_object()->taxonomy ); /* translators: %s: Taxonomy singular name */ $title = sprintf( esc_html__( '%s Archives:', 'ampface' ), $tax->labels->singular_name ); } else { $title = __( '', 'ampface' ); } return $title; } add_filter( 'get_the_archive_title', 'ampface_archivetitles' ); /** Add amp suppport */ add_theme_support( 'amp', array( 'paired' => false, 'comments_live_list' => true, ) ); add_editor_style( 'style.css' );