-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
139 lines (101 loc) · 3.52 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
<?php
function zboom_default_functions(){
add_theme_support('title-tag');
add_theme_support('custom-background');
add_theme_support('post-thumbnails');
load_theme_textdomain('zboom',get_template_directory_uri().'/languages');
register_nav_menus(array(
'main-menu' => __('Main Menu','zboom'),
'footer-menu' => __('Footer Menu','zboom')
));
register_post_type('zboomsliders',array(
'labels' => array(
'name' => 'Sliders',
'add_new_item' => __('Add Slider Here','zboom'),
),
'public' => true,
'supports' => array('title','','thumbnail')
));
register_post_type('zboomservices', array(
'labels' => array(
'name' => 'Blocks',
'add_new_item' => __('Add New Services','zboom'),
),
'public' => true,
'supports' =>array('title','editor','thumbnail')
));
register_post_type('zboomgallery', array(
'labels' => array(
'name' => 'Gallery',
'add_new_item' => __('Add New Gallery','zboom'),
),
'public' => true,
'supports' =>array('title','editor','thumbnail')
));
}
add_action('after_setup_theme','zboom_default_functions');
//Sidebar
function zboom_right_sidebar(){
register_sidebar(array(
'name' => __('Right Sidebar','zboom'),
'description' => __('Add Right Widgets Here','zboom'),
'id' => 'right-sidebar',
'before_widget' => '<div class="box">',
'after_widget' => '</div></div>',
'before_title' => '<div class="heading"><h2>',
'after_title' =>'</h2></div><div class="content">',
));
register_sidebar(array(
'name' => __('Contact Right Sidebar','zboom'),
'description' => __('Add Contact Right Widgets Here','zboom'),
'id' => 'contact-sidebar',
'before_widget' => '<div class="box">',
'after_widget' => '</div></div>',
'before_title' => '<div class="heading"><h2>',
'after_title' =>'</h2></div><div class="content">',
));
register_sidebar(array(
'name' => __('Footer Sidebar','zboom'),
'description' => __('Add Footer Widgets Here','zboom'),
'id' => 'footer-sidebar',
'before_widget' => '<div class="col-1-4"><div class="wrap-col"><div class="box">',
'before_title' => '<div class="heading"><h2>',
'after_title' =>'</h2></div><div class="content">',
'after_widget' => '</div></div></div></div>',
));
}
add_action('widgets_init','zboom_right_sidebar');
function read_more($limit){
$post_contet = explode(" ", get_the_content());
$less_content = array_slice($post_contet, 0, $limit);
echo implode(" ",$less_content);
}
//custom widget
class zboom_test_widgets extends WP_Widget{
public function __construct(){
parent:: __construct('zboom_test_widgets','Test Widget',array(
'description' => 'This is test widget',
));
}
public function widget($args,$instance){
$title = $instance['title'];
echo $args['before_widget'].$args['before_title'].$title.$args['after_title'].$args['after_widget'];
}
public function form($instance){
$title = $instance['title'];
$facebook = $instance['facebook'];
?>
<p>
<label for="<?php echo $this-> get_field_id('title');?>">Title:</label>
<input id="<?php echo $this-> get_field_id('title');?>" type="text" name="<?php echo $this-> get_field_name('title');?>" value="<?php echo $title?>" class="widefat title">
</p>
<?php }
}
function zboom_test_widget_function(){
register_widget('zboom_test_widgets');
}
add_action('widgets_init','zboom_test_widget_function');
require_once('new-widgets.php');
require_once(__DIR__.'/widgets/author-widget.php');
require_once(dirname(__FILE__).'/inc/plugins/example.php');
?>