I was bored yesterday so I made a little site called ishosted.at (I love ccTLDs). Its a silly stupid little site that basically tells you who is hosting a site based on the nameservers. Its probably not that useful and there are still some bugs I need to fix and enhancements I want to make but I was pleasantly surprised that I actually got it to work. I really like having projects even small ones so hopefully I can find something else to do like this next week.
Category Archives: Code
Include posts by matching authors in your search results
Reblogged from danielbachhuber:
Out of the box, WordPress' search isn't that great. It only returns posts based on a LIKE query against the post title or post content. Often, you'll want it to match against other data associated with your post, possibly including the author, tags, post meta fields, etc. These queries can get complex to perform on the fly, however.
The following code snippet allows you to include posts by matching authors in your search results.
Clearing Default Fields with Gravity Forms
jQuery(document).ready(function() {
jQuery.fn.cleardefault = function() {
return this.focus(function() {
if( this.value == this.defaultValue ) {
this.value = "";
}
}).blur(function() {
if( !this.value.length ) {
this.value = this.defaultValue;
}
});
};
jQuery(".clearit input, .clearit textarea").cleardefault();
});
Source: http://www.gravityhelp.com/clearing-default-form-field-values-with-jquery/
If you are looking for the right away to do contextual help in WordPress 3.3 look no further than Twenty Eleven. It does everything by the book including a fallback for WordPress 3.2. Just look in /inc/theme-options.php in Twenty Eleven starting at line 114. Props to @nacin for pointing this out to me.
oEmbed = Awesome
I was aware of oEmbed as Obox uses it in their video meta boxes, but I really didn’t know much about it. What I didn’t know is that all you have to do to use it is paste the link to a video or image on a new line and WordPress will automatically go out, find and return the media. If you want to see what sources are whitelisted by default, please see this codex entry. I found out about this from a video from WordPress Montreal 2011 starring Otto and Nacin. There is a lot of really cool things in that video, you should really check it out.
Note: The video was embedded in this post by just posting the url on a new line in the WordPress visual editor
P.S. Don’t forget to set your $content_width constant so WordPress knows how large to make your media.
if ( ! isset( $content_width ) ) $content_width = 584;
Contextual Help Menus and Custom Post Types
I am a big fan of custom post types and I use them in just about every project I do now. The same thing goes for contextual help menus. I think they are one of the most underutilized aspects of WordPress and I am a firm believer that if you have an admin screen you need to have a contextual help menu (I’ll save this particular rant for another time). But what I just noticed is that by default when you create a CPT it does not create a contextual help menu. I guess I thought that it would display the same menu for a CPT as a regular post but I was wrong.
So now that I know that custom post types do not have contextual help menus what should I do about it? At the very minimum even if you do not want to take the time to write your own custom help menu you should at least include the regular post help menu. For your convenience I have put together a gist with the code you need. I based my code off this codex entry. That being said, if you modify either the list view or the editor view of your custom post type you really should modify the help menus to reflect that. There is nothing worse than asking a user to input something in Box A when Box A no longer exists.
What do you think? Am I making too big of deal about this? Do you think all CPTs need a contextual help menu?
Finishing Touches for Custom Post Types
Lately most client/Obox projects have involved custom post types of one kind or another. However one thing that has always bothered me is how these custom post types don’t show up in the Right Now Dashboard Widget. I know the widget only shows you how many posts (or post types) there are and many people simply turn it off but I still want my custom post types to be represented there.
After a quick Codex search I found this entry Right Now Dashboard Widget, which is really nice because it gives a ready to go example where all you need to do is change a few lines of code and you are in business.
What do you think? Is it worth the effort? Does anybody really care if your CPT’s are listed in the Right Now Dashboard Widget besides me?
BESsBESsBESsBESsBESsBESsBESsBESsBESsBESsBESsBESsBESsBESsBESsBESsBESsBESsBESsBESs

An example of this technique applied to a Custom Post Type