Forums

Cut Of Title (3 posts)

  1. froggystone
    Member
    Posted 5 years ago #

    Yeah so this little thing has been driving me mad now :/

    All i want is a shorter title, i got some "lastest posts" in the side column, its just i only want each post title to fill around 20 words and thereby 1 line i've tryid with the substr funktion but it didnt work out :/

    like
    TITLE LINK GOES HE..
    TITLE LINK GOES HE..
    TITLE LINK GOES HE..

    I've search around and cant find anyone mention this, only about cutting of the content.. but i just wanna cut of the title or shorten it if you want :/

  2. whooami
    Member
    Posted 5 years ago #

    http://www.totallyphp.co.uk/code/shorten_a_text_string.htm

    Google amazes me :)

    ... and that does work, your just not using it properly, or in the right place. One or both of the two.

  3. froggystone
    Member
    Posted 5 years ago #

    yeah ok let me specify it a bit :/

    if (is_home()) {

    $myposts = get_posts('numberposts=10&offset=1');
    foreach($myposts as $post) :
    ?>

    ">
    (this line doesnt work)<?php substr(the_title(), 0, 15);?>

    <?php endforeach; }?>

    I've tryid to put the_title into a $ like $t = the_title()

    But i guess u cant put a fucktion inside a varible

    what you refur to is pretty much what i've already done, he has also writen it into a funktion :/

    but well gonna try a bit and see what im gonna end up with ( probely some bruses from banging my head down the keyboard)

    Anyway this should be pretty simple, im just a bit rusty :P would be nice if someone could just work out that tiny little line :P

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags