[gnome-web-www] Add "after_setup_theme" hook on functions.php
- From: Tom Tryfonidis <tomtryf src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-web-www] Add "after_setup_theme" hook on functions.php
- Date: Thu, 26 Jan 2017 19:40:35 +0000 (UTC)
commit 05802b12b338f7c4f457bae742cd482f1c167bef
Author: Tom Tryfonidis <tomtryf gnome org>
Date: Thu Jan 26 21:39:22 2017 +0200
Add "after_setup_theme" hook on functions.php
theme/functions.php | 123 ++++++++++++++++++++++++++++-----------------------
1 files changed, 68 insertions(+), 55 deletions(-)
---
diff --git a/theme/functions.php b/theme/functions.php
index abacbce..a178576 100644
--- a/theme/functions.php
+++ b/theme/functions.php
@@ -3,72 +3,82 @@
* @package WordPress
* @subpackage Default_Theme
*/
-
-/*
- * The genericons.css stylesheet wasn't loaded, enqueue
- * it for share icons to show up correctly.
+
+if ( ! function_exists( 'grass_setup' ) ) :
+/**
+ * Sets up theme defaults and registers support for various WordPress features.
+ *
+ * Note that this function is hooked into the after_setup_theme hook, which
+ * runs before the init hook. The init hook is too late for some features, such
+ * as indicating support for post thumbnails.
*/
+function grass_setup() {
-wp_enqueue_style( 'genericons', '/wp-content/plugins/jetpack/_inc/genericons/genericons/genericons.css',
array(), '3.1' );
-
-/*
- * Add support for theme translations.
- * Translations should be under /languages/ directory.
- */
+ /*
+ * Add support for theme translations.
+ * Translations should be under /languages/ directory.
+ */
-load_theme_textdomain( 'grass', get_template_directory().'/languages' );
+ load_theme_textdomain( 'grass', get_template_directory().'/languages' );
-// Add default posts and comments RSS feed links to head.
-add_theme_support('automatic-feed-links');
+ // Add default posts and comments RSS feed links to head.
+ add_theme_support('automatic-feed-links');
-/*
- * Let WordPress manage the document title.
- *
- * @link https://developer.wordpress.org/reference/functions/add_theme_support/#title-tag
- */
+ /*
+ * Let WordPress manage the document title.
+ *
+ * @link https://developer.wordpress.org/reference/functions/add_theme_support/#title-tag
+ */
-add_theme_support( 'title-tag' );
+ add_theme_support( 'title-tag' );
-/*
- * Switch default core markup for search form, comment form, and comments to output valid HTML5.
- *
- * @link https://developer.wordpress.org/reference/functions/add_theme_support/#html5
- */
-
-add_theme_support('html5', array(
- 'search-form',
- 'comment-form',
- 'comment-list',
- 'gallery',
- 'caption',
-));
+ /*
+ * Switch default core markup for search form, comment form, and comments to output valid HTML5.
+ *
+ * @link https://developer.wordpress.org/reference/functions/add_theme_support/#html5
+ */
+
+ add_theme_support('html5', array(
+ 'search-form',
+ 'comment-form',
+ 'comment-list',
+ 'gallery',
+ 'caption',
+ ));
-/*
- * Enable support for Post Thumbnails on posts and pages.
- *
- * @link https://developer.wordpress.org/reference/functions/add_theme_support/#post-thumbnails
- */
+ /*
+ * Enable support for Post Thumbnails on posts and pages.
+ *
+ * @link https://developer.wordpress.org/reference/functions/add_theme_support/#post-thumbnails
+ */
-add_theme_support('post-thumbnails');
+ add_theme_support('post-thumbnails');
-// Media sizes for applications icons
-add_image_size( 'icon-big', 256, 256, true);
-add_image_size( 'icon-medium', 186, 186, true);
-add_image_size( 'icon-small', 64, 64, true);
+ // Media sizes for applications icons
+ add_image_size( 'icon-big', 256, 256, true);
+ add_image_size( 'icon-medium', 186, 186, true);
+ add_image_size( 'icon-small', 64, 64, true);
-add_image_size( 'image-crafted-content', 420, 263, true);
-add_image_size( 'thumbnail-big', 210, 210, false);
-add_image_size( 'thumbnail-small', 120, 80, false);
+ add_image_size( 'image-crafted-content', 420, 263, true);
+ add_image_size( 'thumbnail-big', 210, 210, false);
+ add_image_size( 'thumbnail-small', 120, 80, false);
-// Media size for FoG Hackers and Board Directors icons
-add_image_size( 'fog-hacker-icon', 80, 80, true );
+ // Media size for FoG Hackers and Board Directors icons
+ add_image_size( 'fog-hacker-icon', 80, 80, true );
-/*
- * Set default banner size
- */
+ /*
+ * Set default banner size
+ */
-set_post_thumbnail_size(940, 280);
+ set_post_thumbnail_size(940, 280);
+ // Register a menu for the navbar
+ register_nav_menus( array(
+ 'primary' => 'Navbar Menu'
+ ) );
+}
+endif;
+add_action( 'after_setup_theme', 'grass_setup' );
/*
@@ -92,6 +102,13 @@ function gnomegrass_resources() {
wp_enqueue_style('style', get_stylesheet_uri());
wp_enqueue_style('font-awesome', get_template_directory_uri() . '/css/font-awesome.min.css' );
+ /*
+ * The genericons.css stylesheet wasn't loaded, enqueue
+ * it for share icons to show up correctly.
+ */
+
+ wp_enqueue_style( 'genericons', '/wp-content/plugins/jetpack/_inc/genericons/genericons/genericons.css',
array(), '3.1' );
+
// Scripts and styles for page-friends, page-support-gnome and page-donate
if (is_page( array('friends', 'donate', 'support-gnome')) ) {
friends_common_resources();
@@ -501,10 +518,6 @@ function custom_mimes_types ($existing_mimes) {
require_once('lib/wp-bootstrap-navwalker.php');
-register_nav_menus( array(
- 'primary' => 'Navbar Menu'
-) );
-
/*
* GNOME Grass Customizer
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]