-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
130 lines (111 loc) · 4.37 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
<?php
// In child themes the functions.php is applied before the parent
// theme's functions.php. So we need to wait for the parent theme to add
// it's filter before we can remove it.
add_action( 'after_setup_theme', 'my_child_theme_setup' );
add_action('init','mystic_init');
add_filter('widget_display_callback', 'mystic_filter_widget_display');
add_filter('twentyeleven_header_image_width', 'mystic_header_image_width');
function my_child_theme_setup() {
// Removes the filter that adds the "singular" class to the body element
// which centers the content and does not allow for a sidebar
remove_filter( 'body_class', 'twentyeleven_body_classes' );
/* Remove the twentyeleven registered sidebars */
//remove_action( 'widgets_init', 'twentyeleven_widgets_init' );
/* Add the modified version of the widgets_init function in this file */
//add_action( 'widgets_init', 'mystic_widgets_init' );
}
function mystic_init() {
wp_enqueue_script('jquery-core');
wp_enqueue_script('mystic_js', get_stylesheet_directory_uri() . '/js/mystic.js', array('jquery-core'));
add_action('wp_footer','mystic_onload_script');
}
function mystic_onload_script() {
?>
<script type="text/javascript">
if (window.jQuery) {
jQuery(document).ready(function() { if (window.mystic) mystic.handler.load(); } );
}
</script>
<?php
}
function mystic_header_image_width($width)
{
return 1100;
}
function mystic_filter_widget_display( $widget_instance )
{
$blocked_titles = array( 'Archives', 'Categories', 'Monthly Archives', 'Tag Cloud', 'Tags' );
if ( ( !empty($widget_instance['title']) ) && ( in_array($widget_instance['title'], $blocked_titles) ) ) {
if ( !is_page() || ( get_the_title() != 'News Archives' ) ) {
return false;
}
}
return $widget_instance;
}
/**
* Display navigation to next/previous pages when applicable
* Overridden to avoid using "posts" in the text.
*/
function twentyeleven_content_nav( $nav_id ) {
global $wp_query;
if ( $wp_query->max_num_pages > 1 ) : ?>
<nav id="<?php echo $nav_id; ?>">
<h3 class="assistive-text"><?php _e( 'Post navigation', 'twentyeleven' ); ?></h3>
<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older', 'twentyeleven' ) ); ?></div>
<div class="nav-next"><?php previous_posts_link( __( 'Newer <span class="meta-nav">→</span>', 'twentyeleven' ) ); ?></div>
</nav><!-- #nav-above -->
<?php endif;
}
/**
* Register our sidebars and widgetized areas. Also register the default Ephemera widget.
* Overridden from twentyeleven_widgets_init to specify that sidebar-1 should have closed as a class
*/
function mystic_widgets_init() {
register_widget( 'Twenty_Eleven_Ephemera_Widget' );
register_sidebar( array(
'name' => __( 'Main Sidebar', 'twentyeleven' ),
'id' => 'sidebar-1',
'before_widget' => '<aside id="%1$s" class="widget %2$s closed">',
'after_widget' => "</aside>",
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
register_sidebar( array(
'name' => __( 'Showcase Sidebar', 'twentyeleven' ),
'id' => 'sidebar-2',
'description' => __( 'The sidebar for the optional Showcase Template', 'twentyeleven' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => "</aside>",
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
register_sidebar( array(
'name' => __( 'Footer Area One', 'twentyeleven' ),
'id' => 'sidebar-3',
'description' => __( 'An optional widget area for your site footer', 'twentyeleven' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => "</aside>",
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
register_sidebar( array(
'name' => __( 'Footer Area Two', 'twentyeleven' ),
'id' => 'sidebar-4',
'description' => __( 'An optional widget area for your site footer', 'twentyeleven' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => "</aside>",
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
register_sidebar( array(
'name' => __( 'Footer Area Three', 'twentyeleven' ),
'id' => 'sidebar-5',
'description' => __( 'An optional widget area for your site footer', 'twentyeleven' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => "</aside>",
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
}
?>