-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
143 lines (118 loc) · 4.36 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
138
139
140
141
142
143
<?php
if(false) {
ini_set('display_errors', 'On');
error_reporting(E_ALL);
}
require_once('php/megamenu-walker.php');
require_once('php/vertical-nav-walker.php');
function get_custom_field_value($szKey, $bPrint = false, $default)
{
global $post;
if(get_post_meta($post->ID, $szKey, true)) {
$szValue = get_post_meta($post->ID, $szKey, true);
}
else {
$szValue = $default;
}
if ( $bPrint == false ) return $szValue; else echo $szValue;
}
function wpbootstrap_scripts_with_jquery()
{
// Register the script like this for a theme:
wp_register_script( 'bootstrap-script', get_template_directory_uri() . '/bootstrap/js/bootstrap.js', array( 'jquery' ) );
// For either a plugin or a theme, you can then enqueue the script:
wp_enqueue_script( 'bootstrap-script' );
}
function add_custom_scripts()
{
wp_register_script('custom_scripts', get_template_directory_uri() . '/scripts/callback.js');
wp_enqueue_script( 'custom_scripts' );
}
function add_site_scripts()
{
wp_register_script('site_scripts', get_template_directory_uri() . '/scripts/custom.js');
wp_enqueue_script( 'site_scripts' );
}
function add_knockout()
{
wp_register_script('knockout_script', get_template_directory_uri() . '/scripts/knockout-2.2.1.js');
wp_register_script('knockout__validation_script', get_template_directory_uri() . '/scripts/knockout.validation.js');
wp_enqueue_script('knockout_script');
wp_enqueue_script('knockout__validation_script');
}
function add_models()
{
wp_register_script('callback_model', get_template_directory_uri() .'/scripts/callback_model.js');
wp_localize_script( 'callback_model', 'callbackProperties', array( 'enquiryUrl' => get_template_directory_uri() . '/php/enquiry.php'));
wp_enqueue_script('callback_model');
}
function add_google_scripts()
{
$apiKey = 'AIzaSyD4bSbLeCF6fkHO8I3-IpGWHVzBWQNwkNo';
$googleUrl = 'https://maps.googleapis.com/maps/api/js?key=' . $apiKey .'&sensor=true';
wp_register_script('google_scripts', $googleUrl);
wp_enqueue_script( 'google_scripts' );
}
function add_addthis_script()
{
$url = "http://s7.addthis.com/js/300/addthis_widget.js#pubid=ra-51ec26755356d3ea";
wp_register_script('addthis_script', $url);
wp_enqueue_script( 'addthis_script' );
}
function add_toastr_script()
{
wp_register_script('toastr_script', get_template_directory_uri() .'/scripts/toastr.js');
wp_enqueue_script( 'toastr_script' );
}
function add_spin_script()
{
wp_register_script('spin_script', get_template_directory_uri() .'/scripts/spin.js');
wp_enqueue_script( 'spin_script' );
}
add_action( 'wp_enqueue_scripts', 'wpbootstrap_scripts_with_jquery' );
add_action( 'wp_enqueue_scripts', 'add_google_scripts');
add_action( 'wp_enqueue_scripts', 'add_addthis_script');
add_action( 'wp_enqueue_scripts', 'add_knockout');
add_action( 'wp_enqueue_scripts', 'add_models');
add_action( 'wp_enqueue_scripts', 'add_site_scripts');
add_action( 'wp_enqueue_scripts', 'add_toastr_script');
add_action( 'wp_enqueue_scripts', 'add_spin_script');
add_action( 'wp_enqueue_scripts', 'add_custom_scripts');
require_once('php/custom_options.php');
function do_widgets_init() {
register_sidebar( array(
'name' => 'Services Right Sidebar',
'id' => 'services_right_1',
'before_widget' => '<div>',
'after_widget' => '</div>',
'before_title' => '<h2 class="rounded">',
'after_title' => '</h2>',
) );
}
add_action( 'widgets_init', 'do_widgets_init' );
add_action( 'after_setup_theme', 'register_my_menus' );
function register_my_menus() {
register_nav_menus( array(
'primary' => __( 'Primary Menu', 'WP Mega Menu 1.0' ),
'sidebar' => __('Sidebar Menu', 'Sidebar manu'),
'footer' => __('Footer Navigation', 'Footer Navigation')
) );
}
function add_callback_button($items, $args) {
$class = "pull-right";
$callbackForm =
'<form class="navbar-form pull-right">'.
'<button type="button" class="btn">Request a callback</button>'.
'</form>';
$homeMenuItem =
'<li ' . $class . '>' .
$args->before .
'<a href="' . home_url( '/' ) . '" title="Home">' .
$args->link_before . 'Home' . $args->link_after .
'</a>' .
$args->after .
'</li>';
$items = $items . $callbackForm;
return $items;
}
?>