I have some wordpress code questions for you

Discussion in 'WordPress' started by johno123, Nov 16, 2008.

  1. #1
    Hi all


    i have a few questions about some things in wordpress.

    1. Anyone know how to make it so the titles shown on the sidebar in wordpress only show a certain length.?



    example

    "this is an example of a really long title that seems to go on and on an on even so yes this is a real long title."

    to


    "this is an example of a really long ..."


    2. How can i limit the amount of spaces allowed in the title, when a user posting a article in wordpress ?



    3. Is there a search page plugin for wordpress, that i can get for my site? so a user can click on a link and get taken to a "search" page. So they can have some advanced searching capabilities. Like search by category or archive or whatever.



    Ok, i guess that's about it for now. thanks in advance for any help you can offer.
     
    johno123, Nov 16, 2008 IP
  2. cuhela

    cuhela Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I'll give you an answer, but before that; which title tag you use in sidebar ?
    if it is the_title();
    you can set the lenght with this codes:

    $title = get_the_title();
    $newtitle = substr(0, 30, $title); // it takes first 30 characters for your title
    echo $newtitle;
    PHP:
     
    cuhela, Nov 16, 2008 IP
  3. johno123

    johno123 Well-Known Member

    Messages:
    1,492
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    130
    #3
    in sidebar it uses

    <td><h4>&nbsp;- <font color=#AA0001><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h4></td>


    where would i add that code?

    ----------------------------------------------------------------
    Also as per my earlier question...

    "How can i limit the amount of spaces allowed in the title, when a user is posting a article in wordpress ?"

    This way i wont need to limit in each theme file. If i can limit the amount of spaces allowed in the title when an article is being posted. This will solve my problem in the beginning.


    thx
     
    johno123, Nov 17, 2008 IP