Search Exclude HTML Tags WordPress Plugin

December 4, 2011 1:43 PM by Ann

One of my clients, Jonathan at FinePrint, emailed me last week about the search function of his WordPress-based site being broken. He noted that searching for the keyword “title” on his support forum was returning almost everything. After a few tests on his site and some others, I realized that the search for “title” was actually returning all posts with images because of the title attribute in the image tags. So the real issue was that the WordPress built-in search considers HTML tags in post content to be searchable content… and that this meant that all WordPress sites were similarly “broken”.

I ended up implementing a fix for FinePrint by employing a MySQL function fnStripTags (found all over the internet and attributed to Robert Davis) to strip the HTML tags, and telling WordPress to use it by hooking into the posts_search filter.

From what I’ve been able to find, this “bug” has been around for years so perhaps it’s simply not an issue that people really care about or they just consider it intended functionality. Although I’m actually surprised to find very little in the way of complaints… or maybe I haven’t looked hard enough. Anyway, since it makes a lot more sense to me that HTML tags be stripped, I’ve taken the time to bundle this fix up into a plugin and get it onto WordPress.org. To apply on your site, just download, install, and activate!

Download the plugin “Search Exclude HTML Tags” from WordPress.org.

Sticky Custom Post Types WordPress Plugin

August 20, 2011 5:47 PM by Ann

I needed sticky custom post types for a client project but found out that WordPress doesn’t support this out of the box. Luckily it turned out to be pretty simple to add in that functionality with just a little bit of code… which I have turned into a plugin for everyone to use! YAY!

Installation/instructions:

1. Download the plugin from wordpress.org.

2. Upload sticky-custom-post-types.php to the /wp-content/plugins/ directory.

3. Select custom post types you want to enable with the sticky function on the ‘Settings → Reading’ page. Unless you’re using custom queries to display your sticky posts, you probably also want to check the option to display selected post types on the blog home.

4. When adding/editing a custom post type, check the “Stick this to the front page” checkbox if you want to stick that custom post to the front page.

And that’s it!

Unfortunately there’s no way to put the “Stick this…” checkbox in the same place as it is on the built-in “Posts” add/edit page (to do so would require modifying core code), but I think that having it display immediately is actually a lot more straightforward than having to click through the visibility setting edit link to get to it.

How to remove the Media Library tab in the WordPress media uploader

October 8, 2010 12:09 PM by Ann

By default, WordPress allows a user with the “upload_files” capability to view all items in the media library. Here’s how to remove the Media Library tab in the WordPress media uploader completely (e.g. for contributors without the “edit_others_posts” capability).

Copy and paste the following code into a plugin or the theme functions.php file:


function remove_medialibrary_tab($tabs) {
  unset($tabs['library']);
  return $tabs;
}
if(!current_user_can('edit_others_posts'))
  add_filter('media_upload_tabs','remove_medialibrary_tab');

We are the creators of our own destiny

April 23, 2010 12:56 PM by Ann

I survived my first solo road trip this past weekend. Hurtling down I-5 in my new red Mini Cooper at 100-120 mph was a bit of a rush for possibly as long as 30 minutes, then I got bored by the lack of turns. The trip to and from LA took about 5.5 hours down during the day and only 5 hours back driving overnight. The day was somewhat more fun as it was my first real drive in my car. I wasn’t keen on the 6.5 hours estimated drive time my GPS reported so I drove a bit like an asshole, weaving in and out past slower traffic, and cutting off and re-passing the same few cars that were doing the same thing to me all the way. I’ve never really driven like an asshole on the road before, and to be honest it was actually somewhat exciting. The night drive was calmer but felt a bit surreal… just endless black and blinding truck lights in my mirrors for hours.

Two things made my drive more bearable:

– The Smiths “The Queen is Dead”
– The audiobook of Garth Stein’s “The Art of Racing in the Rain”

There’s likely no one else in the world who can put your hopes, fears, and feelings to words like Morrissey. And he’s not even talking about you.

The latter turned out to be much more inspiring than I expected. It’s really a book about a very full life lived in a limited fashion as an extraordinary dog. It made me want to get a dog and take up racing. Most of all it made me appreciate being a person and having the communicative abilities that allow me to more significantly interact with the world, thereby creating a richer destiny for myself. It’s somewhat of a revelation to realize how much potential every life has, and how personally I’m lucky to have so few limitations and so many options. I haven’t really been taking advantage of my options lately… but I think I will.

“I want to see people and I want to see life.”

Horrifying

April 20, 2010 2:12 PM by Ann

Man fetus… WTF?!!!!!!!

http://www.cracked.com/article_18470_the-7-most-horrifying-things-ever-discovered-in-human-body.html

Apple hate

September 28, 2009 1:06 PM by Ann

I’m pissed off at Apple right now as I’m getting periodic Snow Leopard lockups (like everyone else) and it’s really impeding my work efficiency:

http://discussions.apple.com/thread.jspa?threadID=2141492

And that’s just one thread.

So what’s the fix? There doesn’t seem to be one right now. ARGH! Why did I have to pay $10 plus tax for this crap upgrade?

This coupled with my horrible Macbook Pro buying experience (brand new with case scratches, replaced with another new one with a dead pixel smack in the middle of the LCD, then finally a third one which is fine) is giving me a REALLY bad overall impression of Apple’s QC.

Noctilux f1.0 KYAAAAA!!!

June 19, 2009 4:27 PM by Ann

I was browsing Flickr the other day and found this photo commemorating the first time I held a Leica (D)SLR in my hands! It’s the Leica M8 digital body with a NOCTILUX f1.0!

Leica Noctilux!

Photo by Mark Jaquith. (He has a Nikon.)

But sadly it is not mine. (It belongs to PhotoMatt.)

Although I would gladly use it if it were given to me, I would probably never buy one. (Especially not the digital body… didn’t care for it at all…)

Unless, perhaps, I already had a Ferrari. Then… maybe. (But more likely still no.)

So anyway, YAY Friday!! (WEEKEND! And the weather is excellent!)

I like to use parentheses. (Doesn’t everyone?)

Addicted to bokeh

May 12, 2009 10:27 AM by Ann

I’ve always been interested in photography but up until recently had been discouraged by all of my photos invariably turning out really boring and crappy. Recently, my friend (BayAnime‘s official staff photographer) let me borrow his old manual lens, a Super Takumar 50mm/f1.4 adapted for the Canon EOS mount, and I have since realized that what I was really missing in my life (and photos) was the presence of extreme bokeh!

Wearing contact lenses coupled with the dim viewfinder of my XTi makes manual focusing incredibly difficult, but for now, I am just happy knowing that one in a hundred photos might actually turn out in some way that I like!

Of course this likely means that in another few months I will be lusting after ludicrously expensive bodies and lenses. What’s that you say? Noctilux f1.0? Curse you, Tommy Oshima’s Flickr photostream!

But for now I really need to get my own Super Takumar! Anyone have one in minty condition for sale (preferably an SMC)? Or a comparable inexpensive, sharp, fast, and awesome lens that can be adapted to the EOS mount?

Anyway I finally got around to taking a picture of one of my most treasured of stuffs…

1960's Martin F-65 acoustic electric guitar

Grandpa Oyama sure had excellent taste in guitars! I am especially proud of having accidentallycleverly used strategically placed bokeh to obscure some dust.

And the usual flower and bird pictures… but now with more bokeh! YAY!

rosebud

birdie

Always know where your soldering iron is

April 6, 2009 1:44 PM by Ann

The (really crappy) stock Apple power adapter for my old Powerbook G4 finally died. I had already been employing the constant twisting/fiddling method for a couple of months before it failed entirely. There was no way I was going to shell out $79 for another Apple power adapter and I also figured that given the symptoms there was a good chance that it was just a short in the poorly designed strain relief area near the jack… so I did what any person who has ever had the pleasure of inhaling the sweet fumes of lead solder would do and happily took a hammer to the damned thing. Using my limited toolset (a pair of scissors I found on the ground), I clipped and stripped the wires in preparation… then realized that I actually couldn’t find my soldering iron anywhere.

However, I did find some alligator clips. And fashioned a very temporary, extremely unsafe “fix” that got my Powerbook charging again! YAY!

Powerbook power adapter "fix"

But really… this is definitely NOT recommended.

Introducing Google Voice (formerly GrandCentral)

March 18, 2009 11:17 PM by Ann

I’ve been a heavy user of GrandCentral‘s phone/voicemail service since some time before they were acquired by Google. I found it especially handy for allowing me to have a San Francisco area code (415) phone number that forwards calls right to my original Hawaii cell phone number, which is pretty much the only phone I ever use. I’ve also used it to screen out those really annoying car warranty expiration spam calls.

Earlier today I got an email from Google saying that my GrandCentral account was finally ready to be upgraded to the new Google Voice service. Naturally, I had to upgrade and check out the new features! After only a few minutes I had already decided that the new service was much better than the old.

The new interface is very similar to Gmail’s and much easier to navigate than the GrandCentral interface. Google Voice now allows incoming calls to go straight through to you rather than being interrupted by the voice menu that used to force you to manually choose how to route the call every single time (this was my biggest complaint with the old service). They’ve also expanded their SMS features significantly. You can receive SMS messages at your Google Voice number and view/reply to them from the Google Voice web interface. Additionally, you can have SMS messages forwarded to your mobile phone and reply from there as usual. I was able to receive SMS messages sent from mobile phones just fine, but unfortunately test messages sent to my Google Voice number from AIM were never received.

Google has also added a voice to text service for voicemail messages. Although it’s a sweet feature for sure, I suspect that it will be pretty useless for actual use.

The test voicemail message I left: “Hello, how are you? What are you doing? Goodbye now.”

Google Voice’s text translation: “hey bill how are you went are you doing good site now”

But hey, what can you expect for free? It looks like the only feature they did away with was the ability to set custom ringtones, which I never used anyway. The one thing I thought they should have added is the ability to receive voicemail in your email as an attached audio file rather than just receiving a link to play it back online, along with their crappy text translation. Still, aside from charging for credits to place international phone calls (another new feature) the service is completely free, so I won’t be complaining…

Unfortunately for those of you who don’t already have GrandCentral accounts, there are no open signups yet for Google Voice. They are, however, currently taking requests for invites on their site.