• I have the skinless carousel set up and it seems to be working well. The one thing I need to change is the length of the excerpt. Currently the text sometimes runs past the end of the div.

    I see that the content is pulling from the theme-jcarousel.php file…
    <?php echo $item['DESC']; ?>

    I tried to change this to the_excerpt in order to limit the number of words that show up (and add a ‘read more’ link), however that won’t show the image in the teaser, which I want to have.

    Any advice for getting the content to fit in the box, and allow images?

    Thanks!

    *Here is the site so you can see what I mean: https://militaryoneclick.com/

    https://www.ads-software.com/extend/plugins/wp-carousel/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author sumolari

    (@sumolari)

    $item['ID'] stores the ID of the post, so you can use WordPress functions to get the post’s object and then show the excerpt.

    Other way to solve the problem is to “cut” the value of $item['DESC']. Something like:

    <?php echo substr( $item['DESC'], 0, 20 )."..."; ?>

    That code will print the first 20 characters of the string.

    Thread Starter katefosson

    (@katefosson)

    Thanks for your help.
    I guess I don’t know enough to call the right things…
    If I add ‘ID’ in place of ‘DESC’ the ID number shows up as the content. How would I go about displaying the excerpt?

    Right now I’m using this function for the blog section. Could I call something similar with a different custom_excerpt_length?
    (that solves the issue of cutting off words vs. characters…although it does not show images in the excerpt, which I need it to do)

    function new_excerpt_more($more) {
           global $post;
    	return '<a class="moretag" href="'. get_permalink($post->ID) . '"> <p>Read the full article...</p></a>';
    }
    add_filter('excerpt_more', 'new_excerpt_more');
    
    function custom_excerpt_length( $length ) {
    	return 150;
    }
    add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );

    Thanks again!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: WP Carousel] Specify excerpt length (and images) for skinless crousel’ is closed to new replies.