'Roboto:100,300,400' ); wp_register_style('amp_theme_google_fonts', add_query_arg( $query_args, "https://fonts.googleapis.com/css")); wp_enqueue_style('amp_theme_google_fonts'); wp_enqueue_style('amp-accelerated-mobile-pages-style', get_stylesheet_uri() ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } wp_enqueue_script('etruel_amp_nav', get_template_directory_uri().'/assets/js/nav.js', array( 'jquery' ), ETRUEL_AMP_VER, true ); } add_action( 'wp_enqueue_scripts', 'etruel_amp_theme_scripts', 10 ); if ( ! function_exists( 'etruel_amp_theme_setup' ) ) : function etruel_amp_theme_setup() { load_theme_textdomain('amp-accelerated-mobile-pages'); // Add default posts and comments RSS feed links to head. add_theme_support( 'automatic-feed-links' ); /* * Let WordPress manage the document title. * By adding theme support, we declare that this theme does not use a * hard-coded tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 825, 510, true ); // This theme uses wp_nav_menu() in two locations. register_nav_menus( array( 'primary' => esc_attr__( 'Primary Menu', 'amp-accelerated-mobile-pages' ), 'footer' => esc_attr__( 'Footer', 'amp-accelerated-mobile-pages' ), ) ); /* * 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' ) ); /* * Enable support for Post Formats. * * See: https://codex.wordpress.org/Post_Formats */ add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link', 'gallery', 'status', 'audio', 'chat' ) ); add_theme_support( 'custom-logo', array( 'height' => 80, 'width' => 190, 'flex-height' => true, ) ); $color_scheme = etruel_amp_theme_get_color_scheme(); $default_color = trim( $color_scheme[0], '#' ); $default_text_color = trim( $color_scheme[4], '#'); /** * Filter AMP - Accelerated Mobile Pages custom-background support arguments. * @since 0.1.1 * @param array $args { * An array of custom-background support arguments. * @type string $default-color Default color of the background. * @type string $default-text-color Default text color of the background. * @type string $default-attachment Default attachment of the background. * } */ add_theme_support( 'custom-background', apply_filters('etruel_amp_theme_custom_background_args', array( 'default-color' => $default_color, 'default-text-color' => $default_text_color, 'default-attachment' => 'fixed', 'wp-head-callback' => 'etruel_amp_theme_background_style', ) ) ); /** * Filter AMP - Accelerated Mobile Pages custom-header support arguments. * @since 0.1.1 * @param array $args { * An array of custom-header support arguments. * @type string $default_text_color Default color of the header text. * @type int $width Width in pixels of the custom header image. Default 954. * @type int $height Height in pixels of the custom header image. Default 1300. * @type string $wp-head-callback Callback function used to styles the header image and text * displayed on the blog. * } */ $default_text_color = trim( $color_scheme[4], '#'); add_theme_support( 'custom-header', apply_filters( 'etruel_amp_theme_custom_header_args', array( 'default-text-color' => $default_text_color, 'width' => 900, 'height' => 80, 'flex-width' => true, 'wp-head-callback' => 'etruel_amp_theme_header_style', ) ) ); } endif; // etruel_amp_theme_setup add_action( 'after_setup_theme', 'etruel_amp_theme_setup' ); /** * Register widget area. * * @since 0.1 * * @link https://codex.wordpress.org/Function_Reference/register_sidebar */ function etruel_amp_widgets_init() { register_sidebar( array( 'name' => esc_attr__( 'Sidebar Area', 'amp-accelerated-mobile-pages' ), 'id' => 'sidebar_amp', 'description' => esc_attr__( 'Add widgets here to appear in your sidebar.', 'amp-accelerated-mobile-pages' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); register_sidebar( array( 'name' => esc_attr__( 'Header Right', 'amp-accelerated-mobile-pages' ), 'id' => 'header_rigth_amp', 'description' => esc_attr__( 'Add widgets here to appear in your header.', 'amp-accelerated-mobile-pages' ), 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '', ) ); } add_action( 'widgets_init', 'etruel_amp_widgets_init' ); /** * Register the required plugins for this theme. * * In this example, we register five plugins: * - one included with the TGMPA library * - two from an external source, one from an arbitrary source, one from a GitHub repository * - two from the .org repo, where one demonstrates the use of the `is_callable` argument * * The variables passed to the `tgmpa()` function should be: * - an array of plugin arrays; * - optionally a configuration array. * If you are not changing anything in the configuration array, you can remove the array and remove the * variable from the function call: `tgmpa( $plugins );`. * In that case, the TGMPA default settings will be used. * * This function is hooked into `tgmpa_register`, which is fired on the WP `init` action on priority 10. */ function etruel_amp_register_required_plugins() { /* * Array of plugin arrays. Required keys are name and slug. * If the source is NOT from the .org repo, then source is also required. */ $plugins = array( /* It is will be used when is accepted on WordPress.org Plugin Directory. array( 'name' => 'AMP Base', 'slug' => 'amp-base', ), */ ); /* * Array of configuration settings. Amend each line as needed. * * TGMPA will start providing localized text strings soon. If you already have translations of our standard * strings available, please help us make TGMPA even better by giving us access to these translations or by * sending in a pull-request with .po file(s) with the translations. * * Only uncomment the strings in the config array if you want to customize the strings. */ $config = array( 'id' => 'amp-accelerated-mobile-pages', // Unique ID for hashing notices for multiple instances of TGMPA. 'default_path' => '', // Default absolute path to bundled plugins. 'menu' => 'tgmpa-install-plugins', // Menu slug. 'has_notices' => true, // Show admin notices or not. 'dismissable' => true, // If false, a user cannot dismiss the nag message. 'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag. 'is_automatic' => false, // Automatically activate plugins after installation or not. 'message' => '', // Message to output right before the plugins table. ); tgmpa( $plugins, $config ); } add_action( 'tgmpa_register', 'etruel_amp_register_required_plugins' ); if (empty($wp_filesystem)) { require_once (ABSPATH . '/wp-admin/includes/file.php'); WP_Filesystem(); } require get_template_directory() . '/theme-customize.php'; require get_template_directory() . '/includes/template_tags.php'; require get_template_directory() . '/includes/compatibilities.php'; require get_template_directory() . '/includes/theme_amp.php'; require get_template_directory() . '/includes/tools.php'; require get_template_directory() . '/includes/class-tgm-plugin-activation.php'; require get_template_directory() . '/amp-base/amp-base-compatibility.php'; ?>