-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtestimonials.php
185 lines (120 loc) · 7.08 KB
/
testimonials.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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<?php
/*
Plugin Name: Testimonials Creator
Plugin URI: https://wordpress.org/plugins/testimonials-creator/
Description: Testimonials Creator is a plugin to display testimonials, reviews or quotes in multiple ways! It is also compatible with Visual Composer Plugin.
Version: 1.6
Author: Dictrithemes
Author URI: https://dictrithemes.com
License: GPLv2 or later
*/
/*==========================================================================
enqueue
==========================================================================*/
function tmls_theme_enqueue() {
wp_register_style( 'tmls-testimonials', plugins_url('css/testimonials.css', __FILE__) );
wp_enqueue_style( 'tmls-testimonials' );
wp_enqueue_script('jquery');
wp_register_script( 'bth_touchSwipe', plugins_url('js/helper-plugins/jquery.touchSwipe.min.js', __FILE__), null, null, true );
wp_enqueue_script( 'bth_touchSwipe' );
wp_register_script( 'bth_carouFredSel', plugins_url('js/jquery.carouFredSel-6.2.1.js', __FILE__), null, null, true );
wp_enqueue_script( 'bth_carouFredSel' );
wp_register_script( 'tmls-testimonials-js', plugins_url('js/testimonials.js', __FILE__), null, null, true );
wp_enqueue_script( 'tmls-testimonials-js' );
}
add_action( 'wp_enqueue_scripts', 'tmls_theme_enqueue' );
function tmls_admin_enqueue($hook) {
global $post;
if ( isset($post) && ($post->post_type == 'tmls' || $post->post_type == 'tmls_sc' || $post->post_type == 'tmls_form_sc') && ($hook == 'post-new.php' || $hook == 'post.php') ) {
wp_register_style( 'tmls-testimonials', plugins_url('css/testimonials.css', __FILE__) );
wp_enqueue_style( 'tmls-testimonials' );
wp_register_style( 'tmls-admin-style', plugins_url('css/admin.css', __FILE__) );
wp_enqueue_style( 'tmls-admin-style' );
function tmls_enqueue_admin_scripts() {
wp_enqueue_media();
wp_register_script( 'tmls_admin_script', plugins_url('js/ts_admin.js', __FILE__), null, null, true );
}
add_action('admin_enqueue_scripts', 'tmls_enqueue_admin_scripts');
if ( $post->post_type == 'tmls_sc' ) {
wp_register_script( 'tmls-testimonials-js', plugins_url('js/testimonials.js', __FILE__), null, null, true );
wp_enqueue_script( 'tmls-testimonials-js' );
wp_register_script( 'bth_touchSwipe', plugins_url('js/helper-plugins/jquery.touchSwipe.min.js', __FILE__), null, null, true );
wp_enqueue_script( 'bth_touchSwipe' );
wp_register_script( 'bth_carouFredSel', plugins_url('js/jquery.carouFredSel-6.2.1.js', __FILE__), null, null, true );
wp_enqueue_script( 'bth_carouFredSel' );
wp_register_script( 'tmls-testimonials-generate-shortcode', plugins_url('js/testimonials_generate_shortcode.js', __FILE__), null, null, true );
wp_enqueue_script( 'tmls-testimonials-generate-shortcode' );
}
if ( $post->post_type == 'tmls_form_sc' ) {
wp_register_script( 'tmls-testimonials-js', plugins_url('js/testimonials.js', __FILE__), null, null, true );
wp_enqueue_script( 'tmls-testimonials-js' );
wp_register_script( 'tmls-form-generate-shortcode', plugins_url('js/form_generate_shortcode.js', __FILE__), null, null, true );
wp_enqueue_script( 'tmls-form-generate-shortcode' );
}
global $wp_version;
//If the WordPress version is greater than or equal to 3.5, then load the new WordPress color picker.
if ($wp_version >= 3.5){
//Both the necessary css and javascript have been registered already by WordPress, so all we have to do is load them with their handle.
wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_script( 'wp-color-picker' );
}
//If the WordPress version is less than 3.5 load the older farbtasic color picker.
else {
//As with wp-color-picker the necessary css and javascript have been registered already by WordPress, so all we have to do is load them with their handle.
wp_enqueue_style( 'farbtastic' );
wp_enqueue_script( 'farbtastic' );
}
}
else if($hook == 'index.php') {
wp_register_style( 'tmls-admin-style', plugins_url('css/admin.css', __FILE__) );
wp_enqueue_style( 'tmls-admin-style' );
}
}
add_action( 'admin_enqueue_scripts', 'tmls_admin_enqueue' );
/*==========================================================================
Testimonial custom post type
============================================================================*/
include('inc/testimonial_custom_post.php');
/*==========================================================================
Testimonials Shortcodes
============================================================================*/
include('inc/testimonials_shortcodes.php');
/*==========================================================================
Submission Form Shortcodes
============================================================================*/
include('inc/form_shortcodes.php');
/*==========================================================================
Register tmls_sc Post Type
============================================================================*/
include('inc/testimonials_generate_shortcode/generate_shortcode.php');
/*==========================================================================
Register tmls_form Post Type
============================================================================*/
include('inc/form_generate_shortcode/generate_shortcode.php');
/*==========================================================================
Admin Menu
============================================================================*/
add_action('admin_menu', 'tmls_register_my_custom_submenu_page');
function tmls_register_my_custom_submenu_page() {
// Generate Shortcode Page
add_submenu_page( 'edit.php?post_type=tmls', 'Generate shortcode', 'Generate shortcode', 'manage_options', 'post-new.php?post_type=tmls_sc' );
// Saved Shortcodes Page
add_submenu_page( 'edit.php?post_type=tmls', 'Saved Shortcodes', 'Saved Shortcodes', 'manage_options', 'edit.php?post_type=tmls_sc' );
// form (Generate Shortcode) Page
add_submenu_page( 'edit.php?post_type=tmls', 'Submission form', 'Submission form', 'manage_options', 'post-new.php?post_type=tmls_form_sc' );
// form (Saved Shortcodes) Page
add_submenu_page( 'edit.php?post_type=tmls', 'Saved forms', 'Saved forms', 'manage_options', 'edit.php?post_type=tmls_form_sc' );
}
/*==========================================================================
Shortcode Widget
============================================================================*/
include('inc/widget.php');
/*==========================================================================
Dashboard Widget
============================================================================*/
include('inc/dashboard_widget.php');
/*==========================================================================
Integrate With VC
============================================================================*/
include('inc/integrate_with_vc.php');
?>