Changeset 561461
- Timestamp:
- 06/21/2012 03:50:43 AM (14 years ago)
- Location:
- tb-testimonials/trunk
- Files:
-
- 3 edited
-
inc/css/tbtestimonials.css (modified) (2 diffs)
-
inc/tpl/documentation.php (modified) (6 diffs)
-
tb-testimonials.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tb-testimonials/trunk/inc/css/tbtestimonials.css
r335920 r561461 1 . clear:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }1 .tbtsclear:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } 2 2 .hidden-testimonial { display:none; } 3 3 … … 34 34 35 35 /*li.testimonial-slide { border:1px solid red!important; }*/ 36 37 div.in-listing-testimonial { font-size:1em; clear:both; margin:10px 0; } 38 div.in-listing-testimonial .testimonial-gravatar { float:left; width:50px; margin-right:10px; } 39 div.in-listing-testimonial .testimonial-data { float:left; width:450px; } 40 div.in-listing-testimonial .testimonial-data p { margin:0!important; padding:0!important; } 41 div.in-listing-testimonial .testimonial-data .testimonial-author { padding-top:5px; font-size:1em; padding-top:5px!important; } 42 div.in-listing-testimonial .testimonial-data .testimonial-company { font-size:1em; } -
tb-testimonials/trunk/inc/tpl/documentation.php
r306336 r561461 34 34 <div class="tab-content" id="functions"> 35 35 <dl> 36 <dt>tbtestimonial( [integer|string $id] [, bool $echo = false] )</dt>36 <dt>tbtestimonial( [integer|string $id] [, bool $cat = false ] [, bool $echo = false] )</dt> 37 37 <dd> 38 38 <strong style="margin:10px 0 10px;display:block;">Parameters:</strong> … … 40 40 <dt>ID</dt> 41 41 <dd>Integer or String - The ID of a testimonial to be displayed. Can be substituted for 'all', 'rand', or 'random'. If false we assume random.</dd> 42 <dt>Cat</dt> 43 <dd>Show category listing. ID must be a sting if using this. eg: <code>tbtestimonial( 'my category', true );</code></dd> 42 44 <dt>Echo</dt> 43 45 <dd>Boolean - Echo if true, return if false</dd> … … 49 51 <dl> 50 52 <dt>URL</dt> 51 <dd>Local URL(s) or file path(s) to preloader image(s). Must be in the wp-content folder, sub-directories are fine. See <a href="#register_preloaders_example">Example</a>.</dd>53 <dd>Local URL(s) or file path(s) to preloader image(s). Must be in the wp-content folder, sub-directories are fine. <strong><em>See Examples Tab</em></strong>.</dd> 52 54 </dl> 53 55 </dd> … … 57 59 <dl> 58 60 <dt>URL</dt> 59 <dd>Local URL or file path to preloader image. Must be in the wp-content folder, sub-directories are fine. See <a href="#register_preloaders_example">Example</a>.</dd>61 <dd>Local URL or file path to preloader image. Must be in the wp-content folder, sub-directories are fine. <strong><em>See Examples Tab</em></strong>.</dd> 60 62 </dl> 61 63 <p class="updated fade" style="display:inline; padding:5px; position:relative; top:10px; color:#333;">Note: This function returns a preloader object to be used in <code>tbtestimonials_register_preloaders()</code></p> … … 74 76 </dl> 75 77 </dd> 78 79 <dt>[testimonial cat='my category']</dt> 80 <dd> 81 <strong style="margin:10px 0 10px;display:block;">Parameters:</strong> 82 <dl> 83 <dt>Cat</dt> 84 <dd> 85 The category name to show posts from ( case insensitive ).<br /> 86 <em>The ID argument can not be used while using the cat argument. If it is, cat will be ignored.</em> 87 </dd> 88 </dl> 89 </dd> 76 90 </dl> 77 91 </div> … … 86 100 87 101 <dt>tbtestimonials_template_tags</dt> 88 <dd>Filter default template tags. See <a href="#template_tag_example">Example</a></dd>102 <dd>Filter default template tags.</dd> 89 103 90 104 <dt>tbtestimonials_widget_syntax</dt> -
tb-testimonials/trunk/tb-testimonials.php
r561450 r561461 356 356 shortcode_atts( 357 357 array( 358 'id' => null 358 'id' => null, 359 'cat' => null 359 360 ), 360 361 $atts 361 362 ) 362 363 ); 363 if( ! is_null( $id ) )364 if( ! is_null( $id ) && is_null( $cat ) ) 364 365 { 365 366 if( strtolower( $id ) == 'all' ) # all testimonials 366 367 { 367 $q = new WP_Query( array( 'post_type' => 'testimonial', 'post_status' => 'publish', 'showposts' => '-1', 'order_by' => 'menu_order' ) ); 368 $q = new WP_Query( array( 'post_type' => 'testimonial', 'post_status' => 'publish', 'posts_per_page' => '-1', 'order_by' => 'menu_order' ) ); 369 370 if( $q->have_posts() ) 371 { 372 $return = '<div id="tbtestimonial-listing">'; 373 while( $q->have_posts() ){ 374 $q->the_post(); 375 $return .= $this->prepare_testimonial( 'shortcode-all' ); 376 } 377 $return .= '</div>'; 378 } 379 else{ 380 wp_reset_query(); 381 return; 382 } 383 384 wp_reset_query(); 385 return $return; 386 } 387 elseif( strtolower( $id ) == 'random' || strtolower( $id ) == 'rand' ) # random testimonial 388 { 389 $q = new WP_Query( array( 'post_type' => 'testimonial', 'post_status' => 'publish', 'orderby' => 'rand', 'posts_per_page' => 1 ) ); 368 390 369 391 if( $q->have_posts() ) … … 375 397 $return .= $this->prepare_testimonial( 'shortcode-all' ); 376 398 } 377 378 return $return . '</div>'; 379 } 380 else 381 return; 382 } 383 elseif( strtolower( $id ) == 'random' || strtolower( $id ) == 'rand' ) # random testimonial 384 { 385 $q = new WP_Query( array( 'post_type' => 'testimonial', 'post_status' => 'publish', 'showposts' => '-1', 'orderby' => 'rand', 'showposts' => 1 ) ); 386 387 if( $q->have_posts() ) 388 { 389 $return = '<div id="tbtestimonial-listing">'; 390 while( $q->have_posts() ) 391 { 392 $q->the_post(); 393 $return .= $this->prepare_testimonial( 'shortcode-all' ); 394 } 395 399 wp_reset_query(); 396 400 return $return . '</div>'; 397 401 } … … 415 419 return; 416 420 } 421 } 422 else if( is_null( $id ) && ! is_null( $cat ) ) # category listing 423 { 424 $q = new WP_Query( array( 425 'post_type' => 'testimonial', 426 'post_status' => 'publish', 427 'posts_per_page' => '-1', 428 'testimonial_category' => $cat 429 ) ); 430 431 if( $q->have_posts() ) 432 { 433 $return = '<div id="tbtestimonial-listing">'; 434 while( $q->have_posts() ) 435 { 436 $q->the_post(); 437 $return .= $this->prepare_testimonial( 'shortcode-all' ); 438 } 439 wp_reset_query(); 440 return $return . '</div>'; 441 } 442 else 443 return; 417 444 } 418 445 else … … 742 769 743 770 # only call when widget is active 744 if( is_active_widget( false, false, 'tbtestimonialswidget' ) )745 { 771 /*if( is_active_widget( false, false, 'tbtestimonialswidget' ) ) 772 {*/ 746 773 # load css 747 if( ! is_admin() && isset( $this->settings['use_stylesheet'] ) ) wp_enqueue_style( 'tbtestimonials-stylesheet', plugins_url( 'inc/css/tbtestimonials.css', __FILE__ ), array(), '1.0', 'screen' ); 748 } 774 if( ! is_admin() && isset( $this->settings['use_stylesheet'] ) ) 775 wp_enqueue_style( 'tbtestimonials-stylesheet', plugins_url( 'inc/css/tbtestimonials.css', __FILE__ ), array(), '1.0', 'screen' ); 776 /*}*/ 749 777 } 750 778 } … … 768 796 * @param mixed $id 769 797 */ 770 function tbtestimonial( $id = false, $ echo = true )798 function tbtestimonial( $id = false, $cat = false, $echo = true ) 771 799 { 772 800 $tbtestimonials = new TBTestimonials(); 773 801 774 802 if( is_string( $id ) && $id == 'random' || is_string( $id ) && $id == 'rand' || $id === false ) 775 $q = new WP_Query( array( 'post_type' => 'testimonial', 'post_status' => 'publish', 'orderby' => 'rand', ' showposts' => 1 ) );803 $q = new WP_Query( array( 'post_type' => 'testimonial', 'post_status' => 'publish', 'orderby' => 'rand', 'posts_per_page' => 1 ) ); 776 804 elseif( is_string( $id ) && strtolower( $id ) == 'all' ) 777 $q = new WP_Query( array( 'post_type' => 'testimonial', 'post_status' => 'publish', 'orderby' => 'rand', ' showposts' => -1 ) );778 elseif( is_numeric( $id ) )805 $q = new WP_Query( array( 'post_type' => 'testimonial', 'post_status' => 'publish', 'orderby' => 'rand', 'posts_per_page' => -1 ) ); 806 elseif( is_numeric( $id ) && ! $cat ) 779 807 $q = new WP_Query( array( 'p' => (int)$id, 'post_type' => 'testimonial', 'post_status' => 'publish' ) ); 808 elseif( is_numeric( $id ) && $cat ) 809 $q = new WP_Query( array( 'testimonial_category' => $id, 'post_type' => 'testimonial', 'post_status' => 'publish' ) ); 780 810 else 781 811 return false; … … 918 948 continue; 919 949 920 if( $preloader_obj = tbtestimonials_prepare_preloader( $loader ) ) ;950 if( $preloader_obj = tbtestimonials_prepare_preloader( $loader ) ) 921 951 $preloaders += $preloader_obj; 922 952 }
Note: See TracChangeset
for help on using the changeset viewer.