SHOW:
|
|
- or go back to the newest paste.
| 1 | <?php | |
| 2 | /** Start the engine */ | |
| 3 | require_once( get_template_directory() . '/lib/init.php' ); | |
| 4 | ||
| 5 | /** Child theme (do not remove) */ | |
| 6 | define( 'CHILD_THEME_NAME', 'News Theme' ); | |
| 7 | define( 'CHILD_THEME_URL', 'http://www.studiopress.com/themes/news' ); | |
| 8 | ||
| 9 | /** Add Viewport meta tag for mobile browsers */ | |
| 10 | add_action( 'genesis_meta', 'news_add_viewport_meta_tag' ); | |
| 11 | function news_add_viewport_meta_tag() {
| |
| 12 | echo '<meta name="viewport" content="width=device-width, initial-scale=1.0"/>'; | |
| 13 | } | |
| 14 | ||
| 15 | $content_width = apply_filters( 'content_width', 580, 430, 910 ); | |
| 16 | ||
| 17 | /** Create additional color style options */ | |
| 18 | add_theme_support( 'genesis-style-selector', array( | |
| 19 | 'news-green' => 'Green', | |
| 20 | 'news-orange' => 'Orange', | |
| 21 | 'news-pink' => 'Pink', | |
| 22 | 'news-purple' => 'Purple', | |
| 23 | 'news-red' => 'Red', | |
| 24 | 'news-teal' => 'Teal' | |
| 25 | ) ); | |
| 26 | ||
| 27 | /** Add support for structural wraps */ | |
| 28 | add_theme_support( 'genesis-structural-wraps', array( | |
| 29 | 'header', | |
| 30 | 'nav', | |
| 31 | 'subnav', | |
| 32 | 'inner', | |
| 33 | 'footer-widgets', | |
| 34 | 'footer' | |
| 35 | ) ); | |
| 36 | ||
| 37 | /** Add new image sizes */ | |
| 38 | add_image_size( 'home-bottom', 110, 110, TRUE ); | |
| 39 | add_image_size( 'home-middle-left', 280, 165, TRUE ); | |
| 40 | add_image_size( 'home-middle-right', 50, 50, TRUE ); | |
| 41 | add_image_size( 'home-tabs', 150, 220, TRUE ); | |
| 42 | ||
| 43 | /** Add support for custom header */ | |
| 44 | add_theme_support( 'genesis-custom-header', array( | |
| 45 | 'width' => 960, | |
| 46 | 'height' => 110 | |
| 47 | ) ); | |
| 48 | ||
| 49 | /** Add support for custom background */ | |
| 50 | add_theme_support( 'custom-background' ); | |
| 51 | ||
| 52 | /** Reposition the secondary navigation */ | |
| 53 | remove_action( 'genesis_after_header', 'genesis_do_subnav' ); | |
| 54 | add_action( 'genesis_before', 'genesis_do_subnav' ); | |
| 55 | ||
| 56 | /** Add after post ad section */ | |
| 57 | add_action( 'genesis_after_post_content', 'news_after_post_ad', 9 ); | |
| 58 | function news_after_post_ad() {
| |
| 59 | if ( is_single() && is_active_sidebar( 'after-post-ad' ) ) {
| |
| 60 | echo '<div class="after-post-ad">'; | |
| 61 | dynamic_sidebar( 'after-post-ad' ); | |
| 62 | echo '</div><!-- end .after-post-ad -->'; | |
| 63 | } | |
| 64 | } | |
| 65 | ||
| 66 | /** Add after content ad section */ | |
| 67 | add_action( 'genesis_before_footer', 'news_after_content_ad' ); | |
| 68 | function news_after_content_ad() {
| |
| 69 | if ( is_active_sidebar( 'after-content-ad' ) ) {
| |
| 70 | echo '<div class="after-content-ad">'; | |
| 71 | dynamic_sidebar( 'after-content-ad' ); | |
| 72 | echo '</div><!-- end .after-content-ad -->'; | |
| 73 | } | |
| 74 | } | |
| 75 | ||
| 76 | /** Add support for 3-column footer widgets */ | |
| 77 | add_theme_support( 'genesis-footer-widgets', 3 ); | |
| 78 | ||
| 79 | require_once( get_stylesheet_directory() . '/includes/breadcrumb.php' ); | |
| 80 | ||
| 81 | /** Register widget areas */ | |
| 82 | genesis_register_sidebar( array( | |
| 83 | 'id' => 'home-top', | |
| 84 | 'name' => __( 'Home Top', 'news' ), | |
| 85 | 'description' => __( 'This is the home top section.', 'news' ), | |
| 86 | ) ); | |
| 87 | genesis_register_sidebar( array( | |
| 88 | 'id' => 'home-middle-left', | |
| 89 | 'name' => __( 'Home Middle Left', 'news' ), | |
| 90 | 'description' => __( 'This is the home middle left section.', 'news' ), | |
| 91 | ) ); | |
| 92 | genesis_register_sidebar( array( | |
| 93 | 'id' => 'home-middle-right', | |
| 94 | 'name' => __( 'Home Middle Right', 'news' ), | |
| 95 | 'description' => __( 'This is the home middle right section.', 'news' ), | |
| 96 | ) ); | |
| 97 | genesis_register_sidebar( array( | |
| 98 | 'id' => 'home-bottom', | |
| 99 | 'name' => __( 'Home Bottom', 'news' ), | |
| 100 | 'description' => __( 'This is the home bottom section.', 'news' ), | |
| 101 | ) ); | |
| 102 | genesis_register_sidebar( array( | |
| 103 | 'id' => 'after-post-ad', | |
| 104 | 'name' => __( 'After Post Ad', 'news' ), | |
| 105 | 'description' => __( 'This is the after post ad section.', 'news' ), | |
| 106 | ) ); | |
| 107 | genesis_register_sidebar( array( | |
| 108 | 'id' => 'after-content-ad', | |
| 109 | 'name' => __( 'After Content Ad', 'news' ), | |
| 110 | 'description' => __( 'This is the after content ad section.', 'news' ), | |
| 111 | ) ); | |
| 112 | ||
| 113 | /** Customize the entire footer */ | |
| 114 | remove_action( 'genesis_footer', 'genesis_do_footer' ); | |
| 115 | add_action( 'genesis_footer', 'custom_footer' ); | |
| 116 | function custom_footer() {
| |
| 117 | ?> | |
| 118 | <p>© Copyright 2013 <a href="http://latinrecap.com/">Latin Recap</a> · All Rights Reserved · Site by <a href="http://www.massideation.com/">Massideation</a> · </p> | |
| 119 | <?php | |
| 120 | } | |
| 121 | ||
| 122 | ||
| 123 | /*---------------------------------------------------------------*/ | |
| 124 | /* Set Custom Layouts | |
| 125 | /*---------------------------------------------------------------*/ | |
| 126 | add_filter('genesis_pre_get_option_site_layout', 'set_layouts');
| |
| 127 | function set_layouts($layout) {
| |
| 128 | ||
| 129 | if ( is_front_page() ) {
| |
| 130 | $layout = 'full-width-content'; | |
| 131 | } | |
| 132 | ||
| 133 | if ( is_front_page() || tribe_is_month() ) {
| |
| 134 | $layout = 'full-width-content'; | |
| 135 | } | |
| 136 | ||
| 137 | return $layout; | |
| 138 | } | |
| 139 | ||
| 140 | ||
| 141 | ||
| 142 | /*------------------------------------------------------------------------------- | |
| 143 | Register Custom Sidebars | |
| 144 | -------------------------------------------------------------------------------*/ | |
| 145 | add_action( 'init', 'my_sidebars' ); | |
| 146 | function my_sidebars() {
| |
| 147 | if ( !function_exists('register_sidebars') )
| |
| 148 | return; | |
| 149 | ||
| 150 | // Formats the widgets, adding readability-improving whitespace | |
| 151 | // use this array for multiple widget areas | |
| 152 | $p = array( | |
| 153 | 'before_widget' => '<div id="%1$s" class="widget %2$s"><div class="widget-wrap">', | |
| 154 | 'after_widget' => "</div></div>\n", | |
| 155 | 'before_title' => '<h4 class="widgettitle">', | |
| 156 | 'after_title' => "</h4>\n" | |
| 157 | ); | |
| 158 | register_sidebar($p + array('name'=>'Event List Sidebar','id'=>'event-list-sidebar'));
| |
| 159 | register_sidebar($p + array('name'=>'Single Events Sidebar','id'=>'single-events-sidebar'));
| |
| 160 | register_sidebar($p + array('name'=>'Single Event Day Sidebar','id'=>'event-day-sidebar'));
| |
| 161 | register_sidebar($p + array('name'=>'Single Venue Sidebar','id'=>'venue-sidebar'));
| |
| 162 | } | |
| 163 | ||
| 164 | ||
| 165 | /*------------------------------------------------------------------------------- | |
| 166 | Conditionally Remove Default Genesis Sidebar | |
| 167 | -------------------------------------------------------------------------------*/ | |
| 168 | add_action('template_redirect', 'remove_sidebars');
| |
| 169 | function remove_sidebars() {
| |
| 170 | if(tribe_is_event() || tribe_is_venue()) { //Events or Venue Pages
| |
| 171 | remove_action( 'genesis_sidebar', 'genesis_do_sidebar' ); | |
| 172 | } | |
| 173 | } | |
| 174 | ||
| 175 | ||
| 176 | /*------------------------------------------------------------------------------- | |
| 177 | Conditionally Insert Custom Sidebars | |
| 178 | -------------------------------------------------------------------------------*/ | |
| 179 | add_action('genesis_sidebar', 'insert_sidebars');
| |
| 180 | function insert_sidebars() {
| |
| 181 | if( tribe_is_event() && !tribe_is_day() && !is_single() ) { //Events List Page
| |
| 182 | if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('event-list-sidebar') );
| |
| 183 | } elseif( tribe_is_event() && is_single() ) { //Single Events Page
| |
| 184 | if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('single-events-sidebar') );
| |
| 185 | } elseif( tribe_is_day() ) { //Single Event Day Page
| |
| 186 | if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('event-day-sidebar') );
| |
| 187 | } elseif( tribe_is_venue() ) { //Single Venue Page
| |
| 188 | if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('venue-sidebar') );
| |
| 189 | } | |
| 190 | } | |
| 191 | ||
| 192 | /*------------------------------------------------------------------------------- | |
| 193 | Modify Titles | |
| 194 | -------------------------------------------------------------------------------*/ | |
| 195 | add_filter('genesis_post_title_text', 'custom_do_post_title');
| |
| 196 | function custom_do_post_title() {
| |
| 197 | ||
| 198 | global $wp_query; | |
| 199 | $title = get_the_title(); | |
| 200 | ||
| 201 | if ( strlen( $title ) == 0 ) | |
| 202 | return; | |
| 203 | ||
| 204 | if( tribe_is_month() && !is_tax() ) { // The Main Calendar Page
| |
| 205 | $title = 'Events Calendar'; | |
| 206 | } elseif( tribe_is_month() && is_tax() ) { // Calendar Category Pages
| |
| 207 | $title = 'Events Calendar' . ' » ' . single_term_title('', false);
| |
| 208 | } elseif( tribe_is_event() && !tribe_is_day() && !is_single() ) { // The Main Events List
| |
| 209 | $title = 'Events List'; | |
| 210 | } elseif( tribe_is_event() && is_single() ) { // Single Events
| |
| 211 | $title = get_the_title(); | |
| 212 | } elseif( tribe_is_day() ) { // Single Event Days
| |
| 213 | $title = 'Events on: ' . date('F j, Y', strtotime($wp_query->query_vars['eventDate']));
| |
| 214 | } elseif( tribe_is_venue() ) { // Single Venues
| |
| 215 | $title = get_the_title(); | |
| 216 | } else {
| |
| 217 | $title = get_the_title(); | |
| 218 | } | |
| 219 | ||
| 220 | return $title; | |
| 221 | ||
| 222 | } | |
| 223 | ||
| 224 | add_action('genesis_before_post_content', 'tribe_remove_genesis_post_info', 1);
| |
| 225 | ||
| 226 | function tribe_remove_genesis_post_info() {
| |
| 227 | if (tribe_is_month()) | |
| 228 | remove_action('genesis_before_post_content', 'genesis_post_info');
| |
| 229 | } |