Plugin Directory

Changeset 561461


Ignore:
Timestamp:
06/21/2012 03:50:43 AM (14 years ago)
Author:
ansimation
Message:

Renamed .clear in tbtestimonials.css to .tbtclear ( this was reflected in the output options but not the css itself )
Commented out check to load js on pages with active widget. There was no default CSS for in-content testimonials.
Added category shortcode option
Added category function arg
Updated documentation to show new category usage
Removed semi-colon on line 920 ( http://wordpress.org/support/topic/fatal-error-tb-testimonialsphp-on-line-881-when-force_ssl_admin-is-true?replies=25#post-2834424 )
Switched showposts references to posts_per_page ( been deprecated for a while )

Location:
tb-testimonials/trunk
Files:
3 edited

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; }
    22.hidden-testimonial { display:none; }
    33
     
    3434
    3535/*li.testimonial-slide { border:1px solid red!important; }*/
     36
     37div.in-listing-testimonial { font-size:1em; clear:both; margin:10px 0; }
     38div.in-listing-testimonial .testimonial-gravatar { float:left; width:50px; margin-right:10px; }
     39div.in-listing-testimonial .testimonial-data { float:left; width:450px; }
     40div.in-listing-testimonial .testimonial-data p { margin:0!important; padding:0!important; }
     41div.in-listing-testimonial .testimonial-data .testimonial-author { padding-top:5px; font-size:1em; padding-top:5px!important; }
     42div.in-listing-testimonial .testimonial-data .testimonial-company { font-size:1em; }
  • tb-testimonials/trunk/inc/tpl/documentation.php

    r306336 r561461  
    3434            <div class="tab-content" id="functions">
    3535                <dl>
    36                     <dt>tbtestimonial( [integer|string $id][, bool $echo = false] )</dt>
     36                    <dt>tbtestimonial( [integer|string $id] [, bool $cat = false ] [, bool $echo = false] )</dt>
    3737                    <dd>
    3838                        <strong style="margin:10px 0 10px;display:block;">Parameters:</strong>
     
    4040                            <dt>ID</dt>
    4141                            <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>
    4244                            <dt>Echo</dt>
    4345                            <dd>Boolean - Echo if true, return if false</dd>
     
    4951                        <dl>
    5052                            <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>
    5254                        </dl>
    5355                    </dd>
     
    5759                        <dl>
    5860                            <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>
    6062                        </dl>
    6163                        <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>
     
    7476                        </dl>
    7577                    </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>
    7690                </dl>
    7791            </div>
     
    86100
    87101                    <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>
    89103
    90104                    <dt>tbtestimonials_widget_syntax</dt>
  • tb-testimonials/trunk/tb-testimonials.php

    r561450 r561461  
    356356            shortcode_atts(
    357357                array(
    358                     'id' => null
     358                    'id' => null,
     359                    'cat' => null
    359360                ),
    360361                $atts
    361362            )
    362363        );
    363         if( ! is_null( $id ) )
     364        if( ! is_null( $id ) && is_null( $cat ) )
    364365        {
    365366            if( strtolower( $id ) == 'all' ) # all testimonials
    366367            {
    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 ) );
    368390
    369391                if( $q->have_posts() )
     
    375397                        $return .= $this->prepare_testimonial( 'shortcode-all' );
    376398                    }
    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();
    396400                    return $return . '</div>';
    397401                }
     
    415419                    return;
    416420            }
     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;
    417444        }
    418445        else
     
    742769
    743770        # only call when widget is active
    744         if( is_active_widget( false, false, 'tbtestimonialswidget' ) )
    745         {
     771        /*if( is_active_widget( false, false, 'tbtestimonialswidget' ) )
     772        {*/
    746773            # 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        /*}*/
    749777    }
    750778}
     
    768796* @param mixed $id
    769797*/
    770 function tbtestimonial( $id = false, $echo = true )
     798function tbtestimonial( $id = false, $cat = false, $echo = true )
    771799{
    772800    $tbtestimonials = new TBTestimonials();
    773801
    774802    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 ) );
    776804    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 )
    779807        $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' ) );
    780810    else
    781811        return false;
     
    918948                continue;
    919949
    920             if( $preloader_obj = tbtestimonials_prepare_preloader( $loader ) );
     950            if( $preloader_obj = tbtestimonials_prepare_preloader( $loader ) )
    921951                $preloaders += $preloader_obj;
    922952        }
Note: See TracChangeset for help on using the changeset viewer.