|
|||||||
|
Almost every blog that I visit uses the ‘Recent posts/Recent Articles’ widget which is a default widget in the wordpress files. When I was making this new theme for my blog, I wanted to automate it as much as possible. Did I ever tell you that I had to manually update the recent posts widget for my blog before I did this tweak? Well, you might think I’m crazy but the problem is that I’m a little too choosy while formatting and I don’t want even a single link in my sidebar to break into the next line, that is it should be coming in 1 line, whatsoever. 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:
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. Related Articles:
top |
|||||||
|
|
|
||||||
Make Money On The Internet said,
Thanks for this greatest tips. You help many bloggers to fix their long title on the sidebar.
[Reply To This Comment]
Ex Back said,
Hey, nice tips. I’ll buy a glass of beer to that man from that chat who told me to visit your blog
[Reply To This Comment]
Underwater Digital Camera Reviews said,
Wow, thanks, my blog looks like an absolute mess as some of my titles are like 60 characters and they just make the whole widget look messy, so this will certainly help me fix that up
[Reply To This Comment]
Odzyskiwanie Danych said,
Post names should be short anyway so I guess instead of playing around with code bloggers should focus more on making titles more interesting and shorter. Remember: it’s the title that attracts your readers.
[Reply To This Comment]
Kikolani said,
Thanks for the tip. I think bloggers go for longer titles sometimes because of the keywords in the URL. Those can come up pretty high in search results quickly.
~ Kristi
[Reply To This Comment]
homebased money said,
Dear Abdul,
Nice effort by you for online earning .Keep it up,
Visit my site may be you find it useful Homebased Money
[Reply To This Comment]
Add A Comment