Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 121 lines (103 sloc) 3.134 kB
edfeccc @ianstewart _s: initial fork of Toolbox
ianstewart authored
1 <?php
2 /**
3 * _s functions and definitions
4 *
5 * @package _s
6 * @since _s 1.0
7 */
8
9 /**
10 * Set the content width based on the theme's design and stylesheet.
01ce62d @ianstewart _s: simplifying functions.php by making some of the stuff happening t…
ianstewart authored
11 *
12 * @since _s 1.0
edfeccc @ianstewart _s: initial fork of Toolbox
ianstewart authored
13 */
14 if ( ! isset( $content_width ) )
15 $content_width = 640; /* pixels */
16
17 if ( ! function_exists( '_s_setup' ) ):
18 /**
19 * Sets up theme defaults and registers support for various WordPress features.
20 *
21 * Note that this function is hooked into the after_setup_theme hook, which runs
22 * before the init hook. The init hook is too late for some features, such as indicating
23 * support post thumbnails.
24 *
01ce62d @ianstewart _s: simplifying functions.php by making some of the stuff happening t…
ianstewart authored
25 * @since _s 1.0
edfeccc @ianstewart _s: initial fork of Toolbox
ianstewart authored
26 */
27 function _s_setup() {
01ce62d @ianstewart _s: simplifying functions.php by making some of the stuff happening t…
ianstewart authored
28
29 /**
30 * Custom template tags for this theme.
31 */
32 require( get_template_directory() . '/inc/template-tags.php' );
33
34 /**
35 * Custom functions that act independently of the theme templates
36 */
37 //require( get_template_directory() . '/inc/tweaks.php' );
38
39 /**
803ddfe @ianstewart _s: incorporating a revamped version of our sample theme options
ianstewart authored
40 * Custom Theme Options
41 */
42 //require( get_template_directory() . '/inc/theme-options/theme-options.php' );
43
44 /**
01ce62d @ianstewart _s: simplifying functions.php by making some of the stuff happening t…
ianstewart authored
45 * WordPress.com-specific functions and definitions
46 */
47 //require( get_template_directory() . '/inc/wpcom.php' );
48
edfeccc @ianstewart _s: initial fork of Toolbox
ianstewart authored
49 /**
50 * Make theme available for translation
51 * Translations can be filed in the /languages/ directory
52 * If you're building a theme based on _s, use a find and replace
53 * to change '_s' to the name of your theme in all the template files
54 */
55 load_theme_textdomain( '_s', get_template_directory() . '/languages' );
56
57 /**
58 * Add default posts and comments RSS feed links to head
59 */
60 add_theme_support( 'automatic-feed-links' );
61
62 /**
f104cec _s: Enable support for Post Thumbnails
Philip Arthur Moore authored
63 * Enable support for Post Thumbnails
64 */
65 add_theme_support( 'post-thumbnails' );
66
67 /**
edfeccc @ianstewart _s: initial fork of Toolbox
ianstewart authored
68 * This theme uses wp_nav_menu() in one location.
69 */
70 register_nav_menus( array(
71 'primary' => __( 'Primary Menu', '_s' ),
72 ) );
73
74 /**
614dca2 @iamtakashi _s: Fixed a typo
iamtakashi authored
75 * Add support for the Aside Post Formats
edfeccc @ianstewart _s: initial fork of Toolbox
ianstewart authored
76 */
db89577 @ianstewart _s
ianstewart authored
77 add_theme_support( 'post-formats', array( 'aside', ) );
edfeccc @ianstewart _s: initial fork of Toolbox
ianstewart authored
78 }
79 endif; // _s_setup
80 add_action( 'after_setup_theme', '_s_setup' );
81
82 /**
83 * Register widgetized area and update sidebar with default widgets
01ce62d @ianstewart _s: simplifying functions.php by making some of the stuff happening t…
ianstewart authored
84 *
85 * @since _s 1.0
edfeccc @ianstewart _s: initial fork of Toolbox
ianstewart authored
86 */
87 function _s_widgets_init() {
88 register_sidebar( array(
553c12f @ianstewart _s: If there's only one sidebar we can call it a sidebar
ianstewart authored
89 'name' => __( 'Sidebar', '_s' ),
edfeccc @ianstewart _s: initial fork of Toolbox
ianstewart authored
90 'id' => 'sidebar-1',
91 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
d53dd41 @obenland s/double/single quotes in register_sidebar args array.
obenland authored
92 'after_widget' => '</aside>',
edfeccc @ianstewart _s: initial fork of Toolbox
ianstewart authored
93 'before_title' => '<h1 class="widget-title">',
94 'after_title' => '</h1>',
95 ) );
96 }
0d87fcd @ianstewart _s: attaching sidebar registration to the correct hook
ianstewart authored
97 add_action( 'widgets_init', '_s_widgets_init' );
4f3d984 @ianstewart _s: Simple script for changing the classes of the main menu based on …
ianstewart authored
98
99 /**
8de2e81 @ianstewart _s: enqueue style.css for consistency and for more customization thro…
ianstewart authored
100 * Enqueue scripts and styles
4f3d984 @ianstewart _s: Simple script for changing the classes of the main menu based on …
ianstewart authored
101 */
102 function _s_scripts() {
3bc1fe9 @ianstewart _s: we need to use the stylesheet_uri here or the default child theme…
ianstewart authored
103 wp_enqueue_style( 'style', get_stylesheet_uri() );
8de2e81 @ianstewart _s: enqueue style.css for consistency and for more customization thro…
ianstewart authored
104
10314c8 @mfields _s: Script dependancies need to be given as an array. Remove unneeded…
mfields authored
105 wp_enqueue_script( 'small-menu', get_template_directory_uri() . '/js/small-menu.js', array( 'jquery' ), '20120206', true );
f3dc4c2 @ianstewart _s: move scripts into one function added to wp_enqueue_scripts
ianstewart authored
106
107 if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
108 wp_enqueue_script( 'comment-reply' );
109 }
110
c5b01c3 @kovshenin No need for the $post global in _s_scripts()
kovshenin authored
111 if ( is_singular() && wp_attachment_is_image() ) {
f3dc4c2 @ianstewart _s: move scripts into one function added to wp_enqueue_scripts
ianstewart authored
112 wp_enqueue_script( 'keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' );
113 }
4f3d984 @ianstewart _s: Simple script for changing the classes of the main menu based on …
ianstewart authored
114 }
115 add_action( 'wp_enqueue_scripts', '_s_scripts' );
e932aaa @ianstewart _s: provide a more helpful message to users with no posts on the home…
ianstewart authored
116
117 /**
118 * Implement the Custom Header feature
119 */
120 //require( get_template_directory() . '/inc/custom-header.php' );
Something went wrong with that request. Please try again.