Support » Plugin: Nelio Featured Posts » limiting title length

  • Resolved muchmuch11



    your plugin is awesome πŸ˜€

    i want to limit the length on post title on this featured post widget, how can i do so?

    i want it like this, for example the title “Cuadrado needs time to settle at Chelsea, says Bacca”, for me this is too long, i want it shortened like this “Cuadrado needs time to settle at Chelsea…” or “Cuadrado needs time to settle at Chels…”

    how can it limit it based on characters count or words count.

    thanks a lot!

Viewing 1 replies (of 1 total)
  • Plugin Author David Aguilera



    The latest version of our plugin includes templates. With them, you can define anything you want! Consider, for instance, the title-only.php example we include in the plugin. Line 22 prints the title:

    echo apply_filters( 'the_title', $post->post_title, $post->ID );

    You can change that to something like this:

    $num_of_chars = 40;
    $title = apply_filters( 'the_title', $post->post_title, $post->ID );
    echo substr( $title, 0, $num_of_chars );

    and you’ll have a title with the first 40 chars only. Easy, right?

    I hope this helps you! And, please, don’t forget to rate our plugin.

Viewing 1 replies (of 1 total)
  • The topic ‘limiting title length’ is closed to new replies.