Viewing 4 replies - 1 through 4 (of 4 total)
  • I would use YARPP custom templates and put the code limiting the title length there. So, first make sure that in YARPP options you’re set to use custom templates. For example, “yarpp-template-example.php”. Then open that file in your theme editor and find this part:

    <li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a><!-- (<?php the_score(); ?>)--></li>

    Replace with:

    <li><a href="<?php the_permalink() ?>" rel="bookmark"><?php echo substr(get_the_title(), 0, 40); ?>...</a><!-- (<?php the_score(); ?>)--></li>

    I’m no expert but this should work…

    Thanks @chadrew! Indeed, I think that would work!

    Thread Starter mauriciomesquita

    (@mauriciomesquita)

    Thanks!

    To limit to 40 characters and do not display words in half:

    <li><a href="<?php the_permalink() ?>" rel="bookmark">
    <?php
    $title_cortado = explode(" ", substr(get_the_title(), 0, 40));
    if(count($title_cortado) > 1) array_pop($title_cortado);
    $title_cortado = implode(" ", $title_cortado)."...";
    echo $title_cortado;
    ?>  </a><!-- (<?php the_score(); ?>)--></li>

    Thank you for your attention!
    Congratulations

    Ah, nice as well.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Yet Another Related Posts Plugin] Limiting display of characters per title’ is closed to new replies.