• Hey!

    I have a problem wih my file carousel.php

    On my website (https://www.chasseurdudimanche.com) i have articles. On my carousel, we can see these articles.

    But certains have the … after the short description, et others no.

    I don’t know why. In my file, i have this:

    <div class=”post-excerpt”>
    <?php
    //display only the first 150 characters in the description.
    $excerpt = get_the_excerpt();
    echo substr($excerpt,0, 100);
    if (strlen($excerpt) > 99){
    echo ‘…’;
    }
    ?>
    </div>

    Do you have an idea why certains of my articles display well the … and others no. I would like that all my article display the …

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Je crois comprendre qu’avec ce script, il faut que le résumé “excerpt” excède 99 caractère pour rajouter les “…”

    Je ne m’y connais pas trop, j’apprends en ce moment mais il faudrait peut-être essayer avec ceci :

    <div class="post-excerpt">
    <?php
    //display only the first 150 characters in the description.
    $excerpt = get_the_excerpt();
    echo substr($excerpt,0, 100);
    echo '...';
    ?>
    </div>

    On enlève la condition “if” afin de rajouter systématiquement les points de suspension.

    Thread Starter valou64

    (@valou64)

    Merci pour ta réponse guillaume.
    J’ai testé ton code mais cela ne fonctionne malheureusement pas.

    Mes amis,

    Could you please use English language in this forum? I’d like to understand more of the solution. (And this is the English language forum.) ??

    Merci!
    m.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Carousel: display only first 150 characters in the description’ is closed to new replies.