Changeset 3193 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/functions.php
- Timestamp:
- 05/20/2016 05:16:55 PM (8 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins
-
Property
svn:ignore
set to
node_modules
-
Property
svn:ignore
set to
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/functions.php
r3009 r3193 1 1 <?php 2 /** 3 * Plugin Directory functions and definitions. 4 * 5 * @link https://developer.wordpress.org/themes/basics/theme-functions/ 6 * 7 * @package WordPressdotorg\Plugin_Directory\Theme 8 */ 9 2 10 namespace WordPressdotorg\Plugin_Directory\Theme; 11 use WordPressdotorg\Plugin_Directory\Plugin_Directory; 3 12 4 13 /** 5 * WP.org Themes' functions and definitions.14 * Sets up theme defaults and registers support for various WordPress features. 6 15 * 7 * @package wporg-plugins 16 * Note that this function is hooked into the after_setup_theme hook, which 17 * runs before the init hook. The init hook is too late for some features, such 18 * as indicating support for post thumbnails. 8 19 */ 20 function setup() { 9 21 10 function wporg_plugins_setup() { 11 global $themes_allowedtags;22 // Add default posts and comments RSS feed links to head. 23 add_theme_support( 'automatic-feed-links' ); 12 24 13 load_theme_textdomain( 'wporg-plugins' ); 25 // This theme uses wp_nav_menu() in one location. 26 register_nav_menus( array( 27 'primary' => esc_html__( 'Primary', 'wporg-plugins' ), 28 ) ); 14 29 15 include_once __DIR__ . '/template-tags.php'; 30 /* 31 * Switch default core markup for search form, comment form, and comments 32 * to output valid HTML5. 33 */ 34 add_theme_support( 'html5', array( 35 'search-form', 36 'comment-form', 37 'comment-list', 38 'gallery', 39 'caption', 40 ) ); 16 41 17 add_theme_support( 'html5', array( 18 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' 42 // Set up the WordPress core custom background feature. 43 add_theme_support( 'custom-background', apply_filters( 'wporg_plugins_custom_background_args', array( 44 'default-color' => 'ffffff', 45 'default-image' => '', 46 ) ) ); 47 } 48 add_action( 'after_setup_theme', __NAMESPACE__ . '\setup' ); 49 50 /** 51 * Set the content width in pixels, based on the theme's design and stylesheet. 52 * 53 * Priority 0 to make it available to lower priority callbacks. 54 * 55 * @global int $content_width 56 */ 57 function content_width() { 58 $GLOBALS['content_width'] = apply_filters( 'wporg_plugins_content_width', 640 ); 59 } 60 add_action( 'after_setup_theme', __NAMESPACE__ . '\content_width', 0 ); 61 62 /** 63 * Register widget area. 64 * 65 * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar 66 */ 67 function widgets_init() { 68 69 register_sidebar( array( 70 'name' => esc_html__( 'Front Page Sidebar', 'wporg-plugins' ), 71 'id' => 'sidebar-front-page', 72 'description' => esc_html__( 'Appears on the bottom of the front page.', 'wporg-plugins' ), 73 'before_widget' => '<div id="%1$s" class="widget %2$s">', 74 'after_widget' => '</div>', 75 'before_title' => '<h4 class="widget-title">', 76 'after_title' => '</h4>', 19 77 ) ); 20 78 21 79 register_sidebar( array( 22 'name' => 'Single Plugin View Sidebar', 23 'id' => 'single-plugin-sidebar', 80 'name' => esc_html__( 'Sidebar', 'wporg-plugins' ), 81 'id' => 'sidebar-1', 82 'description' => esc_html__( 'Add widgets here.', 'wporg-plugins' ), 24 83 'before_widget' => '<div id="%1$s" class="widget %2$s">', 25 84 'after_widget' => '</div>', 85 'before_title' => '<h3 class="widget-title">', 86 'after_title' => '</h3>', 26 87 ) ); 27 28 // No need for canonical lookups29 remove_action( 'template_redirect', __NAMESPACE__ . '\wp_old_slug_redirect' );30 88 } 31 add_action( ' after_setup_theme', __NAMESPACE__ . '\wporg_plugins_setup' );89 add_action( 'widgets_init', __NAMESPACE__ . '\widgets_init' ); 32 90 33 91 /** 34 92 * Enqueue scripts and styles. 35 93 */ 36 function wporg_plugins_scripts() { 37 $script_debug = true || defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG; 38 $suffix = $script_debug ? '' : '.min'; 94 function scripts() { 95 wp_enqueue_style( 'wporg-plugins-style', get_template_directory_uri() . '/css/style.css' ); 39 96 40 // Concatenates core scripts when possible. 41 if ( ! $script_debug ) { 42 $GLOBALS['concatenate_scripts'] = true; 43 } 97 wp_enqueue_script( 'wporg-plugins-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true ); 44 98 45 $stylesheet = get_stylesheet_uri(); 46 if ( is_rtl() ) { 47 // $stylesheet = str_replace( '.css', '-rtl.css', $stylesheet ); // TODO, not being generated yet 48 } 49 wp_enqueue_style( 'wporg-plugins', $stylesheet, array(), time() ); 99 wp_enqueue_script( 'wporg-plugins-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true ); 100 } 101 add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\scripts' ); 50 102 51 // No Jetpack styles needed. 52 add_filter( 'jetpack_implode_frontend_css', '__return_false' ); 103 /** 104 * Don't split plugin content in the front-end. 105 */ 106 function content() { 107 remove_filter( 'the_content', array( Plugin_Directory::instance(), 'filter_post_content_to_correct_page' ), 1 ); 53 108 } 54 add_action( ' wp_enqueue_scripts', __NAMESPACE__ . '\wporg_plugins_scripts' );109 add_action( 'template_redirect', __NAMESPACE__ . '\content' ); 55 110 56 function wporg_plugins_body_class( $classes ) { 57 $classes[] = 'plugins-directory'; 58 return $classes; 59 } 60 add_filter( 'body_class', __NAMESPACE__ . '\wporg_plugins_body_class' ); 111 /** 112 * Custom template tags for this theme. 113 */ 114 require get_template_directory() . '/inc/template-tags.php'; 115 116 /** 117 * Customizer additions. 118 */ 119 require get_template_directory() . '/inc/customizer.php';
Note: See TracChangeset
for help on using the changeset viewer.