Version Description
- Bugfix. Apologies to anyone who ran into it and thanks to kylewhenderson for the spot.
Download this release
Release Info
Developer | tallphil |
Plugin | CPT Bootstrap Carousel |
Version | 1.8.1 |
Comparing to | |
See all releases |
Code changes from version 1.7 to 1.8.1
- cpt-bootstrap-carousel.php +265 -125
- languages/cpt-bootstrap-carousel-sr_RS.mo +0 -0
- languages/cpt-bootstrap-carousel-sr_RS.po +181 -0
- readme.txt +17 -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';
|
@@ -155,8 +155,15 @@ function cptbc_set_options (){
|
|
155 |
'orderby' => 'menu_order',
|
156 |
'order' => 'ASC',
|
157 |
'category' => '',
|
|
|
|
|
|
|
|
|
|
|
158 |
'id' => '',
|
159 |
-
'twbs' => '3'
|
|
|
|
|
160 |
);
|
161 |
add_option('cptbc_settings', $defaults);
|
162 |
}
|
@@ -187,136 +194,194 @@ class cptbc_settings_page {
|
|
187 |
|
188 |
// Options page callback
|
189 |
public function create_admin_page() {
|
190 |
-
|
191 |
-
|
192 |
if(!$this->options){
|
193 |
cptbc_set_options ();
|
194 |
$this->options = get_option( 'cptbc_settings' );
|
195 |
}
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
}
|
211 |
|
212 |
// Register and add settings
|
213 |
-
public function page_init() {
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
add_settings_section(
|
221 |
-
'cptbc_settings_options', // ID
|
222 |
-
'', // Title - nothing to say here.
|
223 |
-
array( $this, 'cptbc_settings_options_header' ), // Callback
|
224 |
-
'cpt-bootstrap-carousel' // Page
|
225 |
-
);
|
226 |
-
|
227 |
-
add_settings_field(
|
228 |
-
'twbs', // ID
|
229 |
-
__('Twitter Bootstrap Version', 'cpt-bootstrap-carousel'), // Title
|
230 |
-
array( $this, 'twbs_callback' ), // Callback
|
231 |
-
'cpt-bootstrap-carousel', // Page
|
232 |
-
'cptbc_settings_options' // Section
|
233 |
-
);
|
234 |
-
|
235 |
-
add_settings_field(
|
236 |
-
'interval', // ID
|
237 |
-
__('Slide Interval (milliseconds)', 'cpt-bootstrap-carousel'), // Title
|
238 |
-
array( $this, 'interval_callback' ), // Callback
|
239 |
-
'cpt-bootstrap-carousel', // Page
|
240 |
-
'cptbc_settings_options' // Section
|
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 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
274 |
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
298 |
|
299 |
}
|
300 |
|
301 |
// Sanitize each setting field as needed - @param array $input Contains all settings fields as array keys
|
302 |
public function sanitize( $input ) {
|
303 |
-
|
304 |
foreach($input as $key => $var){
|
305 |
-
if($key == 'twbs' || $key == 'interval'){
|
306 |
$new_input[$key] = absint( $input[$key] );
|
307 |
if($key == 'interval' && $new_input[$key] == 0){
|
308 |
$new_input[$key] = 5000;
|
309 |
}
|
310 |
-
} else {
|
|
|
|
|
311 |
$new_input[$key] = sanitize_text_field( $input[$key] );
|
312 |
}
|
313 |
}
|
314 |
-
|
315 |
}
|
316 |
|
317 |
// Print the Section text
|
318 |
public function cptbc_settings_options_header() {
|
319 |
-
// nothing to say here.
|
320 |
}
|
321 |
|
322 |
public function twbs_callback() {
|
@@ -388,7 +453,7 @@ class cptbc_settings_page {
|
|
388 |
'menu_order' => __('Menu order, as set in Carousel overview page', 'cpt-bootstrap-carousel'),
|
389 |
'date' => __('Date slide was published', 'cpt-bootstrap-carousel'),
|
390 |
'rand' => __('Random ordering', 'cpt-bootstrap-carousel'),
|
391 |
-
'title' => __('Slide title', 'cpt-bootstrap-carousel')
|
392 |
);
|
393 |
print '<select id="orderby" name="cptbc_settings[orderby]">';
|
394 |
foreach($orderby_options as $val => $option){
|
@@ -428,6 +493,65 @@ class cptbc_settings_page {
|
|
428 |
}
|
429 |
print '</select>';
|
430 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
431 |
|
432 |
|
433 |
}
|
@@ -482,6 +606,11 @@ function cptbc_contextual_help_tab() {
|
|
482 |
<li>Filter carousel items by a comma separated list of carousel category slugs.</li>
|
483 |
</ul></li>
|
484 |
|
|
|
|
|
|
|
|
|
|
|
485 |
<li><code>id</code> <em>(default all)</em>
|
486 |
<ul>
|
487 |
<li>Specify the ID of a specific carousel post to display only one image.</li>';
|
@@ -542,32 +671,41 @@ function cptbc_frontend($atts){
|
|
542 |
if($atts['category'] != ''){
|
543 |
$args['carousel_category'] = $atts['category'];
|
544 |
}
|
|
|
|
|
|
|
|
|
545 |
if($atts['id'] != ''){
|
546 |
$args['p'] = $atts['id'];
|
547 |
}
|
|
|
548 |
$loop = new WP_Query( $args );
|
549 |
$images = array();
|
550 |
while ( $loop->have_posts() ) {
|
551 |
$loop->the_post();
|
552 |
-
if ( '' != get_the_post_thumbnail() ) {
|
553 |
$post_id = get_the_ID();
|
554 |
$title = get_the_title();
|
555 |
$content = get_the_excerpt();
|
556 |
-
$image = get_the_post_thumbnail( get_the_ID(), '
|
|
|
|
|
557 |
$url = get_post_meta(get_the_ID(), 'cptbc_image_url');
|
558 |
$url_openblank = get_post_meta(get_the_ID(), 'cptbc_image_url_openblank');
|
559 |
-
$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);
|
560 |
}
|
561 |
}
|
562 |
if(count($images) > 0){
|
563 |
ob_start();
|
564 |
?>
|
565 |
<div id="cptbc_<?php echo $id; ?>" class="carousel slide" data-ride="carousel" data-interval="<?php echo $atts['interval']; ?>">
|
566 |
-
|
567 |
-
|
568 |
-
|
|
|
|
|
|
|
569 |
<?php } ?>
|
570 |
-
</ol>
|
571 |
<div class="carousel-inner">
|
572 |
<?php foreach ($images as $key => $image) {
|
573 |
$linkstart = '';
|
@@ -581,26 +719,28 @@ function cptbc_frontend($atts){
|
|
581 |
$linkend = '</a>';
|
582 |
}
|
583 |
?>
|
584 |
-
<div class="item <?php echo $key == 0 ? 'active' : ''; ?>" id="<?php echo $image['post_id']; ?>"
|
585 |
-
<?php echo $linkstart.$image['image'].$linkend; ?>
|
586 |
<?php if($atts['showcaption'] === 'true' && strlen($image['title']) > 0 && strlen($image['content']) > 0) { ?>
|
587 |
<div class="carousel-caption">
|
588 |
-
|
589 |
-
|
590 |
</div>
|
591 |
<?php } ?>
|
592 |
</div>
|
593 |
<?php } ?>
|
594 |
</div>
|
595 |
-
<?php if(
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
|
|
|
|
604 |
<?php } ?>
|
605 |
</div>
|
606 |
<script type="text/javascript">
|
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.1
|
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';
|
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 |
}
|
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() {
|
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){
|
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 |
}
|
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>';
|
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']);
|
692 |
+
$image_src = $image_src[0];
|
693 |
$url = get_post_meta(get_the_ID(), 'cptbc_image_url');
|
694 |
$url_openblank = get_post_meta(get_the_ID(), 'cptbc_image_url_openblank');
|
695 |
+
$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);
|
696 |
}
|
697 |
}
|
698 |
if(count($images) > 0){
|
699 |
ob_start();
|
700 |
?>
|
701 |
<div id="cptbc_<?php echo $id; ?>" class="carousel slide" data-ride="carousel" data-interval="<?php echo $atts['interval']; ?>">
|
702 |
+
<?php if( count( $images ) > 1 ){ ?>
|
703 |
+
<ol class="carousel-indicators">
|
704 |
+
<?php foreach ($images as $key => $image) { ?>
|
705 |
+
<li data-target="#cptbc_<?php echo $id; ?>" data-slide-to="<?php echo $key; ?>" <?php echo $key == 0 ? 'class="active"' : ''; ?>></li>
|
706 |
+
<?php } ?>
|
707 |
+
</ol>
|
708 |
<?php } ?>
|
|
|
709 |
<div class="carousel-inner">
|
710 |
<?php foreach ($images as $key => $image) {
|
711 |
$linkstart = '';
|
719 |
$linkend = '</a>';
|
720 |
}
|
721 |
?>
|
722 |
+
<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;"'; } ?>>
|
723 |
+
<?php if($atts['use_background_images'] == 0){ echo $linkstart.$image['image'].$linkend; } ?>
|
724 |
<?php if($atts['showcaption'] === 'true' && strlen($image['title']) > 0 && strlen($image['content']) > 0) { ?>
|
725 |
<div class="carousel-caption">
|
726 |
+
<?php echo $atts['before_title'].$linkstart.$image['title'].$linkend.$atts['after_title']; ?>
|
727 |
+
<?php echo $atts['before_caption'].$linkstart.$image['content'].$linkend.$atts['after_caption']; ?>
|
728 |
</div>
|
729 |
<?php } ?>
|
730 |
</div>
|
731 |
<?php } ?>
|
732 |
</div>
|
733 |
+
<?php if( count( $images ) > 1 ){ ?>
|
734 |
+
<?php if($atts['showcontrols'] === 'true' && $atts['twbs'] == '3') { ?>
|
735 |
+
<a class="left carousel-control" href="#cptbc_<?php echo $id; ?>" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span></a>
|
736 |
+
<a class="right carousel-control" href="#cptbc_<?php echo $id; ?>" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span></a>
|
737 |
+
<?php } else if($atts['showcontrols'] === 'true'){ ?>
|
738 |
+
<a class="left carousel-control" href="#cptbc_<?php echo $id; ?>" data-slide="prev">‹</a>
|
739 |
+
<a class="right carousel-control" href="#cptbc_<?php echo $id; ?>" data-slide="next">›</a>
|
740 |
+
<?php } else if($atts['showcontrols'] === 'custom' && $atts['twbs'] == '3' && $atts['customprev'] != '' && $atts['customnext'] != ''){ ?>
|
741 |
+
<a class="left carousel-control" href="#cptbc_<?php echo $id; ?>" data-slide="prev"><span class="<?php echo $atts['customprev'] ?> icon-prev"></span></a>
|
742 |
+
<a class="right carousel-control" href="#cptbc_<?php echo $id; ?>" data-slide="next"><span class="<?php echo $atts['customnext'] ?> icon-next"></span></a>
|
743 |
+
<?php } ?>
|
744 |
<?php } ?>
|
745 |
</div>
|
746 |
<script type="text/javascript">
|
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,18 @@ You need to make sure that each image is the same height. You can do this by set
|
|
147 |
|
148 |
== Changelog ==
|
149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
= 1.7 =
|
151 |
* Added custom classes for next/prev buttons - written by @reddo
|
152 |
* Added admin column for categories
|
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.1
|
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.1 =
|
153 |
+
* Bugfix. Apologies to anyone who ran into it and thanks to kylewhenderson for the spot.
|
154 |
+
|
155 |
+
= 1.8 =
|
156 |
+
* Bumped "tested with" up to WP 4.0
|
157 |
+
* Added new plugin icon and updated the banner + screenshots
|
158 |
+
* Carousel controls now hidden if there is only one image - thanks to @rchq
|
159 |
+
* Option to use a different WordPress image size, suggested by oheijo
|
160 |
+
* Added option to specify HTML tags for caption and title. Suggested by smtk
|
161 |
+
* New option to use background images instead of `<img>` tags. Good for resizing. Suggested by @cla63 and @cookierebes
|
162 |
+
* New Serbo-Croatian translation! Thanks to borisa from http://www.webhostinghub.com
|
163 |
+
|
164 |
= 1.7 =
|
165 |
* Added custom classes for next/prev buttons - written by @reddo
|
166 |
* Added admin column for categories
|