Show the password on post excerpts
Justin Tadlock has written a nice tutorial on how to show a password form field instead of the default text “There is no excerpt because this is a protected post“.
Click here to continue reading
Remove spaces when echoing the_title
Ever
Add a shortcode
This is a simple one.
/** * Your Blog title * */ function my_blog_title() { $blogname = get_bloginfo('name'); return '<span class="blog-title">' . $blogname . '</span>'; } add_shortcode('blog-title', 'my_blog_title');Just add this to your functions.php file and then add [blog-title] in any post or page and it will return your Blog Title.
Click here to continue reading
How to: Open external links in a new window
Over the weekend, I attended WordCamp Denver, and I was asked by John Hawkins how to force links to open in a new tab with out editing the source code. So, today lets learn a simple jQuery trick to open all external links in your site in a new tab or window. We are going to make sure you have jQuery active on your site, you can do this easily in WordPress, since it’s bundled with the latest installations. Use this code in your header: <?php
Click here to continue readingFixing plugins not compatible with hybrid 0.4.2
Hey everyone, as you may have noticed I have a running on the site. While everything almost everything moved over smoothly, there was an issue with how my parent theme striped text in typography. This caused some plugins, like cformsII to not be allowed to print to the screen. Justin had helped to find a fix to filter the hybrid_typography function.
Originally this function filtered out and changed some text that would not validate as XHTML. This had to be removed by
Click here to continue readingAdd 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
Click here to continue readingStyling 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
Click here to continue readingJon Asked: How to add thumbnails above post on the THiCK theme
I was asked by a reader:
I’m using the THiCK theme for my new design blog. I noticed you were able to add thumbnail images above your blog posts on the home page. What would I need to do to enable this on my blog?
Well Jon, this can be done very simple, since the theme is already using the Tim Thumb script.
What you will need to do is find in your index.php file, the second loop. Which you can find on line 40.
<?php query_posts('offset=1&showposts=' . get_option('woo_other_entries') . '&cat=-' . $GLOBALS['ex_asides']Click here to continue readingHow to: Add any authors gravatar to their post
This is an easy one, just add one line to your single.php file where you would like the Gravatar to show up.
<?php echo get_avatar( get_the_author_id(), $size = '96', $default = '<path_to_url>' ); ?> Click here to continue readingHow to: Show what a user is searching for in the title
Want to show what any user was searching for?
It is simple, just add this line where your title would be.
The important line is the_search_query()
Click here to continue reading
Build a classic MyBlogLog widget
In this post I will show you how I created my custom widget showcasing mybloglog readers.
In your function.php file add this simple line of code:
<?php // MyBlogLog function MyBlogLogWidget() { ?> <script type="text/javascript" src="http://pub.mybloglog.com/comm2.php?mblID=ReplaceWithYourID&c_width=220&c_sn_opt=n&c_rows=6&c_img_size=h&c_heading_text=&c_color_heading_bg=e0e0d4&c_color_heading=E8A02C&c_color_link_bg=e0e0d4&c_color_link=d54e21&c&c_color_bottom_bg=e0e0d4"></script> <?php } //register the sidebar 'the widget name', 'the widget function'// register_sidebar_widget('MyBlogLog Widget', 'MyBlogLogWidget'); ?>That’s it, just replace the “ReplaceWithYourID” with your mybloglog ID. You can also change the width at c_width=220 to what ever you like.
If you look closely at the code you may also see color codes, you may change them to corresponding hex codes, for example: c_color_bottom_bg=e0e0d4 is the color for the bottom background. e0e0d4 is a light gray,
Click here to continue readingLimit 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
Click here to continue readingDisplay custom url if comment authors url is blank
Here is a nifty trick for your comments.php template. If someone comes to your site and leaves a comment but doesn’t leave a url back to there site, the default link that is shown in place of the php code comment_author_url is the current page link.
That might not look good. So, here is a little trick that I just implemented into my site. Besides installing the twittar plugin and pulling Twitter avatars I wanted to use the image itself for the authors url like. But if the author doesn’t have a Twitter avatar or a Gravatar it will display a
Click here to continue readingDisable caching of your site or post
I talked about Disabling search engine on search pages in a previous post using the meta tag. Today lets go over the web bots Cached copy of your site. If you are working on builder your blog, or have a temporary site up, use the following code:
<meta name="robots" content="noarchive">This will tell any bot to follow your site, index it, but prevents a cached copy of this page from being available in the search results.
Click here to continue reading
