• Need some advice to shorten titles on Wp Show Posts.
    Found different ways here https://doc4design.com/wordpress-5ways-shorten-titles/ but not so sure ??

    Saw kind of code like

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    <h1><?php the_title_limit( 30, ‘read more >’); ?></h1>

    <?php the_content(); ?>
    <?php endwhile; endif; ?>

    But what’s about the function in backoffice generated by the plugin itself ?
    here : <?php if ( function_exists( ‘wpsp_display’ ) ) wpsp_display( 1746 ); ?>

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Elvin

    (@ejcabquina)

    Hi,

    Are you trying to make the title display 1 one line and truncate it with ellipsis?

    If so, I believe you should be able to do it with simple CSS.

    h2.wp-show-posts-entry-title {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    But if you’re trying to limit the number of characters, you can try this PHP snippet:

    function change_title($title) {
        if( in_the_loop() && !is_archive() ) { // This will skip the menu items and the archive titles
            return mb_strimwidth($title, 0, 10, '...');              
        }    
        return $title;    
    }
    add_filter('the_title', 'change_title', 10, 2); 
    Thread Starter Frederique Game

    (@frederique-game)

    Thanks !! I would use php filter as mentioned ??

    Plugin Support Elvin

    (@ejcabquina)

    No problem. ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Need some advice to shorten titles on Wp Show Posts’ is closed to new replies.