Version Description
- Bumped "tested with" up to WP 4.0
- Added new plugin icon and updated the banner + screenshots
- Carousel controls now hidden if there is only one image - thanks to @rchq
- Option to use a different WordPress image size, suggested by oheijo
- Added option to specify HTML tags for caption and title. Suggested by smtk
- New option to use background images instead of
<img>
tags. Good for resizing. Suggested by @cla63 and @cookierebes - New Serbo-Croatian translation! Thanks to borisa from http://www.webhostinghub.com
Download this release
Release Info
Developer | tallphil |
Plugin | CPT Bootstrap Carousel |
Version | 1.8 |
Comparing to | |
See all releases |
Code changes from version 1.6 to 1.8
- cpt-bootstrap-carousel.php +394 -140
- languages/cpt-bootstrap-carousel-sr_RS.mo +0 -0
- languages/cpt-bootstrap-carousel-sr_RS.po +181 -0
- readme.txt +20 -3
cpt-bootstrap-carousel.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: CPT Bootstrap Carousel
|
4 |
Plugin URI: http://www.tallphil.co.uk/bootstrap-carousel/
|
5 |
Description: A custom post type for choosing images and content which outputs <a href="http://getbootstrap.com/javascript/#carousel" target="_blank">Bootstrap Carousel</a> from a shortcode. Requires Bootstrap javascript and CSS to be loaded separately.
|
6 |
-
Version: 1.
|
7 |
Author: Phil Ewels
|
8 |
Author URI: http://phil.ewels.co.uk
|
9 |
Text Domain: cpt-bootstrap-carousel
|
@@ -66,7 +66,7 @@ add_action( 'init', 'cptbc_taxonomies', 0 );
|
|
66 |
function cptbc_addFeaturedImageSupport() {
|
67 |
$supportedTypes = get_theme_support( 'post-thumbnails' );
|
68 |
if( $supportedTypes === false ) {
|
69 |
-
add_theme_support( 'post-thumbnails', array( 'cptbc' ) );
|
70 |
add_image_size('featured_preview', 100, 55, true);
|
71 |
} elseif( is_array( $supportedTypes ) ) {
|
72 |
$supportedTypes[0][] = 'cptbc';
|
@@ -87,31 +87,44 @@ function cptbc_get_featured_image($post_ID) {
|
|
87 |
}
|
88 |
function cptbc_columns_head($defaults) {
|
89 |
$defaults['featured_image'] = __('Featured Image', 'cpt-bootstrap-carousel');
|
|
|
90 |
return $defaults;
|
91 |
}
|
92 |
function cptbc_columns_content($column_name, $post_ID) {
|
93 |
if ($column_name == 'featured_image') {
|
94 |
$post_featured_image = cptbc_get_featured_image($post_ID);
|
95 |
if ($post_featured_image) {
|
96 |
-
echo '<a href="'.get_edit_post_link($post_ID).'"><img src="' . $post_featured_image . '" /></a>';
|
97 |
}
|
98 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
}
|
100 |
add_filter('manage_cptbc_posts_columns', 'cptbc_columns_head');
|
101 |
add_action('manage_cptbc_posts_custom_column', 'cptbc_columns_content', 10, 2);
|
102 |
|
103 |
// Extra admin field for image URL
|
104 |
function cptbc_image_url(){
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
}
|
116 |
function cptbc_admin_init_custpost(){
|
117 |
add_meta_box("cptbc_image_url", "Image Link URL", "cptbc_image_url", "cptbc", "side", "low");
|
@@ -137,11 +150,20 @@ function cptbc_set_options (){
|
|
137 |
'interval' => '5000',
|
138 |
'showcaption' => 'true',
|
139 |
'showcontrols' => 'true',
|
|
|
|
|
140 |
'orderby' => 'menu_order',
|
141 |
'order' => 'ASC',
|
142 |
'category' => '',
|
|
|
|
|
|
|
|
|
|
|
143 |
'id' => '',
|
144 |
-
'twbs' => '3'
|
|
|
|
|
145 |
);
|
146 |
add_option('cptbc_settings', $defaults);
|
147 |
}
|
@@ -158,136 +180,210 @@ function cptbc_deactivate(){
|
|
158 |
class cptbc_settings_page {
|
159 |
// Holds the values to be used in the fields callbacks
|
160 |
private $options;
|
161 |
-
|
162 |
// Start up
|
163 |
public function __construct() {
|
164 |
-
|
165 |
-
|
166 |
}
|
167 |
-
|
168 |
// Add settings page
|
169 |
public function add_plugin_page() {
|
170 |
add_submenu_page('edit.php?post_type=cptbc', __('Settings', 'cpt-bootstrap-carousel'), __('Settings', 'cpt-bootstrap-carousel'), 'manage_options', 'cpt-bootstrap-carousel', array($this,'create_admin_page'));
|
171 |
}
|
172 |
-
|
173 |
// Options page callback
|
174 |
public function create_admin_page() {
|
175 |
-
|
176 |
-
|
177 |
if(!$this->options){
|
178 |
cptbc_set_options ();
|
179 |
$this->options = get_option( 'cptbc_settings' );
|
180 |
}
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
}
|
196 |
-
|
197 |
// Register and add settings
|
198 |
-
public function page_init() {
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
add_settings_section(
|
206 |
-
'cptbc_settings_options', // ID
|
207 |
-
'', // Title - nothing to say here.
|
208 |
-
array( $this, 'cptbc_settings_options_header' ), // Callback
|
209 |
-
'cpt-bootstrap-carousel' // Page
|
210 |
-
);
|
211 |
-
|
212 |
-
add_settings_field(
|
213 |
-
'twbs', // ID
|
214 |
-
__('Twitter Bootstrap Version', 'cpt-bootstrap-carousel'), // Title
|
215 |
-
array( $this, 'twbs_callback' ), // Callback
|
216 |
-
'cpt-bootstrap-carousel', // Page
|
217 |
-
'cptbc_settings_options' // Section
|
218 |
-
);
|
219 |
-
|
220 |
-
add_settings_field(
|
221 |
-
'interval', // ID
|
222 |
-
__('Slide Interval (milliseconds)', 'cpt-bootstrap-carousel'), // Title
|
223 |
-
array( $this, 'interval_callback' ), // Callback
|
224 |
-
'cpt-bootstrap-carousel', // Page
|
225 |
-
'cptbc_settings_options' // Section
|
226 |
-
);
|
227 |
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
);
|
235 |
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
268 |
}
|
269 |
-
|
270 |
// Sanitize each setting field as needed - @param array $input Contains all settings fields as array keys
|
271 |
public function sanitize( $input ) {
|
272 |
-
|
273 |
foreach($input as $key => $var){
|
274 |
-
if($key == 'twbs' || $key == 'interval'){
|
275 |
$new_input[$key] = absint( $input[$key] );
|
276 |
if($key == 'interval' && $new_input[$key] == 0){
|
277 |
$new_input[$key] = 5000;
|
278 |
}
|
279 |
-
} else {
|
|
|
|
|
280 |
$new_input[$key] = sanitize_text_field( $input[$key] );
|
281 |
}
|
282 |
}
|
283 |
-
|
284 |
}
|
285 |
-
|
286 |
// Print the Section text
|
287 |
public function cptbc_settings_options_header() {
|
288 |
-
|
289 |
}
|
290 |
-
|
291 |
public function twbs_callback() {
|
292 |
if(isset( $this->options['twbs'] ) && $this->options['twbs'] == '3'){
|
293 |
$cptbc_twbs3 = ' selected="selected"';
|
@@ -303,8 +399,8 @@ class cptbc_settings_page {
|
|
303 |
}
|
304 |
|
305 |
public function interval_callback() {
|
306 |
-
|
307 |
-
|
308 |
}
|
309 |
|
310 |
public function showcaption_callback() {
|
@@ -325,22 +421,39 @@ class cptbc_settings_page {
|
|
325 |
if(isset( $this->options['showcontrols'] ) && $this->options['showcontrols'] == 'false'){
|
326 |
$cptbc_showcontrols_t = '';
|
327 |
$cptbc_showcontrols_f = ' selected="selected"';
|
328 |
-
|
|
|
329 |
$cptbc_showcontrols_t = ' selected="selected"';
|
330 |
$cptbc_showcontrols_f = '';
|
|
|
|
|
|
|
|
|
|
|
331 |
}
|
332 |
print '<select id="showcontrols" name="cptbc_settings[showcontrols]">
|
333 |
<option value="true"'.$cptbc_showcontrols_t.'>'.__('Show', 'cpt-bootstrap-carousel').'</option>
|
334 |
<option value="false"'.$cptbc_showcontrols_f.'>'.__('Hide', 'cpt-bootstrap-carousel').'</option>
|
|
|
335 |
</select>';
|
336 |
}
|
337 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
338 |
public function orderby_callback() {
|
339 |
$orderby_options = array (
|
340 |
'menu_order' => __('Menu order, as set in Carousel overview page', 'cpt-bootstrap-carousel'),
|
341 |
'date' => __('Date slide was published', 'cpt-bootstrap-carousel'),
|
342 |
'rand' => __('Random ordering', 'cpt-bootstrap-carousel'),
|
343 |
-
'title' => __('Slide title', 'cpt-bootstrap-carousel')
|
344 |
);
|
345 |
print '<select id="orderby" name="cptbc_settings[orderby]">';
|
346 |
foreach($orderby_options as $val => $option){
|
@@ -372,20 +485,79 @@ class cptbc_settings_page {
|
|
372 |
print '<select id="orderby" name="cptbc_settings[category]">
|
373 |
<option value="">'.__('All Categories', 'cpt-bootstrap-carousel').'</option>';
|
374 |
foreach($cats as $cat){
|
375 |
-
print '<option value="'.$cat->
|
376 |
-
if(isset( $this->options['category'] ) && $this->options['category'] == $cat->
|
377 |
print ' selected="selected"';
|
378 |
}
|
379 |
print ">".$cat->name."</option>";
|
380 |
}
|
381 |
print '</select>';
|
382 |
}
|
383 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
384 |
|
385 |
}
|
386 |
|
387 |
if( is_admin() ){
|
388 |
-
|
389 |
}
|
390 |
|
391 |
// Add settings link on plugin page
|
@@ -399,6 +571,70 @@ add_filter("plugin_action_links_$cptbc_plugin", 'cptbc_settings_link' );
|
|
399 |
|
400 |
|
401 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
402 |
|
403 |
|
404 |
|
@@ -408,7 +644,7 @@ add_filter("plugin_action_links_$cptbc_plugin", 'cptbc_settings_link' );
|
|
408 |
|
409 |
// Shortcode
|
410 |
function cptbc_shortcode($atts, $content = null) {
|
411 |
-
|
412 |
$options = get_option( 'cptbc_settings' );
|
413 |
if(!$options){
|
414 |
cptbc_set_options ();
|
@@ -426,36 +662,49 @@ add_shortcode('image-carousel', 'cptbc_shortcode');
|
|
426 |
// Display carousel
|
427 |
function cptbc_frontend($atts){
|
428 |
$id = rand(0, 999); // use a random ID so that the CSS IDs work with multiple on one page
|
429 |
-
$args = array(
|
|
|
|
|
|
|
|
|
|
|
430 |
if($atts['category'] != ''){
|
431 |
$args['carousel_category'] = $atts['category'];
|
432 |
}
|
|
|
|
|
|
|
|
|
433 |
if($atts['id'] != ''){
|
434 |
$args['p'] = $atts['id'];
|
435 |
}
|
|
|
436 |
$loop = new WP_Query( $args );
|
437 |
$images = array();
|
438 |
while ( $loop->have_posts() ) {
|
439 |
$loop->the_post();
|
440 |
-
if ( '' != get_the_post_thumbnail() ) {
|
441 |
$post_id = get_the_ID();
|
442 |
$title = get_the_title();
|
443 |
$content = get_the_excerpt();
|
444 |
-
$image = get_the_post_thumbnail( get_the_ID(), '
|
|
|
445 |
$url = get_post_meta(get_the_ID(), 'cptbc_image_url');
|
446 |
$url_openblank = get_post_meta(get_the_ID(), 'cptbc_image_url_openblank');
|
447 |
-
$images[] = array('post_id' => $post_id, 'title' => $title, 'content' => $content, 'image' => $image, 'url' => esc_url($url[0]), 'url_openblank' => $url_openblank[0] == "1" ? true : false);
|
448 |
}
|
449 |
}
|
450 |
if(count($images) > 0){
|
451 |
ob_start();
|
452 |
?>
|
453 |
-
<div id="cptbc_<?php echo $id; ?>" class="carousel slide">
|
454 |
-
|
455 |
-
|
456 |
-
|
|
|
|
|
|
|
457 |
<?php } ?>
|
458 |
-
</ol>
|
459 |
<div class="carousel-inner">
|
460 |
<?php foreach ($images as $key => $image) {
|
461 |
$linkstart = '';
|
@@ -469,23 +718,28 @@ function cptbc_frontend($atts){
|
|
469 |
$linkend = '</a>';
|
470 |
}
|
471 |
?>
|
472 |
-
<div class="item <?php echo $key == 0 ? 'active' : ''; ?>" id="<?php echo $image['post_id']; ?>"
|
473 |
-
<?php echo $linkstart.$image['image'].$linkend; ?>
|
474 |
<?php if($atts['showcaption'] === 'true' && strlen($image['title']) > 0 && strlen($image['content']) > 0) { ?>
|
475 |
<div class="carousel-caption">
|
476 |
-
|
477 |
-
|
478 |
</div>
|
479 |
<?php } ?>
|
480 |
</div>
|
481 |
<?php } ?>
|
482 |
</div>
|
483 |
-
<?php if(
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
|
|
|
|
|
|
|
|
|
|
489 |
<?php } ?>
|
490 |
</div>
|
491 |
<script type="text/javascript">
|
@@ -500,9 +754,9 @@ function cptbc_frontend($atts){
|
|
500 |
ob_end_clean();
|
501 |
|
502 |
// Restore original Post Data
|
503 |
-
wp_reset_postdata();
|
504 |
|
505 |
return $output;
|
506 |
}
|
507 |
|
508 |
-
?>
|
3 |
Plugin Name: CPT Bootstrap Carousel
|
4 |
Plugin URI: http://www.tallphil.co.uk/bootstrap-carousel/
|
5 |
Description: A custom post type for choosing images and content which outputs <a href="http://getbootstrap.com/javascript/#carousel" target="_blank">Bootstrap Carousel</a> from a shortcode. Requires Bootstrap javascript and CSS to be loaded separately.
|
6 |
+
Version: 1.8
|
7 |
Author: Phil Ewels
|
8 |
Author URI: http://phil.ewels.co.uk
|
9 |
Text Domain: cpt-bootstrap-carousel
|
66 |
function cptbc_addFeaturedImageSupport() {
|
67 |
$supportedTypes = get_theme_support( 'post-thumbnails' );
|
68 |
if( $supportedTypes === false ) {
|
69 |
+
add_theme_support( 'post-thumbnails', array( 'cptbc' ) );
|
70 |
add_image_size('featured_preview', 100, 55, true);
|
71 |
} elseif( is_array( $supportedTypes ) ) {
|
72 |
$supportedTypes[0][] = 'cptbc';
|
87 |
}
|
88 |
function cptbc_columns_head($defaults) {
|
89 |
$defaults['featured_image'] = __('Featured Image', 'cpt-bootstrap-carousel');
|
90 |
+
$defaults['category'] = __('Category', 'cpt-bootstrap-carousel');
|
91 |
return $defaults;
|
92 |
}
|
93 |
function cptbc_columns_content($column_name, $post_ID) {
|
94 |
if ($column_name == 'featured_image') {
|
95 |
$post_featured_image = cptbc_get_featured_image($post_ID);
|
96 |
if ($post_featured_image) {
|
97 |
+
echo '<a href="'.get_edit_post_link($post_ID).'"><img src="' . $post_featured_image . '" alt="" style="max-width:100%;" /></a>';
|
98 |
}
|
99 |
+
}
|
100 |
+
if ($column_name == 'category') {
|
101 |
+
$post_categories = get_the_terms($post_ID, 'carousel_category');
|
102 |
+
if ($post_categories) {
|
103 |
+
$output = '';
|
104 |
+
foreach($post_categories as $cat){
|
105 |
+
$output .= $cat->name.', ';
|
106 |
+
}
|
107 |
+
echo trim($output, ', ');
|
108 |
+
} else {
|
109 |
+
echo 'No categories';
|
110 |
+
}
|
111 |
+
}
|
112 |
}
|
113 |
add_filter('manage_cptbc_posts_columns', 'cptbc_columns_head');
|
114 |
add_action('manage_cptbc_posts_custom_column', 'cptbc_columns_content', 10, 2);
|
115 |
|
116 |
// Extra admin field for image URL
|
117 |
function cptbc_image_url(){
|
118 |
+
global $post;
|
119 |
+
$custom = get_post_custom($post->ID);
|
120 |
+
$cptbc_image_url = isset($custom['cptbc_image_url']) ? $custom['cptbc_image_url'][0] : '';
|
121 |
+
$cptbc_image_url_openblank = isset($custom['cptbc_image_url_openblank']) ? $custom['cptbc_image_url_openblank'][0] : '0';
|
122 |
+
?>
|
123 |
+
<label><?php _e('Image URL', 'cpt-bootstrap-carousel'); ?>:</label>
|
124 |
+
<input name="cptbc_image_url" value="<?php echo $cptbc_image_url; ?>" /> <br />
|
125 |
+
<small><em><?php _e('(optional - leave blank for no link)', 'cpt-bootstrap-carousel'); ?></em></small><br /><br />
|
126 |
+
<label><input type="checkbox" name="cptbc_image_url_openblank" <?php if($cptbc_image_url_openblank == 1){ echo ' checked="checked"'; } ?> value="1" /> <?php _e('Open link in new window?', 'cpt-bootstrap-carousel'); ?></label>
|
127 |
+
<?php
|
128 |
}
|
129 |
function cptbc_admin_init_custpost(){
|
130 |
add_meta_box("cptbc_image_url", "Image Link URL", "cptbc_image_url", "cptbc", "side", "low");
|
150 |
'interval' => '5000',
|
151 |
'showcaption' => 'true',
|
152 |
'showcontrols' => 'true',
|
153 |
+
'customprev' => '',
|
154 |
+
'customnext' => '',
|
155 |
'orderby' => 'menu_order',
|
156 |
'order' => 'ASC',
|
157 |
'category' => '',
|
158 |
+
'before_title' => '<h4>',
|
159 |
+
'after_title' => '</h4>',
|
160 |
+
'before_caption' => '<p>',
|
161 |
+
'after_caption' => '</p>',
|
162 |
+
'image_size' => 'full',
|
163 |
'id' => '',
|
164 |
+
'twbs' => '3',
|
165 |
+
'use_background_images' => '0',
|
166 |
+
'background_images_height' => '500'
|
167 |
);
|
168 |
add_option('cptbc_settings', $defaults);
|
169 |
}
|
180 |
class cptbc_settings_page {
|
181 |
// Holds the values to be used in the fields callbacks
|
182 |
private $options;
|
183 |
+
|
184 |
// Start up
|
185 |
public function __construct() {
|
186 |
+
add_action( 'admin_menu', array( $this, 'add_plugin_page' ) );
|
187 |
+
add_action( 'admin_init', array( $this, 'page_init' ) );
|
188 |
}
|
189 |
+
|
190 |
// Add settings page
|
191 |
public function add_plugin_page() {
|
192 |
add_submenu_page('edit.php?post_type=cptbc', __('Settings', 'cpt-bootstrap-carousel'), __('Settings', 'cpt-bootstrap-carousel'), 'manage_options', 'cpt-bootstrap-carousel', array($this,'create_admin_page'));
|
193 |
}
|
194 |
+
|
195 |
// Options page callback
|
196 |
public function create_admin_page() {
|
197 |
+
// Set class property
|
198 |
+
$this->options = get_option( 'cptbc_settings' );
|
199 |
if(!$this->options){
|
200 |
cptbc_set_options ();
|
201 |
$this->options = get_option( 'cptbc_settings' );
|
202 |
}
|
203 |
+
?>
|
204 |
+
<div class="wrap">
|
205 |
+
<h2>CPT Bootstrap Carousel <?php _e('Settings', 'cpt-bootstrap-carousel'); ?></h2>
|
206 |
+
<p><?php printf(__('You can set the default behaviour of your carousels here. All of these settings can be overridden by using %s shortcode attributes %s.', 'cpt-bootstrap-carousel'),'<a href="http://wordpress.org/plugins/cpt-bootstrap-carousel/" target="_blank">', '</a>'); ?></p>
|
207 |
+
|
208 |
+
<form method="post" action="options.php">
|
209 |
+
<?php
|
210 |
+
settings_fields( 'cptbc_settings' );
|
211 |
+
do_settings_sections( 'cpt-bootstrap-carousel' );
|
212 |
+
submit_button();
|
213 |
+
?>
|
214 |
+
</form>
|
215 |
+
</div>
|
216 |
+
<?php
|
217 |
}
|
218 |
+
|
219 |
// Register and add settings
|
220 |
+
public function page_init() {
|
221 |
+
register_setting(
|
222 |
+
'cptbc_settings', // Option group
|
223 |
+
'cptbc_settings', // Option name
|
224 |
+
array( $this, 'sanitize' ) // Sanitize
|
225 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
|
227 |
+
add_settings_section(
|
228 |
+
'cptbc_settings_options', // ID
|
229 |
+
'', // Title - nothing to say here.
|
230 |
+
array( $this, 'cptbc_settings_options_header' ), // Callback
|
231 |
+
'cpt-bootstrap-carousel' // Page
|
232 |
+
);
|
|
|
233 |
|
234 |
+
add_settings_field(
|
235 |
+
'twbs', // ID
|
236 |
+
__('Twitter Bootstrap Version', 'cpt-bootstrap-carousel'), // Title
|
237 |
+
array( $this, 'twbs_callback' ), // Callback
|
238 |
+
'cpt-bootstrap-carousel', // Page
|
239 |
+
'cptbc_settings_options' // Section
|
240 |
+
);
|
241 |
|
242 |
+
add_settings_field(
|
243 |
+
'interval', // ID
|
244 |
+
__('Slide Interval (milliseconds)', 'cpt-bootstrap-carousel'), // Title
|
245 |
+
array( $this, 'interval_callback' ), // Callback
|
246 |
+
'cpt-bootstrap-carousel', // Page
|
247 |
+
'cptbc_settings_options' // Section
|
248 |
+
);
|
249 |
+
|
250 |
+
add_settings_field(
|
251 |
+
'showcaption', // ID
|
252 |
+
__('Show Slide Captions?', 'cpt-bootstrap-carousel'), // Title
|
253 |
+
array( $this, 'showcaption_callback' ), // Callback
|
254 |
+
'cpt-bootstrap-carousel', // Page
|
255 |
+
'cptbc_settings_options' // Section
|
256 |
+
);
|
257 |
+
|
258 |
+
add_settings_field(
|
259 |
+
'showcontrols', // ID
|
260 |
+
__('Show Slide Controls?', 'cpt-bootstrap-carousel'), // Title
|
261 |
+
array( $this, 'showcontrols_callback' ), // Callback
|
262 |
+
'cpt-bootstrap-carousel', // Page
|
263 |
+
'cptbc_settings_options' // Section
|
264 |
+
);
|
265 |
|
266 |
+
add_settings_field(
|
267 |
+
'customprev', // ID
|
268 |
+
__('Custom prev button class', 'cpt-bootstrap-carousel'), // Title
|
269 |
+
array( $this, 'customprev_callback' ), // Callback
|
270 |
+
'cpt-bootstrap-carousel', // Page
|
271 |
+
'cptbc_settings_options' // Section
|
272 |
+
);
|
273 |
|
274 |
+
add_settings_field(
|
275 |
+
'customnext', // ID
|
276 |
+
__('Custom next button class', 'cpt-bootstrap-carousel'), // Title
|
277 |
+
array( $this, 'customnext_callback' ), // Callback
|
278 |
+
'cpt-bootstrap-carousel', // Page
|
279 |
+
'cptbc_settings_options' // Section
|
280 |
+
);
|
281 |
+
|
282 |
+
add_settings_field(
|
283 |
+
'orderby', // ID
|
284 |
+
__('Order Slides By', 'cpt-bootstrap-carousel'), // Title
|
285 |
+
array( $this, 'orderby_callback' ), // Callback
|
286 |
+
'cpt-bootstrap-carousel', // Page
|
287 |
+
'cptbc_settings_options' // Section
|
288 |
+
);
|
289 |
+
|
290 |
+
add_settings_field(
|
291 |
+
'order', // ID
|
292 |
+
__('Ordering Direction', 'cpt-bootstrap-carousel'), // Title
|
293 |
+
array( $this, 'order_callback' ), // Callback
|
294 |
+
'cpt-bootstrap-carousel', // Page
|
295 |
+
'cptbc_settings_options' // Section
|
296 |
+
);
|
297 |
+
|
298 |
+
add_settings_field(
|
299 |
+
'category', // ID
|
300 |
+
__('Restrict to Category', 'cpt-bootstrap-carousel'), // Title
|
301 |
+
array( $this, 'category_callback' ), // Callback
|
302 |
+
'cpt-bootstrap-carousel', // Page
|
303 |
+
'cptbc_settings_options' // Section
|
304 |
+
);
|
305 |
+
|
306 |
+
add_settings_field(
|
307 |
+
'before_title', // ID
|
308 |
+
__('HTML before title', 'cpt-bootstrap-carousel'), // Title
|
309 |
+
array( $this, 'before_title_callback' ), // Callback
|
310 |
+
'cpt-bootstrap-carousel', // Page
|
311 |
+
'cptbc_settings_options' // Section
|
312 |
+
);
|
313 |
+
|
314 |
+
add_settings_field(
|
315 |
+
'after_title', // ID
|
316 |
+
__('HTML after title', 'cpt-bootstrap-carousel'), // Title
|
317 |
+
array( $this, 'after_title_callback' ), // Callback
|
318 |
+
'cpt-bootstrap-carousel', // Page
|
319 |
+
'cptbc_settings_options' // Section
|
320 |
+
);
|
321 |
+
|
322 |
+
add_settings_field(
|
323 |
+
'before_caption', // ID
|
324 |
+
__('HTML before caption text', 'cpt-bootstrap-carousel'), // Title
|
325 |
+
array( $this, 'before_caption_callback' ), // Callback
|
326 |
+
'cpt-bootstrap-carousel', // Page
|
327 |
+
'cptbc_settings_options' // Section
|
328 |
+
);
|
329 |
+
|
330 |
+
add_settings_field(
|
331 |
+
'after_caption', // ID
|
332 |
+
__('HTML after caption text', 'cpt-bootstrap-carousel'), // Title
|
333 |
+
array( $this, 'after_caption_callback' ), // Callback
|
334 |
+
'cpt-bootstrap-carousel', // Page
|
335 |
+
'cptbc_settings_options' // Section
|
336 |
+
);
|
337 |
+
|
338 |
+
add_settings_field(
|
339 |
+
'image_size', // ID
|
340 |
+
__('Image Size', 'cpt-bootstrap-carousel'), // Title
|
341 |
+
array( $this, 'image_size_callback' ), // Callback
|
342 |
+
'cpt-bootstrap-carousel', // Page
|
343 |
+
'cptbc_settings_options' // Section
|
344 |
+
);
|
345 |
+
|
346 |
+
add_settings_field(
|
347 |
+
'use_background_images', // ID
|
348 |
+
__('Use background images?', 'cpt-bootstrap-carousel'), // Title
|
349 |
+
array( $this, 'use_background_images_callback' ), // Callback
|
350 |
+
'cpt-bootstrap-carousel', // Page
|
351 |
+
'cptbc_settings_options' // Section
|
352 |
+
);
|
353 |
+
|
354 |
+
add_settings_field(
|
355 |
+
'background_images_height', // ID
|
356 |
+
__('Height if using bkgrnd images (px)', 'cpt-bootstrap-carousel'), // Title
|
357 |
+
array( $this, 'background_images_height_callback' ), // Callback
|
358 |
+
'cpt-bootstrap-carousel', // Page
|
359 |
+
'cptbc_settings_options' // Section
|
360 |
+
);
|
361 |
+
|
362 |
}
|
363 |
+
|
364 |
// Sanitize each setting field as needed - @param array $input Contains all settings fields as array keys
|
365 |
public function sanitize( $input ) {
|
366 |
+
$new_input = array();
|
367 |
foreach($input as $key => $var){
|
368 |
+
if($key == 'twbs' || $key == 'interval' || $key == 'background_images_height'){
|
369 |
$new_input[$key] = absint( $input[$key] );
|
370 |
if($key == 'interval' && $new_input[$key] == 0){
|
371 |
$new_input[$key] = 5000;
|
372 |
}
|
373 |
+
} else if ($key == 'before_title' || $key == 'after_title' || $key == 'before_caption' || $key == 'after_caption'){
|
374 |
+
$new_input[$key] = $input[$key]; // Don't sanitise these, meant to be html!
|
375 |
+
} else {
|
376 |
$new_input[$key] = sanitize_text_field( $input[$key] );
|
377 |
}
|
378 |
}
|
379 |
+
return $new_input;
|
380 |
}
|
381 |
+
|
382 |
// Print the Section text
|
383 |
public function cptbc_settings_options_header() {
|
384 |
+
// nothing to say here.
|
385 |
}
|
386 |
+
|
387 |
public function twbs_callback() {
|
388 |
if(isset( $this->options['twbs'] ) && $this->options['twbs'] == '3'){
|
389 |
$cptbc_twbs3 = ' selected="selected"';
|
399 |
}
|
400 |
|
401 |
public function interval_callback() {
|
402 |
+
printf('<input type="text" id="interval" name="cptbc_settings[interval]" value="%s" size="6" />',
|
403 |
+
isset( $this->options['interval'] ) ? esc_attr( $this->options['interval']) : '');
|
404 |
}
|
405 |
|
406 |
public function showcaption_callback() {
|
421 |
if(isset( $this->options['showcontrols'] ) && $this->options['showcontrols'] == 'false'){
|
422 |
$cptbc_showcontrols_t = '';
|
423 |
$cptbc_showcontrols_f = ' selected="selected"';
|
424 |
+
$cptbc_showcontrols_c = '';
|
425 |
+
} else if(isset( $this->options['showcontrols'] ) && $this->options['showcontrols'] == 'true'){
|
426 |
$cptbc_showcontrols_t = ' selected="selected"';
|
427 |
$cptbc_showcontrols_f = '';
|
428 |
+
$cptbc_showcontrols_c = '';
|
429 |
+
} else if(isset( $this->options['showcontrols'] ) && $this->options['showcontrols'] == 'custom'){
|
430 |
+
$cptbc_showcontrols_t = '';
|
431 |
+
$cptbc_showcontrols_f = '';
|
432 |
+
$cptbc_showcontrols_c = ' selected="selected"';
|
433 |
}
|
434 |
print '<select id="showcontrols" name="cptbc_settings[showcontrols]">
|
435 |
<option value="true"'.$cptbc_showcontrols_t.'>'.__('Show', 'cpt-bootstrap-carousel').'</option>
|
436 |
<option value="false"'.$cptbc_showcontrols_f.'>'.__('Hide', 'cpt-bootstrap-carousel').'</option>
|
437 |
+
<option value="custom"'.$cptbc_showcontrols_c.'>'.__('Custom', 'cpt-bootstrap-carousel').'</option>
|
438 |
</select>';
|
439 |
}
|
440 |
|
441 |
+
public function customnext_callback() {
|
442 |
+
printf('<input type="text" id="customnext" name="cptbc_settings[customnext]" value="%s" size="6" />',
|
443 |
+
isset( $this->options['customnext'] ) ? esc_attr( $this->options['customnext']) : '');
|
444 |
+
}
|
445 |
+
|
446 |
+
public function customprev_callback() {
|
447 |
+
printf('<input type="text" id="customprev" name="cptbc_settings[customprev]" value="%s" size="6" />',
|
448 |
+
isset( $this->options['customprev'] ) ? esc_attr( $this->options['customprev']) : '');
|
449 |
+
}
|
450 |
+
|
451 |
public function orderby_callback() {
|
452 |
$orderby_options = array (
|
453 |
'menu_order' => __('Menu order, as set in Carousel overview page', 'cpt-bootstrap-carousel'),
|
454 |
'date' => __('Date slide was published', 'cpt-bootstrap-carousel'),
|
455 |
'rand' => __('Random ordering', 'cpt-bootstrap-carousel'),
|
456 |
+
'title' => __('Slide title', 'cpt-bootstrap-carousel')
|
457 |
);
|
458 |
print '<select id="orderby" name="cptbc_settings[orderby]">';
|
459 |
foreach($orderby_options as $val => $option){
|
485 |
print '<select id="orderby" name="cptbc_settings[category]">
|
486 |
<option value="">'.__('All Categories', 'cpt-bootstrap-carousel').'</option>';
|
487 |
foreach($cats as $cat){
|
488 |
+
print '<option value="'.$cat->name.'"';
|
489 |
+
if(isset( $this->options['category'] ) && $this->options['category'] == $cat->name){
|
490 |
print ' selected="selected"';
|
491 |
}
|
492 |
print ">".$cat->name."</option>";
|
493 |
}
|
494 |
print '</select>';
|
495 |
}
|
496 |
+
|
497 |
+
public function before_title_callback() {
|
498 |
+
printf('<input type="text" id="before_title" name="cptbc_settings[before_title]" value="%s" size="6" />',
|
499 |
+
isset( $this->options['before_title'] ) ? esc_attr( $this->options['before_title']) : '<h4>');
|
500 |
+
}
|
501 |
+
|
502 |
+
public function after_title_callback() {
|
503 |
+
printf('<input type="text" id="after_title" name="cptbc_settings[after_title]" value="%s" size="6" />',
|
504 |
+
isset( $this->options['after_title'] ) ? esc_attr( $this->options['after_title']) : '</h4>');
|
505 |
+
}
|
506 |
+
|
507 |
+
public function before_caption_callback() {
|
508 |
+
printf('<input type="text" id="before_caption" name="cptbc_settings[before_caption]" value="%s" size="6" />',
|
509 |
+
isset( $this->options['before_caption'] ) ? esc_attr( $this->options['before_caption']) : '<p>');
|
510 |
+
}
|
511 |
+
|
512 |
+
public function after_caption_callback() {
|
513 |
+
printf('<input type="text" id="after_caption" name="cptbc_settings[after_caption]" value="%s" size="6" />',
|
514 |
+
isset( $this->options['after_caption'] ) ? esc_attr( $this->options['after_caption']) : '</p>');
|
515 |
+
}
|
516 |
+
|
517 |
+
public function image_size_callback() {
|
518 |
+
$image_sizes = get_intermediate_image_sizes();
|
519 |
+
print '<select id="image_size" name="cptbc_settings[image_size]">
|
520 |
+
<option value="full"';
|
521 |
+
if(isset( $this->options['image_size'] ) && $this->options['image_size'] == $size){
|
522 |
+
print ' selected="selected"';
|
523 |
+
}
|
524 |
+
echo '>Full (default)</option>';
|
525 |
+
foreach($image_sizes as $size){
|
526 |
+
print '<option value="'.$size.'"';
|
527 |
+
if(isset( $this->options['image_size'] ) && $this->options['image_size'] == $size){
|
528 |
+
print ' selected="selected"';
|
529 |
+
}
|
530 |
+
print ">".ucfirst($size)."</option>";
|
531 |
+
}
|
532 |
+
print '</select>';
|
533 |
+
}
|
534 |
+
|
535 |
+
public function use_background_images_callback() {
|
536 |
+
print '<select id="use_background_images" name="cptbc_settings[use_background_images]">';
|
537 |
+
print '<option value="0"';
|
538 |
+
if(isset( $this->options['use_background_images'] ) && $this->options['use_background_images'] == 0){
|
539 |
+
print ' selected="selected"';
|
540 |
+
}
|
541 |
+
echo '>No (default)</option>';
|
542 |
+
print '<option value="1"';
|
543 |
+
if(isset( $this->options['use_background_images'] ) && $this->options['use_background_images'] == 1){
|
544 |
+
print ' selected="selected"';
|
545 |
+
}
|
546 |
+
echo '>Yes</option>';
|
547 |
+
print '</select>';
|
548 |
+
}
|
549 |
+
|
550 |
+
public function background_images_height_callback() {
|
551 |
+
printf('<input type="text" id="background_images_height" name="cptbc_settings[background_images_height]" value="%s" size="6" />',
|
552 |
+
isset( $this->options['background_images_height'] ) ? esc_attr( $this->options['background_images_height']) : '500px');
|
553 |
+
}
|
554 |
+
|
555 |
+
|
556 |
|
557 |
}
|
558 |
|
559 |
if( is_admin() ){
|
560 |
+
$cptbc_settings_page = new cptbc_settings_page();
|
561 |
}
|
562 |
|
563 |
// Add settings link on plugin page
|
571 |
|
572 |
|
573 |
|
574 |
+
///////////////////
|
575 |
+
// CONTEXTUAL HELP
|
576 |
+
///////////////////
|
577 |
+
function cptbc_contextual_help_tab() {
|
578 |
+
$help = '<p>You can add a <strong>CPT Bootstrap Carousel</strong> image carousel using the shortcode <code>[image-carousel]</code>.</p>
|
579 |
+
<p>You can read the full plugin documentation on the <a href="http://wordpress.org/plugins/cpt-bootstrap-carousel/" target="_blank">WordPress plugins page</a></p>
|
580 |
+
<p>Most settings can be changed in the <a href="">settings page</a> but you can also specify options for individual carousels
|
581 |
+
using the following settings:</p>
|
582 |
+
|
583 |
+
<ul>
|
584 |
+
<li><code>interval</code> <em>(default 5000)</em>
|
585 |
+
<ul>
|
586 |
+
<li>Length of time for the caption to pause on each image. Time in milliseconds.</li>
|
587 |
+
</ul></li>
|
588 |
+
|
589 |
+
<li><code>showcaption</code> <em>(default true)</em>
|
590 |
+
<ul>
|
591 |
+
<li>Whether to display the text caption on each image or not. true or false.</li>
|
592 |
+
</ul></li>
|
593 |
+
|
594 |
+
<li><code>showcontrols</code> <em>(default true)</em>
|
595 |
+
<ul>
|
596 |
+
<li>Whether to display the control arrows or not. true or false.</li>
|
597 |
+
</ul></li>
|
598 |
+
|
599 |
+
<li><code>orderby</code> and <code>order</code> <em>(default menu_order ASC)</em>
|
600 |
+
<ul>
|
601 |
+
<li>What order to display the posts in. Uses WP_Query terms.</li>
|
602 |
+
</ul></li>
|
603 |
+
|
604 |
+
<li><code>category</code> <em>(default all)</em>
|
605 |
+
<ul>
|
606 |
+
<li>Filter carousel items by a comma separated list of carousel category slugs.</li>
|
607 |
+
</ul></li>
|
608 |
+
|
609 |
+
<li><code>image_size</code> <em>(default full)</em>
|
610 |
+
<ul>
|
611 |
+
<li>WordPress image size to use, useful for small carousels</li>
|
612 |
+
</ul></li>
|
613 |
+
|
614 |
+
<li><code>id</code> <em>(default all)</em>
|
615 |
+
<ul>
|
616 |
+
<li>Specify the ID of a specific carousel post to display only one image.</li>';
|
617 |
+
if(isset($_GET['post'])){
|
618 |
+
$help .= '<li>The ID of the post you\'re currently editing is <strong>'.$_GET['post'].'</strong></li>';
|
619 |
+
}
|
620 |
+
$help .= '
|
621 |
+
</ul></li>
|
622 |
+
|
623 |
+
<li><code>twbs</code> <em>(default 2)</em>
|
624 |
+
<ul>
|
625 |
+
<li>Output markup for Twitter Bootstrap Version 2 or 3.</li>
|
626 |
+
</ul></li>
|
627 |
+
</ul>
|
628 |
+
';
|
629 |
+
$screen = get_current_screen();
|
630 |
+
$screen->add_help_tab( array(
|
631 |
+
'id' => 'cptbc_contextual_help',
|
632 |
+
'title' => __('Carousel'),
|
633 |
+
'content' => __($help)
|
634 |
+
) );
|
635 |
+
}
|
636 |
+
add_action('load-post.php', 'cptbc_contextual_help_tab');
|
637 |
+
add_action('load-post-new.php', 'cptbc_contextual_help_tab');
|
638 |
|
639 |
|
640 |
|
644 |
|
645 |
// Shortcode
|
646 |
function cptbc_shortcode($atts, $content = null) {
|
647 |
+
// Set default shortcode attributes
|
648 |
$options = get_option( 'cptbc_settings' );
|
649 |
if(!$options){
|
650 |
cptbc_set_options ();
|
662 |
// Display carousel
|
663 |
function cptbc_frontend($atts){
|
664 |
$id = rand(0, 999); // use a random ID so that the CSS IDs work with multiple on one page
|
665 |
+
$args = array(
|
666 |
+
'post_type' => 'cptbc',
|
667 |
+
'posts_per_page' => '-1',
|
668 |
+
'orderby' => $atts['orderby'],
|
669 |
+
'order' => $atts['order']
|
670 |
+
);
|
671 |
if($atts['category'] != ''){
|
672 |
$args['carousel_category'] = $atts['category'];
|
673 |
}
|
674 |
+
if(!isset($atts['before_title'])) $atts['before_title'] = '<h4>';
|
675 |
+
if(!isset($atts['after_title'])) $atts['after_title'] = '</h4>';
|
676 |
+
if(!isset($atts['before_caption'])) $atts['before_caption'] = '<p>';
|
677 |
+
if(!isset($atts['after_caption'])) $atts['after_caption'] = '</p>';
|
678 |
if($atts['id'] != ''){
|
679 |
$args['p'] = $atts['id'];
|
680 |
}
|
681 |
+
|
682 |
$loop = new WP_Query( $args );
|
683 |
$images = array();
|
684 |
while ( $loop->have_posts() ) {
|
685 |
$loop->the_post();
|
686 |
+
if ( '' != get_the_post_thumbnail(get_the_ID(), $atts['image_size']) ) {
|
687 |
$post_id = get_the_ID();
|
688 |
$title = get_the_title();
|
689 |
$content = get_the_excerpt();
|
690 |
+
$image = get_the_post_thumbnail( get_the_ID(), $atts['image_size'] );
|
691 |
+
$image_src = wp_get_attachment_image_src(get_post_thumbnail_id(), $atts['image_size'])[0];
|
692 |
$url = get_post_meta(get_the_ID(), 'cptbc_image_url');
|
693 |
$url_openblank = get_post_meta(get_the_ID(), 'cptbc_image_url_openblank');
|
694 |
+
$images[] = array('post_id' => $post_id, 'title' => $title, 'content' => $content, 'image' => $image, 'img_src' => $image_src, 'url' => esc_url($url[0]), 'url_openblank' => $url_openblank[0] == "1" ? true : false);
|
695 |
}
|
696 |
}
|
697 |
if(count($images) > 0){
|
698 |
ob_start();
|
699 |
?>
|
700 |
+
<div id="cptbc_<?php echo $id; ?>" class="carousel slide" data-ride="carousel" data-interval="<?php echo $atts['interval']; ?>">
|
701 |
+
<?php if( count( $images ) > 1 ){ ?>
|
702 |
+
<ol class="carousel-indicators">
|
703 |
+
<?php foreach ($images as $key => $image) { ?>
|
704 |
+
<li data-target="#cptbc_<?php echo $id; ?>" data-slide-to="<?php echo $key; ?>" <?php echo $key == 0 ? 'class="active"' : ''; ?>></li>
|
705 |
+
<?php } ?>
|
706 |
+
</ol>
|
707 |
<?php } ?>
|
|
|
708 |
<div class="carousel-inner">
|
709 |
<?php foreach ($images as $key => $image) {
|
710 |
$linkstart = '';
|
718 |
$linkend = '</a>';
|
719 |
}
|
720 |
?>
|
721 |
+
<div class="item <?php echo $key == 0 ? 'active' : ''; ?>" id="<?php echo $image['post_id']; ?>" <?php if($atts['use_background_images'] == 1){ echo ' style="height: '.$atts['background_images_height'].'px; background: url(\''.$image['img_src'].'\') no-repeat center center ; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover;"'; } ?>>
|
722 |
+
<?php if($atts['use_background_images'] == 0){ echo $linkstart.$image['image'].$linkend; } ?>
|
723 |
<?php if($atts['showcaption'] === 'true' && strlen($image['title']) > 0 && strlen($image['content']) > 0) { ?>
|
724 |
<div class="carousel-caption">
|
725 |
+
<?php echo $atts['before_title'].$linkstart.$image['title'].$linkend.$atts['after_title']; ?>
|
726 |
+
<?php echo $atts['before_caption'].$linkstart.$image['content'].$linkend.$atts['after_caption']; ?>
|
727 |
</div>
|
728 |
<?php } ?>
|
729 |
</div>
|
730 |
<?php } ?>
|
731 |
</div>
|
732 |
+
<?php if( count( $images ) > 1 ){ ?>
|
733 |
+
<?php if($atts['showcontrols'] === 'true' && $atts['twbs'] == '3') { ?>
|
734 |
+
<a class="left carousel-control" href="#cptbc_<?php echo $id; ?>" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span></a>
|
735 |
+
<a class="right carousel-control" href="#cptbc_<?php echo $id; ?>" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span></a>
|
736 |
+
<?php } else if($atts['showcontrols'] === 'true'){ ?>
|
737 |
+
<a class="left carousel-control" href="#cptbc_<?php echo $id; ?>" data-slide="prev">‹</a>
|
738 |
+
<a class="right carousel-control" href="#cptbc_<?php echo $id; ?>" data-slide="next">›</a>
|
739 |
+
<?php } else if($atts['showcontrols'] === 'custom' && $atts['twbs'] == '3' && $atts['customprev'] != '' && $atts['customnext'] != ''){ ?>
|
740 |
+
<a class="left carousel-control" href="#cptbc_<?php echo $id; ?>" data-slide="prev"><span class="<?php echo $atts['customprev'] ?> icon-prev"></span></a>
|
741 |
+
<a class="right carousel-control" href="#cptbc_<?php echo $id; ?>" data-slide="next"><span class="<?php echo $atts['customnext'] ?> icon-next"></span></a>
|
742 |
+
<?php } ?>
|
743 |
<?php } ?>
|
744 |
</div>
|
745 |
<script type="text/javascript">
|
754 |
ob_end_clean();
|
755 |
|
756 |
// Restore original Post Data
|
757 |
+
wp_reset_postdata();
|
758 |
|
759 |
return $output;
|
760 |
}
|
761 |
|
762 |
+
?>
|
languages/cpt-bootstrap-carousel-sr_RS.mo
ADDED
Binary file
|
languages/cpt-bootstrap-carousel-sr_RS.po
ADDED
@@ -0,0 +1,181 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (C) 2013 CPT Bootstrap Carousel
|
2 |
+
# This file is distributed under the same license as the CPT Bootstrap Carousel package.
|
3 |
+
msgid ""
|
4 |
+
msgstr ""
|
5 |
+
"Project-Id-Version: CPT Bootstrap Carousel 1.5\n"
|
6 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/cpt-bootstrap-carousel\n"
|
7 |
+
"POT-Creation-Date: 2013-12-15 15:20:37+00:00\n"
|
8 |
+
"MIME-Version: 1.0\n"
|
9 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"PO-Revision-Date: 2014-08-13 15:30+0100\n"
|
12 |
+
"Last-Translator: Borisa Djuraskovic <borisad@webhostinghub.com>\n"
|
13 |
+
"Language-Team: Ewels <phil@tallphil.co.uk>\n"
|
14 |
+
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
15 |
+
"Language: fr\n"
|
16 |
+
"X-Generator: Poedit 1.5.7\n"
|
17 |
+
|
18 |
+
#: cpt-bootstrap-carousel.php:26
|
19 |
+
msgid "Carousel Images"
|
20 |
+
msgstr "Carousel slike"
|
21 |
+
|
22 |
+
#: cpt-bootstrap-carousel.php:27
|
23 |
+
msgid "Carousel Image"
|
24 |
+
msgstr "Carousel slika"
|
25 |
+
|
26 |
+
#: cpt-bootstrap-carousel.php:28
|
27 |
+
msgid "Add New"
|
28 |
+
msgstr "Dodaj novi"
|
29 |
+
|
30 |
+
#: cpt-bootstrap-carousel.php:29
|
31 |
+
msgid "Add New Carousel Image"
|
32 |
+
msgstr "Dodaj novu Carousel sliku"
|
33 |
+
|
34 |
+
#: cpt-bootstrap-carousel.php:30
|
35 |
+
msgid "Edit Carousel Image"
|
36 |
+
msgstr "Uredi Carousel sliku"
|
37 |
+
|
38 |
+
#: cpt-bootstrap-carousel.php:31
|
39 |
+
msgid "New Carousel Image"
|
40 |
+
msgstr "Nova Carousel slika"
|
41 |
+
|
42 |
+
#: cpt-bootstrap-carousel.php:32
|
43 |
+
msgid "View Carousel Image"
|
44 |
+
msgstr "Vidi Carousel sliku"
|
45 |
+
|
46 |
+
#: cpt-bootstrap-carousel.php:33
|
47 |
+
msgid "Search Carousel Images"
|
48 |
+
msgstr "Pretraži Carousel slike"
|
49 |
+
|
50 |
+
#: cpt-bootstrap-carousel.php:34
|
51 |
+
msgid "No Carousel Image"
|
52 |
+
msgstr "Nema Carousel slike "
|
53 |
+
|
54 |
+
#: cpt-bootstrap-carousel.php:35
|
55 |
+
msgid "No Carousel Images found in Trash"
|
56 |
+
msgstr "Carousel slike nisu nađene u korpi za otpatke"
|
57 |
+
|
58 |
+
#: cpt-bootstrap-carousel.php:37
|
59 |
+
msgid "Carousel"
|
60 |
+
msgstr "Carousel "
|
61 |
+
|
62 |
+
#: cpt-bootstrap-carousel.php:89
|
63 |
+
msgid "Featured Image"
|
64 |
+
msgstr "Uobličena slika"
|
65 |
+
|
66 |
+
#: cpt-bootstrap-carousel.php:110
|
67 |
+
msgid "Image URL"
|
68 |
+
msgstr "URL slike"
|
69 |
+
|
70 |
+
#: cpt-bootstrap-carousel.php:112
|
71 |
+
msgid "(optional - leave blank for no link)"
|
72 |
+
msgstr "(opciono - ostavite prazno ako nema linka)"
|
73 |
+
|
74 |
+
#: cpt-bootstrap-carousel.php:113
|
75 |
+
msgid "Open link in new window?"
|
76 |
+
msgstr "Otvoriti link u novom prozoru?"
|
77 |
+
|
78 |
+
#: cpt-bootstrap-carousel.php:166 cpt-bootstrap-carousel.php:179
|
79 |
+
#: cpt-bootstrap-carousel.php:389
|
80 |
+
msgid "Settings"
|
81 |
+
msgstr "Podešavanja"
|
82 |
+
|
83 |
+
#: cpt-bootstrap-carousel.php:180
|
84 |
+
msgid ""
|
85 |
+
"You can set the default behaviour of your carousels here. All of these "
|
86 |
+
"settings can be overridden by using %s shortcode attributes %s."
|
87 |
+
msgstr ""
|
88 |
+
"Ovde možete podesiti podrazumevano ponašanje svojih karusela. Sva "
|
89 |
+
"podešavanja mogu biti poništena uz pomoć %s atributa kratkog koda %s . "
|
90 |
+
|
91 |
+
#: cpt-bootstrap-carousel.php:210
|
92 |
+
msgid "Twitter Bootstrap Version"
|
93 |
+
msgstr "Twitter Bootstrap verzija"
|
94 |
+
|
95 |
+
#: cpt-bootstrap-carousel.php:218
|
96 |
+
msgid "Slide Interval (milliseconds)"
|
97 |
+
msgstr "Interval slajda (u milisekundama)"
|
98 |
+
|
99 |
+
#: cpt-bootstrap-carousel.php:226
|
100 |
+
msgid "Show Slide Captions?"
|
101 |
+
msgstr "Prikazati opise slajdova?"
|
102 |
+
|
103 |
+
#: cpt-bootstrap-carousel.php:234
|
104 |
+
msgid "Show Slide Controls?"
|
105 |
+
msgstr "Prikazati kontrole slajdova?"
|
106 |
+
|
107 |
+
#: cpt-bootstrap-carousel.php:242
|
108 |
+
msgid "Order Slides By"
|
109 |
+
msgstr "Rasporedi slajdove po"
|
110 |
+
|
111 |
+
#: cpt-bootstrap-carousel.php:250
|
112 |
+
msgid "Ordering Direction"
|
113 |
+
msgstr "Smer rasporeda"
|
114 |
+
|
115 |
+
#: cpt-bootstrap-carousel.php:258
|
116 |
+
msgid "Restrict to Category"
|
117 |
+
msgstr "Ograniči na kategoriju"
|
118 |
+
|
119 |
+
#: cpt-bootstrap-carousel.php:315 cpt-bootstrap-carousel.php:329
|
120 |
+
msgid "Show"
|
121 |
+
msgstr "Prikaži"
|
122 |
+
|
123 |
+
#: cpt-bootstrap-carousel.php:316 cpt-bootstrap-carousel.php:330
|
124 |
+
msgid "Hide"
|
125 |
+
msgstr "Sakrij"
|
126 |
+
|
127 |
+
#: cpt-bootstrap-carousel.php:336
|
128 |
+
msgid "Menu order, as set in Carousel overview page"
|
129 |
+
msgstr "Redosled menija, kao što je prikazano na stranici Carousel pregleda"
|
130 |
+
|
131 |
+
#: cpt-bootstrap-carousel.php:337
|
132 |
+
msgid "Date slide was published"
|
133 |
+
msgstr "Datum objavljivanja slajda"
|
134 |
+
|
135 |
+
#: cpt-bootstrap-carousel.php:338
|
136 |
+
msgid "Random ordering"
|
137 |
+
msgstr "Nasumičan redosled"
|
138 |
+
|
139 |
+
#: cpt-bootstrap-carousel.php:339
|
140 |
+
msgid "Slide title"
|
141 |
+
msgstr "Naziv slajda"
|
142 |
+
|
143 |
+
#: cpt-bootstrap-carousel.php:361
|
144 |
+
msgid "Ascending"
|
145 |
+
msgstr "Rastući"
|
146 |
+
|
147 |
+
#: cpt-bootstrap-carousel.php:362
|
148 |
+
msgid "Decending"
|
149 |
+
msgstr "Opadajući"
|
150 |
+
|
151 |
+
#: cpt-bootstrap-carousel.php:369
|
152 |
+
msgid "All Categories"
|
153 |
+
msgstr "Sve kategorije"
|
154 |
+
|
155 |
+
#. Plugin Name of the plugin/theme
|
156 |
+
msgid "CPT Bootstrap Carousel"
|
157 |
+
msgstr "CPT Bootstrap Carousel"
|
158 |
+
|
159 |
+
#. Plugin URI of the plugin/theme
|
160 |
+
msgid "http://www.tallphil.co.uk/bootstrap-carousel/"
|
161 |
+
msgstr "http://www.tallphil.co.uk/bootstrap-carousel/"
|
162 |
+
|
163 |
+
#. Description of the plugin/theme
|
164 |
+
msgid ""
|
165 |
+
"A custom post type for choosing images and content which outputs <a href="
|
166 |
+
"\"http://twitter.github.io/bootstrap/javascript.html#carousel\" target="
|
167 |
+
"\"_blank\">Bootstrap Carousel</a> from a shortcode. Requires Bootstrap "
|
168 |
+
"javascript and CSS to be loaded separately."
|
169 |
+
msgstr ""
|
170 |
+
"Prilagođeni tip posta za izbor slika i sadržaja koji prikazuje <a href="
|
171 |
+
"\"http://twitter.github.io/bootstrap/javascript.html#carousel\" target="
|
172 |
+
"\"_blank\">Bootstrap Carousel</a> iz kratkog koda. Zahteva da se Bootstrap "
|
173 |
+
"javascript i CSS otpreme odvojeno."
|
174 |
+
|
175 |
+
#. Author of the plugin/theme
|
176 |
+
msgid "Phil Ewels"
|
177 |
+
msgstr "Phil Ewels"
|
178 |
+
|
179 |
+
#. Author URI of the plugin/theme
|
180 |
+
msgid "http://phil.ewels.co.uk"
|
181 |
+
msgstr "http://phil.ewels.co.uk"
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: tallphil
|
|
3 |
Donate Link: http://www.tallphil.co.uk/bootstrap-carousel/
|
4 |
Tags: carousel, slider, image, bootstrap
|
5 |
Requires at least: 3.0.1
|
6 |
-
Tested up to:
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -64,7 +64,9 @@ As of version 1.5, nearly all of these options can be set in the CPT Bootstrap C
|
|
64 |
|
65 |
= Credits =
|
66 |
|
67 |
-
This plugin was written by @tallphil with help and suggestions from several others including (but not limited to) @joshgerdes, @atnon and @
|
|
|
|
|
68 |
|
69 |
|
70 |
== Installation ==
|
@@ -147,6 +149,21 @@ You need to make sure that each image is the same height. You can do this by set
|
|
147 |
|
148 |
== Changelog ==
|
149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
= 1.6 =
|
151 |
* Made the title and caption linked if we have a URL
|
152 |
* Stopped the caption div from displaying if there is not caption
|
3 |
Donate Link: http://www.tallphil.co.uk/bootstrap-carousel/
|
4 |
Tags: carousel, slider, image, bootstrap
|
5 |
Requires at least: 3.0.1
|
6 |
+
Tested up to: 4.0
|
7 |
+
Stable tag: 1.8
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
64 |
|
65 |
= Credits =
|
66 |
|
67 |
+
This plugin was written by @tallphil with help and suggestions from several others including (but not limited to) @reddo, @joshgerdes, @atnon, @grahamharper, @rchq, @oheijo, @smtk, @cla63 and @cookierebes.
|
68 |
+
|
69 |
+
The Serbo-Croation translation was kindly provided by Borisa Djuraskovic from http://www.webhostinghub.com
|
70 |
|
71 |
|
72 |
== Installation ==
|
149 |
|
150 |
== Changelog ==
|
151 |
|
152 |
+
= 1.8 =
|
153 |
+
* Bumped "tested with" up to WP 4.0
|
154 |
+
* Added new plugin icon and updated the banner + screenshots
|
155 |
+
* Carousel controls now hidden if there is only one image - thanks to @rchq
|
156 |
+
* Option to use a different WordPress image size, suggested by oheijo
|
157 |
+
* Added option to specify HTML tags for caption and title. Suggested by smtk
|
158 |
+
* New option to use background images instead of `<img>` tags. Good for resizing. Suggested by @cla63 and @cookierebes
|
159 |
+
* New Serbo-Croatian translation! Thanks to borisa from http://www.webhostinghub.com
|
160 |
+
|
161 |
+
= 1.7 =
|
162 |
+
* Added custom classes for next/prev buttons - written by @reddo
|
163 |
+
* Added admin column for categories
|
164 |
+
* Made the category dropdown in the settings work (bugfix)
|
165 |
+
* Addeed contextual help on post and page editing screens
|
166 |
+
|
167 |
= 1.6 =
|
168 |
* Made the title and caption linked if we have a URL
|
169 |
* Stopped the caption div from displaying if there is not caption
|