Tips & Tricks
Limit the characters that display on the_title
Ever wanted to display the title of a post somewhere but limit the amount of characters that are shown? For instance, this post has a very long title, and if I were to use <?php echo the_title() ?>
it would show as follows: Limit the characters that display on the_title.
That may not fit well on one line in lets say a widget or small width div
. So here is a neat trick you can use:
<?php $title = the_title('','',FALSE); echo substr($title, 0, 11); ?>
Pretty simple huh, just note the bold numbers, in this case 11 character would output like this: Limit the c.
Thanks to Tattershall Way for this snippet.
Plugins
Add the twittar plugin for WordPress w/ comment threading
I talked about the Twittar plugin in a previous post. But learned that the read me text file was only useful for installing the necessary php
code into WordPress themes that don’t have comment threading enabled.
Since most new themes past version 2.7, pull the comments section from functions.php
file, that is where you have to edit the avatars in order to show the twittar settings.
First open you functions.php
, and look for a line of code that says:
function custom_comment()
This is where your new comments are pulled from when you have the threaded comments enabled.
Now just find <?php echo get_avatar( $comment, $args['avatar_size'] ); ?>
& replace with <?php twittar(70, "", "", "avatar avatar-70 photo", 1, "R"); ?>
. Keep in mind that you will need to edit the Twittar setting to fit your site.
Tips & Tricks
Styling your ordered & unordered list items into 2 columns
In a previous post I showed you how to create a custom widget, then I showed you how to create a widget for your monthly archives, and limit the month’s that show. I am showing the past 4 months in my widget at this time.
One of my readers: Alex asked:
How did you make the archives widget to show the dates separately into two columns?
Now I will show you a CSS trick to create this effect:
First we will give the unordered list a width of 100%:
ul#archives { width:110%; }
Then we will style the <li>
nested inside.
ul#archives li { display:inline; float:left; width:120px; }
And that is it. Please make sure that you clear the float
after your closing </ul>
.
Tips & Tricks
Changing your feedbuner form to work with Google
A lot of you may be using a email form to gather email’s via Feedburner. I am use that by now you know Google has decided to dump feedburner.com and move all feeds through Google Proxy or Feeburner2 which is a Google Server. Here is the new form you will need to put on your site to get new email address’s:
<form action="http://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow" onsubmit="window.open('http://feedburner.google.com/fb/a/mailverify?uri=YOUR_FEED_NAME', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true"> <p class="form-label">Enter your email address:</p><p><input type="text" style="width:140px" name="email"/></p> <input type="hidden" value="YOUR_FEED_NAME" name="url"/> <input type="hidden" value="<?php bloginfo('name') ?>" name="title"/> <input type="hidden" name="loc" value="en_US"/> <input id="submit" type="submit" value="Subscribe" /> </form>
That’s it, just be sure to change YOUR_FEED_NAME
to your feed name. For example, my feed is now http://feeds2.feedburner.com/WPCult. Where WPCult is now my ID.
-
Tips & Tricks3 months ago
WordPress Security Hacks
-
Pages3 weeks ago
Write For Us – Guest Post
-
Showcase1 month ago
StylizedWeb.com
-
News2 weeks ago
How to: Show/Hide any div box with jQuery in WordPress
-
Tips & Tricks2 months ago
How to: show/hide a widget in WordPress with jQuery
-
Tips & Tricks5 months ago
Remove the title attribute using jQuery
-
Plugins2 months ago
Top Membership plugins
-
Tips & Tricks4 months ago
Remove spaces when echoing the_title
Pingback: WordPress links week 4 - 2009 | WPStart.org - WordPress themes, plugins and news
Daniel
May 23, 2009 at 7:04 am
Cheers. Very useful. 🙂
I don’t suppose could help me with adding a little extra to this. I want to put “…” at the end if the amount of chars in the title exceeds the cut off point.
Austin
May 25, 2009 at 2:45 pm
Hmm, not really sure how to print that if, and only if characters are less than whats printed. May want to chack out pnp.net