-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
executable file
·101 lines (91 loc) · 2.71 KB
/
functions.php
File metadata and controls
executable file
·101 lines (91 loc) · 2.71 KB
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
<?php
/**
* @package WordPress
* @subpackage openAgroClimate
*/
/**
* Make theme available for translation
* Translations can be filed in the /languages/ directory
*/
load_theme_textdomain( 'oac_theme' );
/**
* Set the content width based on the theme's design and stylesheet.
*/
if ( ! isset( $content_width ) )
$content_width = 640;
/**
* This theme uses wp_nav_menu() in one location.
*/
register_nav_menus( array(
'primary' => __( 'Primary Menu', 'oac_theme' ),
'header' => __( 'Header Menu', 'oac_theme' ),
'footer' => __( 'Footer Menu', 'oac_theme' )
) );
// Removes ul class from wp_nav_menu
function remove_ul ( $menu ){
return preg_replace( array( '#^<ul[^>]*>#', '#</ul>$#' ), '', $menu );
}
add_filter( 'wp_nav_menu', 'remove_ul' );
/**
* Add default posts and comments RSS feed links to head
*/
add_theme_support( 'automatic-feed-links' );
/**
* Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link.
*/
function agroclimate_page_menu_args($args) {
$args['show_home'] = true;
return $args;
}
add_filter( 'wp_page_menu_args', 'agroclimate_page_menu_args' );
/**
* Register widgetized area and update sidebar with default widgets
*/
function openAgroClimate_widgets_init() {
register_sidebar( array (
'name' => __( 'Sidebar 1', 'oac_theme' ),
'id' => 'sidebar-1',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => "</div>",
'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>',
) );
register_sidebar( array (
'name' => __( 'Sidebar 2', 'oac_theme' ),
'id' => 'sidebar-2',
'description' => __( 'An optional second sidebar area', 'oac_theme' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => "</aside>",
'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>',
) );
}
function displayENSO() {
$ensoid = get_option( 'oac_display_enso', '' );
$ensotext = get_option('oac_display_enso_text', '');
$ensocolor = $ensophase = '';
$display = true;
switch( $ensoid ) {
case 'N':
$ensocolor = 'neutral';
$ensophase = __( 'Neutral ');
break;
case 'E':
$ensocolor = 'nino';
$ensophase = __( 'El Niño' );
break;
case 'L':
$ensocolor = 'nina';
$ensophase = __( 'La Niña' );
break;
default:
$display = false;
break;
}
if( $display ) {
echo '<span class="climatePhase">';
echo '<h3 class="'.$ensocolor.'">'.__( 'Current Phase', 'oac_theme').': '.$ensophase.'</h3>';
echo '<p>'.nl2br( $ensotext ).'</p></span>';
}
}
add_action( 'init', 'openAgroClimate_widgets_init' );