Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Chris Dillon

    (@cdillon27)

    Hi Alex,

    I just tested it in Customizr 3.3.23 and had no problems. What version are you using?

    If you right-click the testimonial content and select “Inspect Element” you will see a line above nearby like

    <div class="testimonial truncated ...

    when using the length attribute, and

    <div class="testimonial excerpt ...

    when using the excerpt attribute.

    Which do you see?

    Thread Starter Alex

    (@aleks-nl5)

    Firstly – sorry, it’s my fault – I used the modified file testimonials.php in theme folder.
    But the question remains open – how to modify this file after a manner that would be on the same page can be displayed only an excerpt, but on the other – the full content?
    Probably should be something like:

    <?php
    	if ( $excerpt ) : // excerpt overrides length
    	$show_content = $post->post_excerpt;
    	    elseif( $length ) : // truncated
     	$show_content = wpmtst_truncate( $post->post_content, $length );
    	    else : // entire
    	$show_content = wpautop( $post->post_content );
    		endif;
    	echo do_shortcode( $show_content );
    ?>

    but when I use this code (from the default template), then the content is not displayed.

    Plugin Contributor Chris Dillon

    (@cdillon27)

    Use code from /strong-testimonials/templates/theme/testimonials.php instead.

    In that template file you can use the standard WordPress functions

    <?php the_content(); ?>

    for the full content, or

    <?php the_excerpt(); ?>

    for the excerpt. Or you can truncate the content using

    <?php wpmtst_field( 'truncated', array( 'char_limit' => 100 ) ); ?>

    That is a template for a single block of testimonials. You can create multiple templates like “testimonials-full-content.php” and “testimonials-excerpt.php”. Then attach the template to the shortcode like this:

    [strong template="full-content"]

    or

    [strong template="excerpt"]

    Thread Starter Alex

    (@aleks-nl5)

    Thanks a lot for the help!
    With templates all turned out well!
    Let me add – to “hard” does not limit the number of characters in the template directly, instead of numbers (in your case, “100”) is better specify ‘$length’, and in the shortcode to specify ‘length=”50″‘.
    For example, replace
    <?php wpmtst_field( 'truncated', array( 'char_limit' => 100 ) ); ?>
    on
    <?php wpmtst_field( 'truncated', array( 'char_limit' => $length ) ); ?>

    Plugin Contributor Chris Dillon

    (@cdillon27)

    Cool, I’m glad that worked.

    And thanks for the tip. Hardcoding will override “length”. So use either

    [strong ...]
    <?php wpmtst_field( 'truncated', array( 'char_limit' => 100 ) ); ?>

    or

    [strong length="50" ...]
    <?php wpmtst_field( 'truncated', array( 'char_limit' => $length ) ); ?>

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Excerpt don't work with Customizr theme’ is closed to new replies.