Version Description
- First version of the plugin
Download this release
Release Info
Developer | themeisle |
Plugin | Orbit Fox by ThemeIsle |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- assets/js/widget-media.js +95 -0
- inc/widget-clients.php +170 -0
- inc/widget-focus.php +237 -0
- inc/widget-team.php +387 -0
- inc/widget-testimonial.php +244 -0
- readme.txt +20 -0
- themeisle-companion.php +328 -0
assets/js/widget-media.js
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* global jQuery */
|
2 |
+
/* global wp */
|
3 |
+
jQuery(document).ready( function($) {
|
4 |
+
'use strict';
|
5 |
+
|
6 |
+
$(document).on('change','.custom_media_url',function() {
|
7 |
+
var value = $.trim($(this).val());
|
8 |
+
var image_input = $(this).parent().find('.custom_media_image');
|
9 |
+
var media_id = $(this).parent().parent().find('.custom_media_id');
|
10 |
+
if(value.length === 0){
|
11 |
+
image_input.attr('src','');
|
12 |
+
image_input.attr('alt','');
|
13 |
+
media_id.val('');
|
14 |
+
}
|
15 |
+
var saveBtn = $(this).closest('.form').find('.widget-control-save');
|
16 |
+
if (typeof saveBtn !== 'undefined') {
|
17 |
+
saveBtn.trigger( "click" );
|
18 |
+
}
|
19 |
+
});
|
20 |
+
|
21 |
+
function media_upload(button_class) {
|
22 |
+
var _custom_media = true;
|
23 |
+
|
24 |
+
$('body').on('click', button_class, function() {
|
25 |
+
|
26 |
+
var button_id ='#'+$(this).attr('id');
|
27 |
+
var media_id = jQuery(this).parent().parent().children('.custom_media_id');
|
28 |
+
var display_field = jQuery(this).parent().children('input:text');
|
29 |
+
var display_image = jQuery(this).parent().children('.custom_media_image');
|
30 |
+
var image_in_customizer = jQuery(this).parent().children('.custom_media_display_in_customizer');
|
31 |
+
|
32 |
+
_custom_media = true;
|
33 |
+
|
34 |
+
wp.media.editor.send.attachment = function(props, attachment) {
|
35 |
+
if( typeof attachment !== 'undefined' ) {
|
36 |
+
if ( _custom_media ) {
|
37 |
+
if ( typeof display_field !== 'undefined' ) {
|
38 |
+
|
39 |
+
if( typeof attachment.id !== 'undefined' ) {
|
40 |
+
media_id.val(attachment.id);
|
41 |
+
}
|
42 |
+
|
43 |
+
if ( typeof attachment.sizes !== 'undefined' ) {
|
44 |
+
if ( typeof attachment.sizes.thumbnail !== 'undefined' ) {
|
45 |
+
if (typeof(attachment.sizes.thumbnail.url) !== 'undefined') {
|
46 |
+
display_image.attr('src', attachment.sizes.thumbnail.url).css('display', 'block');
|
47 |
+
image_in_customizer.val(attachment.sizes.thumbnail.url);
|
48 |
+
}
|
49 |
+
}
|
50 |
+
else {
|
51 |
+
if( typeof attachment.url !== 'undefined' ) {
|
52 |
+
display_image.attr('src', attachment.url).css('display', 'block');
|
53 |
+
image_in_customizer.val(attachment.url);
|
54 |
+
}
|
55 |
+
}
|
56 |
+
}
|
57 |
+
else {
|
58 |
+
if ( typeof attachment.url !== 'undefined' ) {
|
59 |
+
display_image.attr('src', attachment.url).css('display', 'block');
|
60 |
+
image_in_customizer.val(attachment.url);
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
switch (props.size) {
|
65 |
+
case 'full':
|
66 |
+
display_field.val(attachment.sizes.full.url);
|
67 |
+
break;
|
68 |
+
case 'medium':
|
69 |
+
display_field.val(attachment.sizes.medium.url);
|
70 |
+
break;
|
71 |
+
case 'thumbnail':
|
72 |
+
display_field.val(attachment.sizes.thumbnail.url);
|
73 |
+
break;
|
74 |
+
default:
|
75 |
+
display_field.val(attachment.url);
|
76 |
+
break;
|
77 |
+
}
|
78 |
+
display_field.trigger('change');
|
79 |
+
}
|
80 |
+
} else {
|
81 |
+
return wp.media.editor.send.attachment(button_id, [props, attachment]);
|
82 |
+
}
|
83 |
+
}
|
84 |
+
};
|
85 |
+
|
86 |
+
wp.media.editor.open(button_class);
|
87 |
+
window.send_to_editor = function (html) {
|
88 |
+
|
89 |
+
};
|
90 |
+
return false;
|
91 |
+
});
|
92 |
+
}
|
93 |
+
|
94 |
+
media_upload('.custom_media_button');
|
95 |
+
});
|
inc/widget-clients.php
ADDED
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Clients Widget
|
4 |
+
*
|
5 |
+
* @since 1.0.0
|
6 |
+
*
|
7 |
+
* @package themeisle-companion
|
8 |
+
*/
|
9 |
+
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class zerif_clients_widget
|
13 |
+
*/
|
14 |
+
if ( !class_exists( 'zerif_clients_widget' ) ) {
|
15 |
+
|
16 |
+
class zerif_clients_widget extends WP_Widget {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* zerif_clients_widget constructor.
|
20 |
+
*/
|
21 |
+
public function __construct() {
|
22 |
+
parent::__construct(
|
23 |
+
'zerif_clients-widget',
|
24 |
+
__( 'Zerif - Clients widget', 'zerif-lite' ),
|
25 |
+
array(
|
26 |
+
'customize_selective_refresh' => true,
|
27 |
+
)
|
28 |
+
);
|
29 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'widget_scripts' ) );
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Enqueue Widget Scripts
|
34 |
+
*
|
35 |
+
* @param $hook
|
36 |
+
*/
|
37 |
+
function widget_scripts( $hook ) {
|
38 |
+
if ( $hook != 'widgets.php' ) {
|
39 |
+
return;
|
40 |
+
}
|
41 |
+
wp_enqueue_media();
|
42 |
+
wp_enqueue_script( 'zerif_widget_media_script', THEMEISLE_COMPANION_URL . 'assets/js/widget-media.js', false, '1.1', true );
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Display Widget
|
47 |
+
*
|
48 |
+
* @param $args
|
49 |
+
* @param $instance
|
50 |
+
*/
|
51 |
+
function widget( $args, $instance ) {
|
52 |
+
|
53 |
+
extract( $args );
|
54 |
+
|
55 |
+
echo $before_widget;
|
56 |
+
|
57 |
+
?>
|
58 |
+
|
59 |
+
<a href="<?php if ( ! empty( $instance['link'] ) ): echo apply_filters( 'widget_title', $instance['link'] ); endif; ?>">
|
60 |
+
<?php
|
61 |
+
if ( ! empty( $instance['image_uri'] ) && ( $instance['image_uri'] != 'Upload Image' ) ) {
|
62 |
+
|
63 |
+
echo '<img src="' . esc_url( $instance['image_uri'] ) . '" alt="' . __( 'Client', 'zerif-lite' ) . '">';
|
64 |
+
|
65 |
+
} elseif ( ! empty( $instance['custom_media_id'] ) ) {
|
66 |
+
|
67 |
+
$zerif_clients_custom_media_id = wp_get_attachment_image_src( $instance["custom_media_id"] );
|
68 |
+
if ( ! empty( $zerif_clients_custom_media_id ) && ! empty( $zerif_clients_custom_media_id[0] ) ) {
|
69 |
+
|
70 |
+
echo '<img src="' . esc_url( $zerif_clients_custom_media_id[0] ) . '" alt="' . __( 'Client', 'zerif-lite' ) . '">';
|
71 |
+
|
72 |
+
}
|
73 |
+
}
|
74 |
+
?>
|
75 |
+
</a>
|
76 |
+
|
77 |
+
<?php
|
78 |
+
|
79 |
+
echo $after_widget;
|
80 |
+
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Update Widget
|
85 |
+
*
|
86 |
+
* @param $new_instance
|
87 |
+
* @param $old_instance
|
88 |
+
*
|
89 |
+
* @return mixed
|
90 |
+
*/
|
91 |
+
function update( $new_instance, $old_instance ) {
|
92 |
+
|
93 |
+
$instance = $old_instance;
|
94 |
+
|
95 |
+
$instance['link'] = strip_tags( $new_instance['link'] );
|
96 |
+
|
97 |
+
$instance['image_uri'] = strip_tags( $new_instance['image_uri'] );
|
98 |
+
|
99 |
+
$instance['image_in_customizer'] = strip_tags( $new_instance['image_in_customizer'] );
|
100 |
+
|
101 |
+
$instance['custom_media_id'] = strip_tags( $new_instance['custom_media_id'] );
|
102 |
+
|
103 |
+
return $instance;
|
104 |
+
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Widget controls
|
109 |
+
*
|
110 |
+
* @param $instance
|
111 |
+
*/
|
112 |
+
function form( $instance ) {
|
113 |
+
?>
|
114 |
+
|
115 |
+
<p>
|
116 |
+
<label
|
117 |
+
for="<?php echo $this->get_field_id( 'link' ); ?>"><?php _e( 'Link', 'zerif-lite' ); ?></label><br/>
|
118 |
+
<input type="text" name="<?php echo $this->get_field_name( 'link' ); ?>"
|
119 |
+
id="<?php echo $this->get_field_id( 'link' ); ?>"
|
120 |
+
value="<?php if ( ! empty( $instance['link'] ) ): echo $instance['link']; endif; ?>"
|
121 |
+
class="widefat">
|
122 |
+
</p>
|
123 |
+
<p>
|
124 |
+
<label
|
125 |
+
for="<?php echo $this->get_field_id( 'image_uri' ); ?>"><?php _e( 'Image', 'zerif-lite' ); ?></label><br/>
|
126 |
+
|
127 |
+
<?php
|
128 |
+
$image_in_customizer = '';
|
129 |
+
$display = 'none';
|
130 |
+
if ( ! empty( $instance['image_in_customizer'] ) && ! empty( $instance['image_uri'] ) ) {
|
131 |
+
$image_in_customizer = esc_url( $instance['image_in_customizer'] );
|
132 |
+
$display = 'inline-block';
|
133 |
+
} else {
|
134 |
+
if ( ! empty( $instance['image_uri'] ) ) {
|
135 |
+
$image_in_customizer = esc_url( $instance['image_uri'] );
|
136 |
+
$display = 'inline-block';
|
137 |
+
}
|
138 |
+
}
|
139 |
+
$zerif_image_in_customizer = $this->get_field_name( 'image_in_customizer' );
|
140 |
+
?>
|
141 |
+
<input type="hidden" class="custom_media_display_in_customizer"
|
142 |
+
name="<?php if ( ! empty( $zerif_image_in_customizer ) ) {
|
143 |
+
echo $zerif_image_in_customizer;
|
144 |
+
} ?>"
|
145 |
+
value="<?php if ( ! empty( $instance['image_in_customizer'] ) ): echo $instance['image_in_customizer']; endif; ?>">
|
146 |
+
<img class="custom_media_image" src="<?php echo $image_in_customizer; ?>"
|
147 |
+
style="margin:0;padding:0;max-width:100px;float:left;display:<?php echo $display; ?>"
|
148 |
+
alt="<?php echo __( 'Uploaded image', 'zerif-lite' ); ?>"/><br/>
|
149 |
+
|
150 |
+
<input type="text" class="widefat custom_media_url"
|
151 |
+
name="<?php echo $this->get_field_name( 'image_uri' ); ?>"
|
152 |
+
id="<?php echo $this->get_field_id( 'image_uri' ); ?>"
|
153 |
+
value="<?php if ( ! empty( $instance['image_uri'] ) ): echo $instance['image_uri']; endif; ?>"
|
154 |
+
style="margin-top:5px;">
|
155 |
+
|
156 |
+
<input type="button" class="button button-primary custom_media_button" id="custom_media_button"
|
157 |
+
name="<?php echo $this->get_field_name( 'image_uri' ); ?>"
|
158 |
+
value="<?php _e( 'Upload Image', 'zerif-lite' ); ?>" style="margin-top:5px;">
|
159 |
+
</p>
|
160 |
+
|
161 |
+
<input class="custom_media_id" id="<?php echo $this->get_field_id( 'custom_media_id' ); ?>"
|
162 |
+
name="<?php echo $this->get_field_name( 'custom_media_id' ); ?>" type="hidden"
|
163 |
+
value="<?php if ( ! empty( $instance["custom_media_id"] ) ): echo $instance["custom_media_id"]; endif; ?>"/>
|
164 |
+
<?php
|
165 |
+
|
166 |
+
}
|
167 |
+
|
168 |
+
}
|
169 |
+
}
|
170 |
+
|
inc/widget-focus.php
ADDED
@@ -0,0 +1,237 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Our Focus Widget
|
4 |
+
*
|
5 |
+
* @since 1.0.0
|
6 |
+
*
|
7 |
+
* @package themeisle-companion
|
8 |
+
*/
|
9 |
+
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class zerif_ourfocus
|
13 |
+
*/
|
14 |
+
if ( !class_exists( 'zerif_ourfocus' ) ) {
|
15 |
+
|
16 |
+
class zerif_ourfocus extends WP_Widget {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* zerif_ourfocus constructor.
|
20 |
+
*/
|
21 |
+
public function __construct() {
|
22 |
+
parent::__construct(
|
23 |
+
'ctUp-ads-widget',
|
24 |
+
__( 'Zerif - Our focus widget', 'zerif-lite' ),
|
25 |
+
array(
|
26 |
+
'customize_selective_refresh' => true,
|
27 |
+
)
|
28 |
+
);
|
29 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'widget_scripts' ) );
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Enqueue Widget Scripts
|
34 |
+
*
|
35 |
+
* @param $hook
|
36 |
+
*/
|
37 |
+
function widget_scripts( $hook ) {
|
38 |
+
if ( $hook != 'widgets.php' ) {
|
39 |
+
return;
|
40 |
+
}
|
41 |
+
wp_enqueue_media();
|
42 |
+
wp_enqueue_script( 'zerif_widget_media_script', THEMEISLE_COMPANION_URL . 'assets/js/widget-media.js', false, '1.1', true );
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Display Widget
|
47 |
+
*
|
48 |
+
* @param $args
|
49 |
+
* @param $instance
|
50 |
+
*/
|
51 |
+
function widget( $args, $instance ) {
|
52 |
+
|
53 |
+
extract( $args );
|
54 |
+
|
55 |
+
echo $before_widget;
|
56 |
+
|
57 |
+
?>
|
58 |
+
|
59 |
+
<div class="col-lg-3 col-sm-3 focus-box" data-scrollreveal="enter left after 0.15s over 1s">
|
60 |
+
|
61 |
+
<?php
|
62 |
+
if ( ! empty( $instance['image_uri'] ) && ( $instance['image_uri'] != 'Upload Image' ) ) {
|
63 |
+
if ( ! empty( $instance['link'] ) ) { ?>
|
64 |
+
<a href="<?php echo esc_url( $instance['link'] ); ?>" class="service-icon">
|
65 |
+
<?php
|
66 |
+
if ( ! empty( $instance['title'] ) ) { ?>
|
67 |
+
<span class="sr-only">
|
68 |
+
<?php _e( 'Go to', 'zerif-lite' ); ?>
|
69 |
+
<?php echo apply_filters( 'widget_title', $instance['title'] ); ?>
|
70 |
+
</span>
|
71 |
+
<?php
|
72 |
+
} ?>
|
73 |
+
|
74 |
+
<i class="pixeden"
|
75 |
+
style="background:url(<?php echo esc_url( $instance['image_uri'] ); ?>) no-repeat center;width:100%; height:100%;"></i>
|
76 |
+
</a>
|
77 |
+
<?php
|
78 |
+
} else { ?>
|
79 |
+
<div class="service-icon" tabindex="0">
|
80 |
+
<i class="pixeden"
|
81 |
+
style="background:url(<?php echo esc_url( $instance['image_uri'] ); ?>) no-repeat center;width:100%; height:100%;"></i>
|
82 |
+
<!-- FOCUS ICON-->
|
83 |
+
</div>
|
84 |
+
<?php
|
85 |
+
} ?>
|
86 |
+
|
87 |
+
|
88 |
+
<?php } elseif ( ! empty( $instance['custom_media_id'] ) ) {
|
89 |
+
|
90 |
+
$zerif_ourfocus_custom_media_id = wp_get_attachment_image_src( $instance["custom_media_id"] );
|
91 |
+
if ( ! empty( $zerif_ourfocus_custom_media_id ) && ! empty( $zerif_ourfocus_custom_media_id[0] ) ) {
|
92 |
+
|
93 |
+
if ( ! empty( $instance['link'] ) ) { ?>
|
94 |
+
<a href="<?php echo esc_url( $instance['link'] ); ?>" class="service-icon">
|
95 |
+
<?php
|
96 |
+
if ( ! empty( $instance['title'] ) ) { ?>
|
97 |
+
<span class="sr-only">
|
98 |
+
<?php _e( 'Go to', 'zerif-lite' ); ?>
|
99 |
+
<?php echo apply_filters( 'widget_title', $instance['title'] ); ?>
|
100 |
+
</span>
|
101 |
+
<?php
|
102 |
+
} ?>
|
103 |
+
<i class="pixeden"
|
104 |
+
style="background:url(<?php echo esc_url( $zerif_ourfocus_custom_media_id[0] ); ?>) no-repeat center;width:100%; height:100%;"></i>
|
105 |
+
</a>
|
106 |
+
<?php
|
107 |
+
} else { ?>
|
108 |
+
<div class="service-icon" tabindex="0">
|
109 |
+
<i class="pixeden"
|
110 |
+
style="background:url(<?php echo esc_url( $zerif_ourfocus_custom_media_id[0] ); ?>) no-repeat center;width:100%; height:100%;"></i>
|
111 |
+
<!-- FOCUS ICON-->
|
112 |
+
</div>
|
113 |
+
<?php
|
114 |
+
}
|
115 |
+
}
|
116 |
+
|
117 |
+
}
|
118 |
+
?>
|
119 |
+
|
120 |
+
<h3 class="red-border-bottom"><?php if ( ! empty( $instance['title'] ) ): echo apply_filters( 'widget_title', $instance['title'] ); endif; ?></h3>
|
121 |
+
<!-- FOCUS HEADING -->
|
122 |
+
|
123 |
+
<?php
|
124 |
+
if ( ! empty( $instance['text'] ) ) {
|
125 |
+
echo '<p>';
|
126 |
+
echo htmlspecialchars_decode( apply_filters( 'widget_title', $instance['text'] ) );
|
127 |
+
echo '</p>';
|
128 |
+
}
|
129 |
+
?>
|
130 |
+
|
131 |
+
</div>
|
132 |
+
|
133 |
+
<?php
|
134 |
+
|
135 |
+
echo $after_widget;
|
136 |
+
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Update Widget
|
141 |
+
*
|
142 |
+
* @param $new_instance
|
143 |
+
* @param $old_instance
|
144 |
+
*
|
145 |
+
* @return mixed
|
146 |
+
*/
|
147 |
+
function update( $new_instance, $old_instance ) {
|
148 |
+
|
149 |
+
$instance = $old_instance;
|
150 |
+
$instance['text'] = stripslashes( wp_filter_post_kses( $new_instance['text'] ) );
|
151 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
152 |
+
$instance['link'] = strip_tags( $new_instance['link'] );
|
153 |
+
$instance['image_uri'] = strip_tags( $new_instance['image_uri'] );
|
154 |
+
$instance['custom_media_id'] = strip_tags( $new_instance['custom_media_id'] );
|
155 |
+
$instance['image_in_customizer'] = strip_tags( $new_instance['image_in_customizer'] );
|
156 |
+
|
157 |
+
return $instance;
|
158 |
+
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Widget controls
|
163 |
+
*
|
164 |
+
* @param $instance
|
165 |
+
*/
|
166 |
+
function form( $instance ) {
|
167 |
+
?>
|
168 |
+
|
169 |
+
<p>
|
170 |
+
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title', 'zerif-lite' ); ?></label><br/>
|
171 |
+
<input type="text" name="<?php echo $this->get_field_name( 'title' ); ?>"
|
172 |
+
id="<?php echo $this->get_field_id( 'title' ); ?>"
|
173 |
+
value="<?php if ( ! empty( $instance['title'] ) ): echo $instance['title']; endif; ?>"
|
174 |
+
class="widefat">
|
175 |
+
</p>
|
176 |
+
<p>
|
177 |
+
<label
|
178 |
+
for="<?php echo $this->get_field_id( 'text' ); ?>"><?php _e( 'Text', 'zerif-lite' ); ?></label><br/>
|
179 |
+
<textarea class="widefat" rows="8" cols="20" name="<?php echo $this->get_field_name( 'text' ); ?>"
|
180 |
+
id="<?php echo $this->get_field_id( 'text' ); ?>"><?php if ( ! empty( $instance['text'] ) ): echo htmlspecialchars_decode( $instance['text'] ); endif; ?></textarea>
|
181 |
+
</p>
|
182 |
+
<p>
|
183 |
+
<label
|
184 |
+
for="<?php echo $this->get_field_id( 'link' ); ?>"><?php _e( 'Link', 'zerif-lite' ); ?></label><br/>
|
185 |
+
<input type="text" name="<?php echo $this->get_field_name( 'link' ); ?>"
|
186 |
+
id="<?php echo $this->get_field_id( 'link' ); ?>"
|
187 |
+
value="<?php if ( ! empty( $instance['link'] ) ): echo esc_url( $instance['link'] ); endif; ?>"
|
188 |
+
class="widefat">
|
189 |
+
</p>
|
190 |
+
<p>
|
191 |
+
<label
|
192 |
+
for="<?php echo $this->get_field_id( 'image_uri' ); ?>"><?php _e( 'Image', 'zerif-lite' ); ?></label><br/>
|
193 |
+
|
194 |
+
<?php
|
195 |
+
$image_in_customizer = '';
|
196 |
+
$display = 'none';
|
197 |
+
if ( ! empty( $instance['image_in_customizer'] ) && ! empty( $instance['image_uri'] ) ) {
|
198 |
+
$image_in_customizer = esc_url( $instance['image_in_customizer'] );
|
199 |
+
$display = 'inline-block';
|
200 |
+
} else {
|
201 |
+
if ( ! empty( $instance['image_uri'] ) ) {
|
202 |
+
$image_in_customizer = esc_url( $instance['image_uri'] );
|
203 |
+
$display = 'inline-block';
|
204 |
+
}
|
205 |
+
}
|
206 |
+
$zerif_image_in_customizer = $this->get_field_name( 'image_in_customizer' );
|
207 |
+
?>
|
208 |
+
<input type="hidden" class="custom_media_display_in_customizer"
|
209 |
+
name="<?php if ( ! empty( $zerif_image_in_customizer ) ) {
|
210 |
+
echo $zerif_image_in_customizer;
|
211 |
+
} ?>"
|
212 |
+
value="<?php if ( ! empty( $instance['image_in_customizer'] ) ): echo $instance['image_in_customizer']; endif; ?>">
|
213 |
+
<img class="custom_media_image" src="<?php echo $image_in_customizer; ?>"
|
214 |
+
style="margin:0;padding:0;max-width:100px;float:left;display:<?php echo $display; ?>"
|
215 |
+
alt="<?php echo __( 'Uploaded image', 'zerif-lite' ); ?>"/><br/>
|
216 |
+
|
217 |
+
<input type="text" class="widefat custom_media_url"
|
218 |
+
name="<?php echo $this->get_field_name( 'image_uri' ); ?>"
|
219 |
+
id="<?php echo $this->get_field_id( 'image_uri' ); ?>"
|
220 |
+
value="<?php if ( ! empty( $instance['image_uri'] ) ): echo $instance['image_uri']; endif; ?>"
|
221 |
+
style="margin-top:5px;">
|
222 |
+
|
223 |
+
<input type="button" class="button button-primary custom_media_button" id="custom_media_button"
|
224 |
+
name="<?php echo $this->get_field_name( 'image_uri' ); ?>"
|
225 |
+
value="<?php _e( 'Upload Image', 'zerif-lite' ); ?>" style="margin-top:5px;">
|
226 |
+
</p>
|
227 |
+
|
228 |
+
<input class="custom_media_id" id="<?php echo $this->get_field_id( 'custom_media_id' ); ?>"
|
229 |
+
name="<?php echo $this->get_field_name( 'custom_media_id' ); ?>" type="hidden"
|
230 |
+
value="<?php if ( ! empty( $instance["custom_media_id"] ) ): echo $instance["custom_media_id"]; endif; ?>"/>
|
231 |
+
|
232 |
+
<?php
|
233 |
+
|
234 |
+
}
|
235 |
+
|
236 |
+
}
|
237 |
+
}
|
inc/widget-team.php
ADDED
@@ -0,0 +1,387 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Testimonial Widget
|
4 |
+
*
|
5 |
+
* @since 1.0.0
|
6 |
+
*
|
7 |
+
* @package themeisle-companion
|
8 |
+
*/
|
9 |
+
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class zerif_team_widget
|
13 |
+
*/
|
14 |
+
if ( !class_exists( 'zerif_team_widget' ) ) {
|
15 |
+
|
16 |
+
class zerif_team_widget extends WP_Widget {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* zerif_team_widget constructor.
|
20 |
+
*/
|
21 |
+
public function __construct() {
|
22 |
+
parent::__construct(
|
23 |
+
'zerif_team-widget',
|
24 |
+
__( 'Zerif - Team member widget', 'zerif-lite' ),
|
25 |
+
array(
|
26 |
+
'customize_selective_refresh' => true,
|
27 |
+
)
|
28 |
+
);
|
29 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'widget_scripts' ) );
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Enqueue Widget Scripts
|
34 |
+
*
|
35 |
+
* @param $hook
|
36 |
+
*/
|
37 |
+
function widget_scripts( $hook ) {
|
38 |
+
if ( $hook != 'widgets.php' ) {
|
39 |
+
return;
|
40 |
+
}
|
41 |
+
wp_enqueue_media();
|
42 |
+
wp_enqueue_script( 'zerif_widget_media_script', THEMEISLE_COMPANION_URL . 'assets/js/widget-media.js', false, '1.1', true );
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Display Widget
|
47 |
+
*
|
48 |
+
* @param $args
|
49 |
+
* @param $instance
|
50 |
+
*/
|
51 |
+
function widget( $args, $instance ) {
|
52 |
+
|
53 |
+
extract( $args );
|
54 |
+
|
55 |
+
echo $before_widget;
|
56 |
+
|
57 |
+
?>
|
58 |
+
|
59 |
+
<div class="col-lg-3 col-sm-3 team-box">
|
60 |
+
|
61 |
+
<div class="team-member" tabindex="0">
|
62 |
+
|
63 |
+
<?php if ( ! empty( $instance['image_uri'] ) && ( $instance['image_uri'] != 'Upload Image' ) ) { ?>
|
64 |
+
|
65 |
+
|
66 |
+
<figure class="profile-pic">
|
67 |
+
|
68 |
+
<img src="<?php echo esc_url( $instance['image_uri'] ); ?>" alt=""/>
|
69 |
+
|
70 |
+
</figure>
|
71 |
+
<?php
|
72 |
+
} elseif ( ! empty( $instance['custom_media_id'] ) ) {
|
73 |
+
|
74 |
+
$zerif_team_custom_media_id = wp_get_attachment_image_src( $instance["custom_media_id"] );
|
75 |
+
$alt = get_post_meta( $instance['custom_media_id'], '_wp_attachment_image_alt', true );
|
76 |
+
|
77 |
+
if ( ! empty( $zerif_team_custom_media_id ) && ! empty( $zerif_team_custom_media_id[0] ) ) {
|
78 |
+
?>
|
79 |
+
|
80 |
+
<figure class="profile-pic">
|
81 |
+
|
82 |
+
<img src="<?php echo esc_url( $zerif_team_custom_media_id[0] ); ?>"
|
83 |
+
alt="<?php echo $alt; ?>"/>
|
84 |
+
|
85 |
+
</figure>
|
86 |
+
|
87 |
+
<?php
|
88 |
+
}
|
89 |
+
}
|
90 |
+
?>
|
91 |
+
|
92 |
+
<div class="member-details">
|
93 |
+
|
94 |
+
<?php if ( ! empty( $instance['name'] ) ): ?>
|
95 |
+
|
96 |
+
<h3 class="dark-text red-border-bottom"><?php echo apply_filters( 'widget_title', $instance['name'] ); ?></h3>
|
97 |
+
|
98 |
+
<?php endif; ?>
|
99 |
+
|
100 |
+
<?php if ( ! empty( $instance['position'] ) ): ?>
|
101 |
+
|
102 |
+
<div
|
103 |
+
class="position"><?php echo htmlspecialchars_decode( apply_filters( 'widget_title', $instance['position'] ) ); ?></div>
|
104 |
+
|
105 |
+
<?php endif; ?>
|
106 |
+
|
107 |
+
</div>
|
108 |
+
|
109 |
+
<div class="social-icons">
|
110 |
+
|
111 |
+
<ul>
|
112 |
+
<?php
|
113 |
+
$zerif_team_target = '_self';
|
114 |
+
if ( ! empty( $instance['open_new_window'] ) ):
|
115 |
+
$zerif_team_target = '_blank';
|
116 |
+
endif;
|
117 |
+
?>
|
118 |
+
|
119 |
+
<?php
|
120 |
+
if ( ! empty( $instance['fb_link'] ) ): ?>
|
121 |
+
<li>
|
122 |
+
<a href="<?php echo apply_filters( 'widget_title', $instance['fb_link'] ); ?>"
|
123 |
+
target="<?php echo $zerif_team_target; ?>">
|
124 |
+
<?php
|
125 |
+
if ( ! empty( $instance['name'] ) ) { ?>
|
126 |
+
<span class="sr-only">
|
127 |
+
<?php _e( 'Facebook account of', 'zerif-lite' ); ?>
|
128 |
+
<?php echo apply_filters( 'widget_title', $instance['name'] ); ?>
|
129 |
+
</span>
|
130 |
+
<?php
|
131 |
+
} ?>
|
132 |
+
<i class="fa fa-facebook"></i>
|
133 |
+
</a>
|
134 |
+
</li>
|
135 |
+
<?php
|
136 |
+
endif;
|
137 |
+
|
138 |
+
if ( ! empty( $instance['tw_link'] ) ): ?>
|
139 |
+
<li>
|
140 |
+
<a href="<?php echo apply_filters( 'widget_title', $instance['tw_link'] ); ?>"
|
141 |
+
target="<?php echo $zerif_team_target; ?>">
|
142 |
+
<?php
|
143 |
+
if ( ! empty( $instance['name'] ) ) { ?>
|
144 |
+
<span class="sr-only">
|
145 |
+
<?php _e( 'Twitter account of', 'zerif-lite' ); ?>
|
146 |
+
<?php echo apply_filters( 'widget_title', $instance['name'] ); ?>
|
147 |
+
</span>
|
148 |
+
<?php
|
149 |
+
} ?>
|
150 |
+
<i class="fa fa-twitter"></i>
|
151 |
+
</a>
|
152 |
+
</li>
|
153 |
+
<?php
|
154 |
+
endif;
|
155 |
+
|
156 |
+
if ( ! empty( $instance['bh_link'] ) ): ?>
|
157 |
+
<li>
|
158 |
+
<a href="<?php echo apply_filters( 'widget_title', $instance['bh_link'] ); ?>"
|
159 |
+
target="<?php echo $zerif_team_target; ?>">
|
160 |
+
<?php
|
161 |
+
if ( ! empty( $instance['name'] ) ) { ?>
|
162 |
+
<span class="sr-only">
|
163 |
+
<?php _e( 'Behance account of', 'zerif-lite' ); ?>
|
164 |
+
<?php echo apply_filters( 'widget_title', $instance['name'] ); ?>
|
165 |
+
</span>
|
166 |
+
<?php
|
167 |
+
} ?>
|
168 |
+
<i class="fa fa-behance"></i>
|
169 |
+
</a>
|
170 |
+
</li>
|
171 |
+
<?php
|
172 |
+
endif;
|
173 |
+
|
174 |
+
if ( ! empty( $instance['db_link'] ) ): ?>
|
175 |
+
<li>
|
176 |
+
<a href="<?php echo apply_filters( 'widget_title', $instance['db_link'] ); ?>"
|
177 |
+
target="<?php echo $zerif_team_target; ?>">
|
178 |
+
<?php
|
179 |
+
if ( ! empty( $instance['name'] ) ) { ?>
|
180 |
+
<span class="sr-only">
|
181 |
+
<?php _e( 'Dribble account of', 'zerif-lite' ); ?>
|
182 |
+
<?php echo apply_filters( 'widget_title', $instance['name'] ); ?>
|
183 |
+
</span>
|
184 |
+
<?php
|
185 |
+
} ?>
|
186 |
+
<i class="fa fa-dribbble"></i>
|
187 |
+
</a>
|
188 |
+
</li>
|
189 |
+
<?php
|
190 |
+
endif;
|
191 |
+
|
192 |
+
if ( ! empty( $instance['ln_link'] ) ): ?>
|
193 |
+
<li>
|
194 |
+
<a href="<?php echo apply_filters( 'widget_title', $instance['ln_link'] ); ?>"
|
195 |
+
target="<?php echo $zerif_team_target; ?>">
|
196 |
+
<?php
|
197 |
+
if ( ! empty( $instance['name'] ) ) { ?>
|
198 |
+
<span class="sr-only">
|
199 |
+
<?php _e( 'Linkedin account of', 'zerif-lite' ); ?>
|
200 |
+
<?php echo apply_filters( 'widget_title', $instance['name'] ); ?>
|
201 |
+
</span>
|
202 |
+
<?php
|
203 |
+
} ?>
|
204 |
+
<i class="fa fa-linkedin"></i>
|
205 |
+
</a>
|
206 |
+
</li>
|
207 |
+
<?php
|
208 |
+
endif; ?>
|
209 |
+
|
210 |
+
</ul>
|
211 |
+
|
212 |
+
</div>
|
213 |
+
|
214 |
+
<?php if ( ! empty( $instance['description'] ) ): ?>
|
215 |
+
<div class="details">
|
216 |
+
|
217 |
+
<?php echo htmlspecialchars_decode( apply_filters( 'widget_title', $instance['description'] ) ); ?>
|
218 |
+
|
219 |
+
</div>
|
220 |
+
<?php endif; ?>
|
221 |
+
|
222 |
+
</div>
|
223 |
+
|
224 |
+
</div>
|
225 |
+
|
226 |
+
<?php
|
227 |
+
|
228 |
+
echo $after_widget;
|
229 |
+
|
230 |
+
}
|
231 |
+
|
232 |
+
/**
|
233 |
+
* Update Widget
|
234 |
+
*
|
235 |
+
* @param $new_instance
|
236 |
+
* @param $old_instance
|
237 |
+
*
|
238 |
+
* @return mixed
|
239 |
+
*/
|
240 |
+
function update( $new_instance, $old_instance ) {
|
241 |
+
|
242 |
+
$instance = $old_instance;
|
243 |
+
|
244 |
+
$instance['name'] = strip_tags( $new_instance['name'] );
|
245 |
+
$instance['position'] = stripslashes( wp_filter_post_kses( $new_instance['position'] ) );
|
246 |
+
$instance['description'] = stripslashes( wp_filter_post_kses( $new_instance['description'] ) );
|
247 |
+
$instance['fb_link'] = strip_tags( $new_instance['fb_link'] );
|
248 |
+
$instance['tw_link'] = strip_tags( $new_instance['tw_link'] );
|
249 |
+
$instance['bh_link'] = strip_tags( $new_instance['bh_link'] );
|
250 |
+
$instance['db_link'] = strip_tags( $new_instance['db_link'] );
|
251 |
+
$instance['ln_link'] = strip_tags( $new_instance['ln_link'] );
|
252 |
+
$instance['image_uri'] = strip_tags( $new_instance['image_uri'] );
|
253 |
+
$instance['open_new_window'] = strip_tags( $new_instance['open_new_window'] );
|
254 |
+
$instance['custom_media_id'] = strip_tags( $new_instance['custom_media_id'] );
|
255 |
+
$instance['image_in_customizer'] = strip_tags( $new_instance['image_in_customizer'] );
|
256 |
+
|
257 |
+
return $instance;
|
258 |
+
|
259 |
+
}
|
260 |
+
|
261 |
+
/**
|
262 |
+
* Widget controls
|
263 |
+
*
|
264 |
+
* @param $instance
|
265 |
+
*/
|
266 |
+
function form( $instance ) {
|
267 |
+
|
268 |
+
?>
|
269 |
+
|
270 |
+
<p>
|
271 |
+
<label
|
272 |
+
for="<?php echo $this->get_field_id( 'name' ); ?>"><?php _e( 'Name', 'zerif-lite' ); ?></label><br/>
|
273 |
+
<input type="text" name="<?php echo $this->get_field_name( 'name' ); ?>"
|
274 |
+
id="<?php echo $this->get_field_id( 'name' ); ?>"
|
275 |
+
value="<?php if ( ! empty( $instance['name'] ) ): echo $instance['name']; endif; ?>"
|
276 |
+
class="widefat"/>
|
277 |
+
</p>
|
278 |
+
<p>
|
279 |
+
<label
|
280 |
+
for="<?php echo $this->get_field_id( 'position' ); ?>"><?php _e( 'Position', 'zerif-lite' ); ?></label><br/>
|
281 |
+
<textarea class="widefat" rows="8" cols="20" name="<?php echo $this->get_field_name( 'position' ); ?>"
|
282 |
+
id="<?php echo $this->get_field_id( 'position' ); ?>"><?php if ( ! empty( $instance['position'] ) ): echo htmlspecialchars_decode( $instance['position'] ); endif; ?></textarea>
|
283 |
+
</p>
|
284 |
+
<p>
|
285 |
+
<label
|
286 |
+
for="<?php echo $this->get_field_id( 'description' ); ?>"><?php _e( 'Description', 'zerif-lite' ); ?></label><br/>
|
287 |
+
<textarea class="widefat" rows="8" cols="20"
|
288 |
+
name="<?php echo $this->get_field_name( 'description' ); ?>"
|
289 |
+
id="<?php echo $this->get_field_id( 'description' ); ?>"><?php
|
290 |
+
if ( ! empty( $instance['description'] ) ): echo htmlspecialchars_decode( $instance['description'] ); endif;
|
291 |
+
?></textarea>
|
292 |
+
</p>
|
293 |
+
<p>
|
294 |
+
<label
|
295 |
+
for="<?php echo $this->get_field_id( 'fb_link' ); ?>"><?php _e( 'Facebook link', 'zerif-lite' ); ?></label><br/>
|
296 |
+
<input type="text" name="<?php echo $this->get_field_name( 'fb_link' ); ?>"
|
297 |
+
id="<?php echo $this->get_field_id( 'fb_link' ); ?>"
|
298 |
+
value="<?php if ( ! empty( $instance['fb_link'] ) ): echo $instance['fb_link']; endif; ?>"
|
299 |
+
class="widefat">
|
300 |
+
|
301 |
+
</p>
|
302 |
+
<p>
|
303 |
+
<label
|
304 |
+
for="<?php echo $this->get_field_id( 'tw_link' ); ?>"><?php _e( 'Twitter link', 'zerif-lite' ); ?></label><br/>
|
305 |
+
<input type="text" name="<?php echo $this->get_field_name( 'tw_link' ); ?>"
|
306 |
+
id="<?php echo $this->get_field_id( 'tw_link' ); ?>"
|
307 |
+
value="<?php if ( ! empty( $instance['tw_link'] ) ): echo $instance['tw_link']; endif; ?>"
|
308 |
+
class="widefat">
|
309 |
+
</p>
|
310 |
+
<p>
|
311 |
+
<label
|
312 |
+
for="<?php echo $this->get_field_id( 'bh_link' ); ?>"><?php _e( 'Behance link', 'zerif-lite' ); ?></label><br/>
|
313 |
+
<input type="text" name="<?php echo $this->get_field_name( 'bh_link' ); ?>"
|
314 |
+
id="<?php echo $this->get_field_id( 'bh_link' ); ?>"
|
315 |
+
value="<?php if ( ! empty( $instance['bh_link'] ) ): echo $instance['bh_link']; endif; ?>"
|
316 |
+
class="widefat">
|
317 |
+
|
318 |
+
</p>
|
319 |
+
<p>
|
320 |
+
<label
|
321 |
+
for="<?php echo $this->get_field_id( 'db_link' ); ?>"><?php _e( 'Dribble link', 'zerif-lite' ); ?></label><br/>
|
322 |
+
<input type="text" name="<?php echo $this->get_field_name( 'db_link' ); ?>"
|
323 |
+
id="<?php echo $this->get_field_id( 'db_link' ); ?>"
|
324 |
+
value="<?php if ( ! empty( $instance['db_link'] ) ): echo $instance['db_link']; endif; ?>"
|
325 |
+
class="widefat">
|
326 |
+
</p>
|
327 |
+
<p>
|
328 |
+
<label
|
329 |
+
for="<?php echo $this->get_field_id( 'ln_link' ); ?>"><?php _e( 'Linkedin link', 'zerif-lite' ); ?></label><br/>
|
330 |
+
<input type="text" name="<?php echo $this->get_field_name( 'ln_link' ); ?>"
|
331 |
+
id="<?php echo $this->get_field_id( 'ln_link' ); ?>"
|
332 |
+
value="<?php if ( ! empty( $instance['ln_link'] ) ): echo $instance['ln_link']; endif; ?>"
|
333 |
+
class="widefat">
|
334 |
+
</p>
|
335 |
+
<p>
|
336 |
+
<input type="checkbox" name="<?php echo $this->get_field_name( 'open_new_window' ); ?>"
|
337 |
+
id="<?php echo $this->get_field_id( 'open_new_window' ); ?>" <?php if ( ! empty( $instance['open_new_window'] ) ): checked( (bool) $instance['open_new_window'], true ); endif; ?> ><?php _e( 'Open links in new window?', 'zerif-lite' ); ?>
|
338 |
+
<br>
|
339 |
+
</p>
|
340 |
+
<p>
|
341 |
+
<label
|
342 |
+
for="<?php echo $this->get_field_id( 'image_uri' ); ?>"><?php _e( 'Image', 'zerif-lite' ); ?></label><br/>
|
343 |
+
|
344 |
+
<?php
|
345 |
+
$image_in_customizer = '';
|
346 |
+
$display = 'none';
|
347 |
+
if ( ! empty( $instance['image_in_customizer'] ) && ! empty( $instance['image_uri'] ) ) {
|
348 |
+
$image_in_customizer = esc_url( $instance['image_in_customizer'] );
|
349 |
+
$display = 'inline-block';
|
350 |
+
} else {
|
351 |
+
if ( ! empty( $instance['image_uri'] ) ) {
|
352 |
+
$image_in_customizer = esc_url( $instance['image_uri'] );
|
353 |
+
$display = 'inline-block';
|
354 |
+
}
|
355 |
+
}
|
356 |
+
$zerif_image_in_customizer = $this->get_field_name( 'image_in_customizer' );
|
357 |
+
?>
|
358 |
+
<input type="hidden" class="custom_media_display_in_customizer"
|
359 |
+
name="<?php if ( ! empty( $zerif_image_in_customizer ) ) {
|
360 |
+
echo $zerif_image_in_customizer;
|
361 |
+
} ?>"
|
362 |
+
value="<?php if ( ! empty( $instance['image_in_customizer'] ) ): echo $instance['image_in_customizer']; endif; ?>">
|
363 |
+
<img class="custom_media_image" src="<?php echo $image_in_customizer; ?>"
|
364 |
+
style="margin:0;padding:0;max-width:100px;float:left;display:<?php echo $display; ?>"
|
365 |
+
alt="<?php echo __( 'Uploaded image', 'zerif-lite' ); ?>"/><br/>
|
366 |
+
|
367 |
+
<input type="text" class="widefat custom_media_url"
|
368 |
+
name="<?php echo $this->get_field_name( 'image_uri' ); ?>"
|
369 |
+
id="<?php echo $this->get_field_id( 'image_uri' ); ?>"
|
370 |
+
value="<?php if ( ! empty( $instance['image_uri'] ) ): echo $instance['image_uri']; endif; ?>"
|
371 |
+
style="margin-top:5px;">
|
372 |
+
|
373 |
+
<input type="button" class="button button-primary custom_media_button" id="custom_media_button"
|
374 |
+
name="<?php echo $this->get_field_name( 'image_uri' ); ?>"
|
375 |
+
value="<?php _e( 'Upload Image', 'zerif-lite' ); ?>" style="margin-top:5px;">
|
376 |
+
</p>
|
377 |
+
|
378 |
+
<input class="custom_media_id" id="<?php echo $this->get_field_id( 'custom_media_id' ); ?>"
|
379 |
+
name="<?php echo $this->get_field_name( 'custom_media_id' ); ?>" type="hidden"
|
380 |
+
value="<?php if ( ! empty( $instance["custom_media_id"] ) ): echo $instance["custom_media_id"]; endif; ?>"/>
|
381 |
+
|
382 |
+
<?php
|
383 |
+
|
384 |
+
}
|
385 |
+
|
386 |
+
}
|
387 |
+
}
|
inc/widget-testimonial.php
ADDED
@@ -0,0 +1,244 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Testimonial Widget
|
4 |
+
*
|
5 |
+
* @since 1.0.0
|
6 |
+
*
|
7 |
+
* @package themeisle-companion
|
8 |
+
*/
|
9 |
+
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class zerif_testimonial_widget
|
13 |
+
*/
|
14 |
+
if ( !class_exists( 'zerif_testimonial_widget' ) ) {
|
15 |
+
|
16 |
+
class zerif_testimonial_widget extends WP_Widget {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* zerif_testimonial_widget constructor.
|
20 |
+
*/
|
21 |
+
public function __construct() {
|
22 |
+
parent::__construct(
|
23 |
+
'zerif_testim-widget',
|
24 |
+
__( 'Zerif - Testimonial widget', 'zerif-lite' ),
|
25 |
+
array(
|
26 |
+
'customize_selective_refresh' => true,
|
27 |
+
)
|
28 |
+
);
|
29 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'widget_scripts' ) );
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Enqueue Widget Scripts
|
34 |
+
*
|
35 |
+
* @param $hook
|
36 |
+
*/
|
37 |
+
function widget_scripts( $hook ) {
|
38 |
+
if ( $hook != 'widgets.php' ) {
|
39 |
+
return;
|
40 |
+
}
|
41 |
+
wp_enqueue_media();
|
42 |
+
wp_enqueue_script( 'zerif_widget_media_script', THEMEISLE_COMPANION_URL . 'assets/js/widget-media.js', false, '1.1', true );
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Display Widget
|
47 |
+
*
|
48 |
+
* @param $args
|
49 |
+
* @param $instance
|
50 |
+
*/
|
51 |
+
function widget( $args, $instance ) {
|
52 |
+
|
53 |
+
extract( $args );
|
54 |
+
|
55 |
+
$zerif_accessibility = get_theme_mod( 'zerif_accessibility' );
|
56 |
+
// open link in a new tab when checkbox "accessibility" is not ticked
|
57 |
+
$attribut_new_tab = ( isset( $zerif_accessibility ) && ( $zerif_accessibility != 1 ) ? ' target="_blank"' : '' );
|
58 |
+
|
59 |
+
echo $before_widget;
|
60 |
+
|
61 |
+
?>
|
62 |
+
|
63 |
+
|
64 |
+
<!-- MESSAGE OF THE CLIENT -->
|
65 |
+
|
66 |
+
<?php if ( ! empty( $instance['text'] ) ): ?>
|
67 |
+
<div class="message">
|
68 |
+
<?php echo htmlspecialchars_decode( apply_filters( 'widget_title', $instance['text'] ) ); ?>
|
69 |
+
</div>
|
70 |
+
<?php endif; ?>
|
71 |
+
|
72 |
+
<!-- CLIENT INFORMATION -->
|
73 |
+
|
74 |
+
<div class="client">
|
75 |
+
|
76 |
+
<div class="quote red-text">
|
77 |
+
|
78 |
+
<i class="fa fa-quote-left"></i>
|
79 |
+
|
80 |
+
</div>
|
81 |
+
|
82 |
+
<div class="client-info">
|
83 |
+
|
84 |
+
<a <?php echo $attribut_new_tab; ?>
|
85 |
+
class="client-name" <?php if ( ! empty( $instance['link'] ) ): echo 'href="' . esc_url( $instance['link'] ) . '"'; endif; ?>><?php if ( ! empty( $instance['title'] ) ): echo apply_filters( 'widget_title', $instance['title'] ); endif; ?></a>
|
86 |
+
|
87 |
+
|
88 |
+
<?php if ( ! empty( $instance['details'] ) ): ?>
|
89 |
+
<div class="client-company">
|
90 |
+
|
91 |
+
<?php echo apply_filters( 'widget_title', $instance['details'] ); ?>
|
92 |
+
|
93 |
+
</div>
|
94 |
+
<?php endif; ?>
|
95 |
+
|
96 |
+
</div>
|
97 |
+
|
98 |
+
<?php
|
99 |
+
|
100 |
+
if ( ! empty( $instance['image_uri'] ) && ( $instance['image_uri'] != 'Upload Image' ) ) {
|
101 |
+
|
102 |
+
echo '<div class="client-image hidden-xs">';
|
103 |
+
|
104 |
+
echo '<img src="' . esc_url( $instance['image_uri'] ) . '" alt="" />';
|
105 |
+
|
106 |
+
echo '</div>';
|
107 |
+
|
108 |
+
} elseif ( ! empty( $instance['custom_media_id'] ) ) {
|
109 |
+
|
110 |
+
$zerif_testimonials_custom_media_id = wp_get_attachment_image_src( $instance["custom_media_id"] );
|
111 |
+
$alt = get_post_meta( $instance['custom_media_id'], '_wp_attachment_image_alt', true );
|
112 |
+
|
113 |
+
if ( ! empty( $zerif_testimonials_custom_media_id ) && ! empty( $zerif_testimonials_custom_media_id[0] ) ) {
|
114 |
+
|
115 |
+
echo '<div class="client-image hidden-xs">';
|
116 |
+
|
117 |
+
echo '<img src="' . esc_url( $zerif_testimonials_custom_media_id[0] ) . '" alt="' . $alt . '" />';
|
118 |
+
|
119 |
+
echo '</div>';
|
120 |
+
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
?>
|
125 |
+
|
126 |
+
</div>
|
127 |
+
<!-- / END CLIENT INFORMATION-->
|
128 |
+
|
129 |
+
|
130 |
+
<?php
|
131 |
+
|
132 |
+
echo $after_widget;
|
133 |
+
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Update Widget
|
138 |
+
*
|
139 |
+
* @param $new_instance
|
140 |
+
* @param $old_instance
|
141 |
+
*
|
142 |
+
* @return mixed
|
143 |
+
*/
|
144 |
+
function update( $new_instance, $old_instance ) {
|
145 |
+
|
146 |
+
$instance = $old_instance;
|
147 |
+
$instance['text'] = stripslashes( wp_filter_post_kses( $new_instance['text'] ) );
|
148 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
149 |
+
$instance['details'] = strip_tags( $new_instance['details'] );
|
150 |
+
$instance['image_uri'] = strip_tags( $new_instance['image_uri'] );
|
151 |
+
$instance['link'] = strip_tags( $new_instance['link'] );
|
152 |
+
$instance['custom_media_id'] = strip_tags( $new_instance['custom_media_id'] );
|
153 |
+
$instance['image_in_customizer'] = strip_tags( $new_instance['image_in_customizer'] );
|
154 |
+
|
155 |
+
return $instance;
|
156 |
+
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Widget controls
|
161 |
+
*
|
162 |
+
* @param $instance
|
163 |
+
*/
|
164 |
+
function form( $instance ) {
|
165 |
+
?>
|
166 |
+
|
167 |
+
<p>
|
168 |
+
<label
|
169 |
+
for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Author', 'zerif-lite' ); ?></label><br/>
|
170 |
+
<input type="text" name="<?php echo $this->get_field_name( 'title' ); ?>"
|
171 |
+
id="<?php echo $this->get_field_id( 'title' ); ?>"
|
172 |
+
value="<?php if ( ! empty( $instance['title'] ) ): echo $instance['title']; endif; ?>"
|
173 |
+
class="widefat">
|
174 |
+
</p>
|
175 |
+
<p>
|
176 |
+
<label
|
177 |
+
for="<?php echo $this->get_field_id( 'link' ); ?>"><?php _e( 'Author link', 'zerif-lite' ); ?></label><br/>
|
178 |
+
<input type="text" name="<?php echo $this->get_field_name( 'link' ); ?>"
|
179 |
+
id="<?php echo $this->get_field_id( 'link' ); ?>"
|
180 |
+
value="<?php if ( ! empty( $instance['link'] ) ): echo esc_url( $instance['link'] ); endif; ?>"
|
181 |
+
class="widefat">
|
182 |
+
</p>
|
183 |
+
<p>
|
184 |
+
<label
|
185 |
+
for="<?php echo $this->get_field_id( 'details' ); ?>"><?php _e( 'Author details', 'zerif-lite' ); ?></label><br/>
|
186 |
+
<input type="text" name="<?php echo $this->get_field_name( 'details' ); ?>"
|
187 |
+
id="<?php echo $this->get_field_id( 'details' ); ?>"
|
188 |
+
value="<?php if ( ! empty( $instance['details'] ) ): echo $instance['details']; endif; ?>"
|
189 |
+
class="widefat">
|
190 |
+
</p>
|
191 |
+
<p>
|
192 |
+
<label
|
193 |
+
for="<?php echo $this->get_field_id( 'text' ); ?>"><?php _e( 'Text', 'zerif-lite' ); ?></label><br/>
|
194 |
+
<textarea class="widefat" rows="8" cols="20" name="<?php echo $this->get_field_name( 'text' ); ?>"
|
195 |
+
id="<?php echo $this->get_field_id( 'text' ); ?>"><?php if ( ! empty( $instance['text'] ) ): echo htmlspecialchars_decode( $instance['text'] ); endif; ?></textarea>
|
196 |
+
</p>
|
197 |
+
<p>
|
198 |
+
<label
|
199 |
+
for="<?php echo $this->get_field_id( 'image_uri' ); ?>"><?php _e( 'Image', 'zerif-lite' ); ?></label><br/>
|
200 |
+
|
201 |
+
<?php
|
202 |
+
$image_in_customizer = '';
|
203 |
+
$display = 'none';
|
204 |
+
if ( ! empty( $instance['image_in_customizer'] ) && ! empty( $instance['image_uri'] ) ) {
|
205 |
+
$image_in_customizer = esc_url( $instance['image_in_customizer'] );
|
206 |
+
$display = 'inline-block';
|
207 |
+
} else {
|
208 |
+
if ( ! empty( $instance['image_uri'] ) ) {
|
209 |
+
$image_in_customizer = esc_url( $instance['image_uri'] );
|
210 |
+
$display = 'inline-block';
|
211 |
+
}
|
212 |
+
}
|
213 |
+
$zerif_image_in_customizer = $this->get_field_name( 'image_in_customizer' );
|
214 |
+
?>
|
215 |
+
<input type="hidden" class="custom_media_display_in_customizer"
|
216 |
+
name="<?php if ( ! empty( $zerif_image_in_customizer ) ) {
|
217 |
+
echo $zerif_image_in_customizer;
|
218 |
+
} ?>"
|
219 |
+
value="<?php if ( ! empty( $instance['image_in_customizer'] ) ): echo $instance['image_in_customizer']; endif; ?>">
|
220 |
+
<img class="custom_media_image" src="<?php echo $image_in_customizer; ?>"
|
221 |
+
style="margin:0;padding:0;max-width:100px;float:left;display:<?php echo $display; ?>"
|
222 |
+
alt="<?php echo __( 'Uploaded image', 'zerif-lite' ); ?>"/><br/>
|
223 |
+
|
224 |
+
<input type="text" class="widefat custom_media_url"
|
225 |
+
name="<?php echo $this->get_field_name( 'image_uri' ); ?>"
|
226 |
+
id="<?php echo $this->get_field_id( 'image_uri' ); ?>"
|
227 |
+
value="<?php if ( ! empty( $instance['image_uri'] ) ): echo $instance['image_uri']; endif; ?>"
|
228 |
+
style="margin-top:5px;">
|
229 |
+
|
230 |
+
<input type="button" class="button button-primary custom_media_button" id="custom_media_button"
|
231 |
+
name="<?php echo $this->get_field_name( 'image_uri' ); ?>"
|
232 |
+
value="<?php _e( 'Upload Image', 'zerif-lite' ); ?>" style="margin-top:5px;">
|
233 |
+
</p>
|
234 |
+
|
235 |
+
<input class="custom_media_id" id="<?php echo $this->get_field_id( 'custom_media_id' ); ?>"
|
236 |
+
name="<?php echo $this->get_field_name( 'custom_media_id' ); ?>" type="hidden"
|
237 |
+
value="<?php if ( ! empty( $instance["custom_media_id"] ) ): echo $instance["custom_media_id"]; endif; ?>"/>
|
238 |
+
|
239 |
+
<?php
|
240 |
+
|
241 |
+
}
|
242 |
+
|
243 |
+
}
|
244 |
+
}
|
readme.txt
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== ThemeIsle Companion ===
|
2 |
+
Contributors: themeisle, codeinwp, rodicaelena, baicusandrei
|
3 |
+
Tags: widget, admin, widgets
|
4 |
+
Requires at least: 3.0
|
5 |
+
Tested up to: 4.5.2
|
6 |
+
Stable tag: trunk
|
7 |
+
License: GPLv2 or later
|
8 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
+
|
10 |
+
Creates the Testimonial, Team member, Our focus and Clients widgets in Zerif Lite.
|
11 |
+
|
12 |
+
== Description ==
|
13 |
+
|
14 |
+
This plugin is the companion plugin for Zerif Lite. It creates the widgets "Zerif - Testimonial widget" , "Zerif - Team member widget" , "Zerif - Our focus widget" and "Zerif - Clients widget" in the Zerif Lite theme.
|
15 |
+
|
16 |
+
== Changelog ==
|
17 |
+
|
18 |
+
= 1.0.0 =
|
19 |
+
|
20 |
+
* First version of the plugin
|
themeisle-companion.php
ADDED
@@ -0,0 +1,328 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: ThemeIsle Companion
|
4 |
+
Plugin URI: https://github.com/Codeinwp/themeisle-companion
|
5 |
+
Description: Creates the widgets "Zerif - Testimonial widget" , "Zerif - Team member widget" , "Zerif - Our focus widget" and "Zerif - Clients widget" in the Zerif Lite theme.
|
6 |
+
Version: 1.0.0
|
7 |
+
Author: Themeisle
|
8 |
+
Author URI: http://themeisle.com
|
9 |
+
Text Domain: themeisle-companion
|
10 |
+
Domain Path: /languages
|
11 |
+
License: GPLv2
|
12 |
+
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
13 |
+
*/
|
14 |
+
|
15 |
+
define( 'THEMEISLE_COMPANION_VERSION', '1.0.0' );
|
16 |
+
define( 'THEMEISLE_COMPANION_PATH', plugin_dir_path( __FILE__ ) );
|
17 |
+
define( 'THEMEISLE_COMPANION_URL', plugin_dir_url( __FILE__ ) );
|
18 |
+
|
19 |
+
|
20 |
+
if ( ! function_exists( 'add_action' ) ) {
|
21 |
+
die('Nothing to do...');
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Populate Zerif frontpage widgets areas with default widgets
|
26 |
+
*/
|
27 |
+
function themeisle_populate_with_default_widgets() {
|
28 |
+
|
29 |
+
$zerif_lite_sidebars = array ( 'sidebar-ourfocus' => 'sidebar-ourfocus', 'sidebar-testimonials' => 'sidebar-testimonials', 'sidebar-ourteam' => 'sidebar-ourteam' );
|
30 |
+
|
31 |
+
$active_widgets = get_option( 'sidebars_widgets' );
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Populate the Our Focus sidebar
|
35 |
+
*/
|
36 |
+
if ( empty ( $active_widgets[ $zerif_lite_sidebars['sidebar-ourfocus'] ] ) ) {
|
37 |
+
|
38 |
+
$zerif_lite_counter = 1;
|
39 |
+
|
40 |
+
/* our focus widget #1 */
|
41 |
+
|
42 |
+
$active_widgets['sidebar-ourfocus'][0] = 'ctup-ads-widget-' . $zerif_lite_counter;
|
43 |
+
|
44 |
+
if ( file_exists( get_stylesheet_directory() . '/images/parallax.png' ) ) {
|
45 |
+
$ourfocus_content[ $zerif_lite_counter ] = array(
|
46 |
+
'title' => 'PARALLAX EFFECT',
|
47 |
+
'text' => 'Create memorable pages with smooth parallax effects that everyone loves. Also, use our lightweight content slider offering you smooth and great-looking animations.',
|
48 |
+
'link' => '#',
|
49 |
+
'image_uri' => get_stylesheet_directory_uri() . "/images/parallax.png"
|
50 |
+
);
|
51 |
+
} else {
|
52 |
+
$ourfocus_content[ $zerif_lite_counter ] = array(
|
53 |
+
'title' => 'PARALLAX EFFECT',
|
54 |
+
'text' => 'Create memorable pages with smooth parallax effects that everyone loves. Also, use our lightweight content slider offering you smooth and great-looking animations.',
|
55 |
+
'link' => '#',
|
56 |
+
'image_uri' => get_template_directory_uri() . "/images/parallax.png"
|
57 |
+
);
|
58 |
+
}
|
59 |
+
|
60 |
+
update_option( 'widget_ctup-ads-widget', $ourfocus_content );
|
61 |
+
|
62 |
+
$zerif_lite_counter ++;
|
63 |
+
|
64 |
+
/* our focus widget #2 */
|
65 |
+
|
66 |
+
$active_widgets['sidebar-ourfocus'][] = 'ctup-ads-widget-' . $zerif_lite_counter;
|
67 |
+
|
68 |
+
if ( file_exists( get_stylesheet_directory() . '/images/woo.png' ) ) {
|
69 |
+
$ourfocus_content[ $zerif_lite_counter ] = array(
|
70 |
+
'title' => 'WOOCOMMERCE',
|
71 |
+
'text' => 'Build a front page for your WooCommerce store in a matter of minutes. The neat and clean presentation will help your sales and make your store accessible to everyone.',
|
72 |
+
'link' => '#',
|
73 |
+
'image_uri' => get_stylesheet_directory_uri() . "/images/woo.png"
|
74 |
+
);
|
75 |
+
} else {
|
76 |
+
$ourfocus_content[ $zerif_lite_counter ] = array(
|
77 |
+
'title' => 'WOOCOMMERCE',
|
78 |
+
'text' => 'Build a front page for your WooCommerce store in a matter of minutes. The neat and clean presentation will help your sales and make your store accessible to everyone.',
|
79 |
+
'link' => '#',
|
80 |
+
'image_uri' => get_template_directory_uri() . "/images/woo.png"
|
81 |
+
);
|
82 |
+
}
|
83 |
+
|
84 |
+
update_option( 'widget_ctup-ads-widget', $ourfocus_content );
|
85 |
+
|
86 |
+
$zerif_lite_counter ++;
|
87 |
+
|
88 |
+
/* our focus widget #3 */
|
89 |
+
|
90 |
+
$active_widgets['sidebar-ourfocus'][] = 'ctup-ads-widget-' . $zerif_lite_counter;
|
91 |
+
|
92 |
+
if ( file_exists( get_stylesheet_directory() . '/images/ccc.png' ) ) {
|
93 |
+
$ourfocus_content[ $zerif_lite_counter ] = array(
|
94 |
+
'title' => 'CUSTOM CONTENT BLOCKS',
|
95 |
+
'text' => 'Showcase your team, products, clients, about info, testimonials, latest posts from the blog, contact form, additional calls to action. Everything translation ready.',
|
96 |
+
'link' => '#',
|
97 |
+
'image_uri' => get_stylesheet_directory_uri() . "/images/ccc.png"
|
98 |
+
);
|
99 |
+
} else {
|
100 |
+
$ourfocus_content[ $zerif_lite_counter ] = array(
|
101 |
+
'title' => 'CUSTOM CONTENT BLOCKS',
|
102 |
+
'text' => 'Showcase your team, products, clients, about info, testimonials, latest posts from the blog, contact form, additional calls to action. Everything translation ready.',
|
103 |
+
'link' => '#',
|
104 |
+
'image_uri' => get_template_directory_uri() . "/images/ccc.png"
|
105 |
+
);
|
106 |
+
}
|
107 |
+
|
108 |
+
update_option( 'widget_ctup-ads-widget', $ourfocus_content );
|
109 |
+
|
110 |
+
$zerif_lite_counter ++;
|
111 |
+
|
112 |
+
/* our focus widget #4 */
|
113 |
+
|
114 |
+
$active_widgets['sidebar-ourfocus'][] = 'ctup-ads-widget-' . $zerif_lite_counter;
|
115 |
+
|
116 |
+
if ( file_exists( get_stylesheet_directory() . '/images/ti-logo.png' ) ) {
|
117 |
+
$ourfocus_content[ $zerif_lite_counter ] = array(
|
118 |
+
'title' => 'GO PRO FOR MORE FEATURES',
|
119 |
+
'text' => 'Get new content blocks: pricing table, Google Maps, and more. Change the sections order, display each block exactly where you need it, customize the blocks with whatever colors you wish.',
|
120 |
+
'link' => '#',
|
121 |
+
'image_uri' => get_stylesheet_directory_uri() . "/images/ti-logo.png"
|
122 |
+
);
|
123 |
+
} else {
|
124 |
+
$ourfocus_content[ $zerif_lite_counter ] = array(
|
125 |
+
'title' => 'GO PRO FOR MORE FEATURES',
|
126 |
+
'text' => 'Get new content blocks: pricing table, Google Maps, and more. Change the sections order, display each block exactly where you need it, customize the blocks with whatever colors you wish.',
|
127 |
+
'link' => '#',
|
128 |
+
'image_uri' => get_template_directory_uri() . "/images/ti-logo.png"
|
129 |
+
);
|
130 |
+
}
|
131 |
+
|
132 |
+
update_option( 'widget_ctup-ads-widget', $ourfocus_content );
|
133 |
+
|
134 |
+
$zerif_lite_counter ++;
|
135 |
+
|
136 |
+
update_option( 'sidebars_widgets', $active_widgets );
|
137 |
+
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Populate the Testimonials sidebar
|
142 |
+
*/
|
143 |
+
if ( empty ( $active_widgets[ $zerif_lite_sidebars['sidebar-testimonials'] ] ) ) {
|
144 |
+
|
145 |
+
$zerif_lite_counter = 1;
|
146 |
+
|
147 |
+
/* testimonial widget #1 */
|
148 |
+
|
149 |
+
$active_widgets['sidebar-testimonials'][0] = 'zerif_testim-widget-' . $zerif_lite_counter;
|
150 |
+
|
151 |
+
if ( file_exists( get_stylesheet_directory() . '/images/testimonial1.jpg' ) ) {
|
152 |
+
$testimonial_content[ $zerif_lite_counter ] = array(
|
153 |
+
'title' => 'Dana Lorem',
|
154 |
+
'text' => 'Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Curabitur nec sem vel sapien venenatis mattis non vitae augue. Nullam congue commodo lorem vitae facilisis. Suspendisse malesuada id turpis interdum dictum.',
|
155 |
+
'image_uri' => get_stylesheet_directory_uri() . "/images/testimonial1.jpg"
|
156 |
+
);
|
157 |
+
} else {
|
158 |
+
$testimonial_content[ $zerif_lite_counter ] = array(
|
159 |
+
'title' => 'Dana Lorem',
|
160 |
+
'text' => 'Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Curabitur nec sem vel sapien venenatis mattis non vitae augue. Nullam congue commodo lorem vitae facilisis. Suspendisse malesuada id turpis interdum dictum.',
|
161 |
+
'image_uri' => get_template_directory_uri() . "/images/testimonial1.jpg"
|
162 |
+
);
|
163 |
+
}
|
164 |
+
|
165 |
+
update_option( 'widget_zerif_testim-widget', $testimonial_content );
|
166 |
+
|
167 |
+
$zerif_lite_counter ++;
|
168 |
+
|
169 |
+
/* testimonial widget #2 */
|
170 |
+
|
171 |
+
$active_widgets['sidebar-testimonials'][] = 'zerif_testim-widget-' . $zerif_lite_counter;
|
172 |
+
|
173 |
+
if ( file_exists( get_stylesheet_directory() . '/images/testimonial2.jpg' ) ) {
|
174 |
+
$testimonial_content[ $zerif_lite_counter ] = array(
|
175 |
+
'title' => 'Linda Guthrie',
|
176 |
+
'text' => 'Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Curabitur nec sem vel sapien venenatis mattis non vitae augue. Nullam congue commodo lorem vitae facilisis. Suspendisse malesuada id turpis interdum dictum.',
|
177 |
+
'image_uri' => get_stylesheet_directory_uri() . "/images/testimonial2.jpg"
|
178 |
+
);
|
179 |
+
} else {
|
180 |
+
$testimonial_content[ $zerif_lite_counter ] = array(
|
181 |
+
'title' => 'Linda Guthrie',
|
182 |
+
'text' => 'Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Curabitur nec sem vel sapien venenatis mattis non vitae augue. Nullam congue commodo lorem vitae facilisis. Suspendisse malesuada id turpis interdum dictum.',
|
183 |
+
'image_uri' => get_template_directory_uri() . "/images/testimonial2.jpg"
|
184 |
+
);
|
185 |
+
}
|
186 |
+
|
187 |
+
update_option( 'widget_zerif_testim-widget', $testimonial_content );
|
188 |
+
|
189 |
+
$zerif_lite_counter ++;
|
190 |
+
|
191 |
+
/* testimonial widget #3 */
|
192 |
+
|
193 |
+
$active_widgets['sidebar-testimonials'][] = 'zerif_testim-widget-' . $zerif_lite_counter;
|
194 |
+
|
195 |
+
if ( file_exists( get_stylesheet_directory() . '/images/testimonial3.jpg' ) ) {
|
196 |
+
$testimonial_content[ $zerif_lite_counter ] = array(
|
197 |
+
'title' => 'Cynthia Henry',
|
198 |
+
'text' => 'Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Curabitur nec sem vel sapien venenatis mattis non vitae augue. Nullam congue commodo lorem vitae facilisis. Suspendisse malesuada id turpis interdum dictum.',
|
199 |
+
'image_uri' => get_stylesheet_directory_uri() . "/images/testimonial3.jpg"
|
200 |
+
);
|
201 |
+
} else {
|
202 |
+
$testimonial_content[ $zerif_lite_counter ] = array(
|
203 |
+
'title' => 'Cynthia Henry',
|
204 |
+
'text' => 'Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Curabitur nec sem vel sapien venenatis mattis non vitae augue. Nullam congue commodo lorem vitae facilisis. Suspendisse malesuada id turpis interdum dictum.',
|
205 |
+
'image_uri' => get_template_directory_uri() . "/images/testimonial3.jpg"
|
206 |
+
);
|
207 |
+
}
|
208 |
+
|
209 |
+
update_option( 'widget_zerif_testim-widget', $testimonial_content );
|
210 |
+
|
211 |
+
$zerif_lite_counter ++;
|
212 |
+
|
213 |
+
update_option( 'sidebars_widgets', $active_widgets );
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Populate the Our team sidebar
|
218 |
+
*/
|
219 |
+
if ( empty ( $active_widgets[ $zerif_lite_sidebars['sidebar-ourteam'] ] ) ) {
|
220 |
+
|
221 |
+
$zerif_lite_counter = 1;
|
222 |
+
|
223 |
+
/* our team widget #1 */
|
224 |
+
|
225 |
+
$active_widgets['sidebar-ourteam'][0] = 'zerif_team-widget-' . $zerif_lite_counter;
|
226 |
+
|
227 |
+
$ourteam_content[ $zerif_lite_counter ] = array( 'name' => 'ASHLEY SIMMONS',
|
228 |
+
'position' => 'Project Manager',
|
229 |
+
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc dapibus, eros at accumsan auctor, felis eros condimentum quam, non porttitor est urna vel neque',
|
230 |
+
'fb_link' => '#',
|
231 |
+
'tw_link' => '#',
|
232 |
+
'bh_link' => '#',
|
233 |
+
'db_link' => '#',
|
234 |
+
'ln_link' => '#',
|
235 |
+
'image_uri' => get_template_directory_uri() . "/images/team1.png"
|
236 |
+
);
|
237 |
+
|
238 |
+
update_option( 'widget_zerif_team-widget', $ourteam_content );
|
239 |
+
|
240 |
+
$zerif_lite_counter ++;
|
241 |
+
|
242 |
+
/* our team widget #2 */
|
243 |
+
|
244 |
+
$active_widgets['sidebar-ourteam'][] = 'zerif_team-widget-' . $zerif_lite_counter;
|
245 |
+
|
246 |
+
$ourteam_content[ $zerif_lite_counter ] = array( 'name' => 'TIMOTHY SPRAY',
|
247 |
+
'position' => 'Art Director',
|
248 |
+
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc dapibus, eros at accumsan auctor, felis eros condimentum quam, non porttitor est urna vel neque',
|
249 |
+
'fb_link' => '#',
|
250 |
+
'tw_link' => '#',
|
251 |
+
'bh_link' => '#',
|
252 |
+
'db_link' => '#',
|
253 |
+
'ln_link' => '#',
|
254 |
+
'image_uri' => get_template_directory_uri() . "/images/team2.png"
|
255 |
+
);
|
256 |
+
|
257 |
+
update_option( 'widget_zerif_team-widget', $ourteam_content );
|
258 |
+
|
259 |
+
$zerif_lite_counter ++;
|
260 |
+
|
261 |
+
/* our team widget #3 */
|
262 |
+
|
263 |
+
$active_widgets['sidebar-ourteam'][] = 'zerif_team-widget-' . $zerif_lite_counter;
|
264 |
+
|
265 |
+
$ourteam_content[ $zerif_lite_counter ] = array( 'name' => 'TONYA GARCIA',
|
266 |
+
'position' => 'Account Manager',
|
267 |
+
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc dapibus, eros at accumsan auctor, felis eros condimentum quam, non porttitor est urna vel neque',
|
268 |
+
'fb_link' => '#',
|
269 |
+
'tw_link' => '#',
|
270 |
+
'bh_link' => '#',
|
271 |
+
'db_link' => '#',
|
272 |
+
'ln_link' => '#',
|
273 |
+
'image_uri' => get_template_directory_uri() . "/images/team3.png"
|
274 |
+
);
|
275 |
+
|
276 |
+
update_option( 'widget_zerif_team-widget', $ourteam_content );
|
277 |
+
|
278 |
+
$zerif_lite_counter ++;
|
279 |
+
|
280 |
+
/* our team widget #4 */
|
281 |
+
|
282 |
+
$active_widgets['sidebar-ourteam'][] = 'zerif_team-widget-' . $zerif_lite_counter;
|
283 |
+
|
284 |
+
$ourteam_content[ $zerif_lite_counter ] = array( 'name' => 'JASON LANE',
|
285 |
+
'position' => 'Business Development',
|
286 |
+
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc dapibus, eros at accumsan auctor, felis eros condimentum quam, non porttitor est urna vel neque',
|
287 |
+
'fb_link' => '#',
|
288 |
+
'tw_link' => '#',
|
289 |
+
'bh_link' => '#',
|
290 |
+
'db_link' => '#',
|
291 |
+
'ln_link' => '#',
|
292 |
+
'image_uri' => get_template_directory_uri() . "/images/team4.png"
|
293 |
+
);
|
294 |
+
|
295 |
+
update_option( 'widget_zerif_team-widget', $ourteam_content );
|
296 |
+
|
297 |
+
$zerif_lite_counter ++;
|
298 |
+
|
299 |
+
update_option( 'sidebars_widgets', $active_widgets );
|
300 |
+
}
|
301 |
+
|
302 |
+
update_option( 'themeisle_companion_flag','installed' );
|
303 |
+
|
304 |
+
}
|
305 |
+
|
306 |
+
/**
|
307 |
+
* Register Zerif Widgets
|
308 |
+
*/
|
309 |
+
function themeisle_register_widgets() {
|
310 |
+
|
311 |
+
register_widget('zerif_ourfocus');
|
312 |
+
register_widget('zerif_testimonial_widget');
|
313 |
+
register_widget('zerif_clients_widget');
|
314 |
+
register_widget('zerif_team_widget');
|
315 |
+
|
316 |
+
$themeisle_companion_flag = get_option( 'themeisle_companion_flag' );
|
317 |
+
if ( empty( $themeisle_companion_flag ) && function_exists( 'themeisle_populate_with_default_widgets' ) ) {
|
318 |
+
themeisle_populate_with_default_widgets();
|
319 |
+
}
|
320 |
+
|
321 |
+
}
|
322 |
+
|
323 |
+
add_action('widgets_init', 'themeisle_register_widgets');
|
324 |
+
|
325 |
+
require_once THEMEISLE_COMPANION_PATH . 'inc/widget-focus.php';
|
326 |
+
require_once THEMEISLE_COMPANION_PATH . 'inc/widget-testimonial.php';
|
327 |
+
require_once THEMEISLE_COMPANION_PATH . 'inc/widget-clients.php';
|
328 |
+
require_once THEMEISLE_COMPANION_PATH . 'inc/widget-team.php';
|