wordpress questions 123

Discussion in 'PHP' 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."

    change 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 an 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. geekpriyan

    geekpriyan Peon

    Messages:
    126
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    For your first two question please refer the site http://codex.wordpress.org If you want the exact help i will post it on tomorrow.

    Then for your last question i really don't know whether their is any opportunity is there or not...
     
    geekpriyan, Nov 16, 2008 IP
  3. johno123

    johno123 Well-Known Member

    Messages:
    1,492
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    130
    #3
    i have looked through the wordpress site and found no answers. which is what led me here.

    If you have some solution please share...

    thx



    ----------------------------------------------------------------
    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
  4. ariefsyu

    ariefsyu Active Member

    Messages:
    192
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #4
    You need to edit your theme files.
    on function.php , insert these codes.
    function showWords($str,$number = '100') {
    	$temp = explode(' ',strip_tags($str));
    	if ( count($temp) > $number) {
    		$output = array();
    		for ($i = 0; $i < $number; $i++) {
    			$output[] = $temp[$i];
    		}
    		return implode(' ',$output);
    	}
    	else return $str;
    }
    Code (markup):
    next on index.php or whatsoever needed, change this code
    <?php the_title(); ?>
    Code (markup):
    to
    <?php echo showWords(the_title(),5) ?>
    Code (markup):
    5 above is the sum of words.

    I dont know how to prevent, but the #01 answer will be a cure for question #2

    Sorry I cant help you on #3


    Arief
     
    ariefsyu, Nov 17, 2008 IP
  5. johno123

    johno123 Well-Known Member

    Messages:
    1,492
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    130
    #5
    ok, cool..

    im gunna try it out.. is the " $number = '100') " part where i change how many characters to allow?
     
    johno123, Nov 17, 2008 IP
  6. ariefsyu

    ariefsyu Active Member

    Messages:
    192
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #6
    It's not a characters count. It's a word count.
    <?php echo showWords(the_title(),[B]5[/B]) ?>
    Code (markup):
    change the 5 to any desired words count.

    Arief
     
    ariefsyu, Nov 17, 2008 IP
  7. johno123

    johno123 Well-Known Member

    Messages:
    1,492
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    130
    #7
    hi there,

    that did not work at all.

    Most of the areas on the site that the titles are too long are being called up by a plugin. So, not available to change the <?php the_title(); ?> to the new one.


    Example:

    <?php if (function_exists('yg_randomposts')) { ?>
    <li><h2><?php echo 'Random Ads'; ?></h2>
    <ul>
    <?php
    yg_randomposts('limit=10&cats=&currentcat=1');
    ?>
    </ul>
    </li>
    <?php } ?>


    Plugin is called Advanced Random Posts v1.1

    I would assume the plugin would have to be edited to display what i need for my theme.



    -----


    I really would like to be able to limit the title length allowed, when posting a new article into wordpress. Like ebay has when you are listing something for sale. It wont let you add more letters.

    If anyone can help with that..

    thx in advance
     
    johno123, Nov 17, 2008 IP