/
functions.php
142 lines (111 loc) · 3.87 KB
/
functions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<?php
// use shortcodes in widgets
add_filter( 'widget_text', 'shortcode_unautop');
add_filter( 'widget_text', 'do_shortcode');
//add support for custom headers
$args = array(
'flex-width' => true,
'width' => 177,
'flex-height' => true,
'height' => 100,
'default-image' => get_template_directory_uri() . '/images/logo.jpg',
'uploads' => true,
);
add_theme_support( 'custom-header', $args );
//Register custom menus
function register_my_menus() {
register_nav_menus(
array(
'main-menu' => __( 'nav-main' ),
'events-menu' =>__( 'primary'),
'projects-menu'=>__( 'primary'),
'footer-menu' =>__( 'footer-menu' ),
'footer-button-menu' =>__( 'footer-button-menu' )
)
);
add_action( 'init', 'register_my_menus' );
}
// Add custom menus to Dashboard when theme is active
if ( function_exists( 'register_nav_menus' ) ) {
register_nav_menus(
array(
'main-menu' => 'Main Menu', //Main Menu is the name of the registered location as it appears in the dashboard
'events-menu' => 'Events Menu',
'projects-menu' => 'Projects Menu',
'footer-menu' => 'Footer Menu',
'footer-button-menu' => 'Footer Button Menu'
)
);
}
add_action( 'widgets_init', 'my_register_sidebars' );
function my_register_sidebars() {
/* Register the primary sidebar. */
register_sidebar(
array(
'id' => 'primary',
'name' => __( 'Primary Sidebar' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>'
)
);
/* Register the mid-page widget area. */
register_sidebar(
array(
'id' => 'mid-page',
'name' => __( 'Mid-Page Widget Area' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>'
)
);
/* Register the lower-page widget area. */
register_sidebar(
array(
'id' => 'lower-page',
'name' => __( 'Lower-Page Widget Area' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>'
)
);
}
/* Adding Theme Support - Post Thumbnails */
add_theme_support( 'post-thumbnails' );
add_theme_support( 'post-thumbnails', array( 'post' ) ); // Posts only
add_theme_support( 'post-thumbnails', array( 'page' ) ); // Pages only
add_theme_support( 'post-thumbnails', array( 'post', 'movie' ) ); // Posts and Movies
/* Add Custom Size Images */
add_image_size('blog-220px-width', 220); /* 220 px width and unlimited height */
add_image_size('home-300px-width', 300); /* 300 px width and unlimited height */
add_image_size('blog-220xauto', 220, auto); /* 220 px width and auto height */
add_image_size('home-300xauto', 300, auto); /* 300 px width and auto height */
add_image_size('home-300x200px-cropped', 300,200,true); /* crops image to 300 x 200 px */
/* End Adding Theme Support - Post Thumbnails */
// Get My Title Tag
function get_my_title_tag() {
global $post;
if ( is_front_page() ) { // for the siteÕs Front Page
bloginfo('description'); // retrieve the site tagline
}
elseif ( is_page() || is_single() ) { // for your siteÕs Pages or Postings
the_title(); // retrieve the page or posting title
}
else { // for everything else
bloginfo('description'); // retrieve the site tagline
}
if ( $post->post_parent ) { // for your siteÕs Parent Pages
echo ' | '; // separator with spaces
echo get_the_title($post->post_parent); // retrieve the parent page title
}
echo ' | '; // separator with spaces
bloginfo('name'); // retrieve the site name
echo ' | '; // separator with spaces
echo 'Seattle, WA'; // write in the location
}
//
// Create Page Excerpts
add_post_type_support( 'page', 'excerpt' );