I always thought that it was a part of the theme that made that function and I wanted to cut it off at the character where it was going to break into the next line. So by the time I was done with my theme, I discovered that the function was not a part of the theme, in fact it was a part of the default wordpress ‘engine’ files.
So after searching each one of them I discovered that it was in the widgets.php file. If anyone of you wants to make the long post titles break down before they move to the next line, then be sure of what you’re doing as messing up with the wordpress files can mess up the functionality of you blog. I’m not trying to scare you, but I must warn you. Moreover, you must also know how to open and edit your blog’s wordpress files which are located at your host.
So once you’re at your host and are at the browser, open the folder where you installed your wordpress blog, then open wp-includes folder and then click on the file called widgets.php and edit it (whichever way your host supports). Once it is open look for this part:
Once you’ve found it, replace it with this:
have_posts()) : $r->the_post(); ?>- ”>
Now, you need to check the things that are in bold, in my case I want the maximum size of the post title to be 37 because of the width of my sidebar. So if the post title is already less than 37, it will display the original post title else, it will take it’s first 33 characters and add ‘…’ at it’s end. If you change the first number in bold, just subtract 4 from it and put the resulting number in the second one. You can see this in action in this blog’s sidebar. Hope this helps the people who wanted to get rid of the word wrap ruining their design, and if you need any help with this just post a comment and I shall be glad to help.
have_posts()) : $r->the_post(); ?>- ” href=””>
if((strlen($ba)) >=37)
echo substr($ba,0,33) . “…”;
else
the_title();
?>
This comment has been removed by the author.
ReplyDelete