-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
105 lines (92 loc) · 3.1 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
<?php
/*
* Jer's Twenty Seventeen Child Theme
*
* Various alterations of Twenty Seventeen for Simian Uprising
*
* This file is part of simian-uprising-twenty-seventeen, twentyseventeen child theme.
*
* All functions of this file will be loaded before of parent theme functions.
* Learn more at https://codex.wordpress.org/Child_Themes.
*/
/**
* Note: this function loads the parent stylesheet before, then child theme stylesheet
*
* (leave it in place unless you know what you are doing.)
*/
function simian_uprising_twenty_seventeen_enqueue_child_styles() {
$parent_style = 'parent-style';
wp_enqueue_style($parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style(
'child-style',
get_stylesheet_directory_uri() . '/style.css',
array( $parent_style ),
wp_get_theme()->get('Version') );
}
add_action( 'wp_enqueue_scripts', 'simian_uprising_twenty_seventeen_enqueue_child_styles' );
/**
* Enable shortcodes in widgets
*/
add_filter( 'widget_text', 'do_shortcode' );
/**
* TODO: Find a way to automatically insert widgets from sidebar-summary into the sidebar sidebar
* when !is_home/!is_front_page so that we don't have weird style stuff happening
*/
/**
* Register widget area for sidebar-summary
*
* Should show on homepage below header and in sidebar of articles
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function simian_uprising_twentyseventeen_widgets_init() {
register_sidebar( array(
'name' => __( 'Summary Promo Widgets', 'twentyseventeen' ),
'id' => 'sidebar-summary',
'description' => __( 'Widgets added here will show in header of homepage and sidebar of articles.', 'twentyseventeen' ),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
) );
}
add_action( 'widgets_init', 'simian_uprising_twentyseventeen_widgets_init' );
/**
* wp_head action to output Javascript etc.
*
* Currently disabled
*
* @param type $param
*/
function jer_twentyseventeen_wp_head($param) {
$output = "";
$output .= "<script type='text/javascript'>
jQuery(document).ready(function($) {
footer_widgets = $('.footer-widget-2').html()
//console.log (footer_widgets);
//$('.site-content').prepend('<div class=\"wrap header-widgets-wrap\"></div>');
//$('.header-widgets-wrap').prepend(footer_widgets);
$('.hideable').on('click', function() {
$(this).hide();
})
});
</script>";
echo $output;
}
//add_action('wp_head', 'jer_twentyseventeen_wp_head');
/**
* Check if $function is in the call stack in debug_backtrace()
*
* Needed to check if a given filter (e.g. 'wp_trim_excerpt') is a function ancenstor
* to disable functionality (e.g. stop a wp_content filter from affecting empty excerpts).
*
* @param type $function
* @return boolean
*/
function jer_backtrace_contains_function($function) {
$backtrace = debug_backtrace();
foreach ($backtrace as $key => $function_details ):
if ($function == $function_details['function'])
return true;
endforeach;
}