Author Archives: Mark Headrick

Excluding Categories from Different Parts of WordPress

Update January 18, 2016: Thought I would mention that if you also want to remove the categories from the Archives drop-down, check out my How To Exclude Categories in WordPress Archives Drop-down post.

Update January 24, 2015: I discovered a bug with the code below. I added an is_admin() exception so the post listings in the admin section would still work properly. Without the exception, the Category filter would fail to work. I actually created a WordPress Support thread when I noticed it.


For the longest time I had been using the Advanced Category Excluder plug-in to keep a couple post categories from showing on the blog’s home page, RSS feed, search, and monthly archive views. Well, after my webhost upgraded the server to PHP 5.3.17 from PHP 5.2.X it broke that plug-in. After searching around for some answers, I tried out the Simply Exclude plug-in which did work; however, it had a couple issues. One problem was that if I excluded a category from showing in the archive view or the category drop-down widget, it broke the permalink for categories where the address bar would show /?cat=6 instead of /category/dentist/ for example. It also excluded the category from both the monthly archive view and the category view itself. I did some more searching around and came across this WordPress Codex article about Category Exclusion. I adapted the code there and placed the following 8 lines of code into my theme’s functions.php file (info on using a theme’s functions.php):

function remove_my_categories( $wp_query ) {
  // 61 = Daily Tweets, 74 = Testing
  $remove_cat = '-61,-74';

  // remove from archives (except category archives), feeds, search, and home page, but not admin areas
  if( (is_home() || is_feed() || is_search() || ( is_archive() && !is_category() )) && !is_admin()) {
    set_query_var('cat', $remove_cat);
    //which is merely the more elegant way to write:
    //$wp_query->;set('cat', '-' . $remove_cat);
  }
}

add_action('pre_get_posts', 'remove_my_categories' );

That’s all I needed to exclude those categories’ posts from showing on the home page, RSS feeds, search results, and the monthly archives! I can still select the category from the category drop-down list and view it in the category context. Needless to say, I’ve removed both of those plug-ins from my blog.

Hopefully this information will help some others out that run into a similar situation. 🙂

Website Changes for October 2012

Here’s October 2012’s list of changes changes to my websites. 🙂

Friday, October 26, 2012

While I was trying to get a new version of Apache (2.2.23) and PHP (5.3.18) installed and working on my system to better match what Surpass Hosting upgraded my server to on the 23rd, I noticed that I had a slightly newer version of the Inception Blu-ray page than had been uploaded. It now has the back-cover image and properly sized player to match the trailer’s actual dimensions. The things that happened concerning the server upgrade and me trying to get these newer Apache and PHP versions installed and working would probably warrant a separate post.

Suppose I should change the published date on this post to match the latest date on it. Uhh.. maybe not.. it changes the permalink for the post as well, breaking the old link. Better change the published date back to the original LOL. Hrmm.. food for thought with these posts. I know what to do next time. Make sure I change the permalink to contain just the month of the post and not the day. Actually, I can’t do that either, at least not easily. I’d have to manually change the permalink in the database. Ehh.. I’ll think on the matter.

Wednesday, October 17, 2012

Decided I would try out Twitter’s new Embedded Timeline widgets. I’ve added this newer version to both my main website and blog. I also decided to test out a #NASCAR search widget on my NASCAR page. At the moment I’d call them a work in progress. For example, I’ve defined the link color to be blue or #0000FF for the widget on my main website and they do show as blue in Firefox; however, they don’t in IE9. The #NASCAR search widget is also missing a lot of tweets that a normal #NASCAR search shows. I’ll give them the benefit of the doubt for now in case there is some behind the scenes work still going on that I’m not aware of or some setting that I need to tweak. If it doesn’t start to work better in a few days then I’ll probably get rid of it.

How to Make MIDI Files Sound Better in Windows 7

For those that might remember, my old computer system had a melt-down of sorts and I had to get a new one. This new system has Windows 7 Pro/SP1 64-bit and has a Realtek ALC892 Audio chipset in it. Regular MP3s and other digital music formats sound fine on it but MIDI files sounded like crap for the most part compared to my old system. I do still have the Sound Blaster X-Fi Elite Pro that was in my old system; however, I just never felt like going through the effort of trying to get it to work in this system due to its age and probably limited support in Windows 7 64-bit. Anyway, I knew the problem wasn’t so much the audio chipset (well, yes, it does have an impact) but the lack luster MIDI instrument samples that ship with Windows 7 which the included “Microsoft GS Wavetable Synth” uses. I also looked at the Sound Control Panel Applet and noticed that there was no option to set a default MIDI playback device like Windows XP had (which I still find rather odd.)

So, I went searching on the internet and found an article aptly titled: How to Make Midi Files Sound Better on Windows, which led me to CoolSoft’s VirtualMIDISynth. So I thought I would try it out and, what do you know, it works great! I was even able to load the SoundFont that my Sound Blaster X-Fi Elite Pro was using.

Anyway, since my website uses Windows Media Player to play its MIDI files with, I did need to use this software to change MIDI Mapper’s Default MIDI Out Device from Microsoft GS Wavetable Synth to CoolSoft VirtualMIDISynth:

MIDI Mapper Tab

Then, I loaded up the Soundfont my old card was using in the Soundfonts tab:

Soundfonts Tab

While it doesn’t sound exactly like it did before (due to the differences in audio hardware and drivers), it is now much closer because it is using better base sound samples to work with. MIDI files can sound much different simply by changing the Soundfonts used. I tried a few of the ones linked to at those sites and some of them aren’t too bad. Short of getting a new sound card that puts more emphasis on how MIDI sounds, this is a good compromise, and it’s free! LOL 🙂

Oh, for those using Firefox, the amount of memory that the associated plugin-container.exe process uses while playing a MIDI file will roughly match the size of the Soundfont(s) selected as it has to load them into memory. So, a 256MB Soundfont will cause it to use that much memory.

For those like me that also use Winamp, since the default device has now been changed for all of Windows, it will start playing MIDI files using the improved instrument sounds as well. However, you can directly change the MIDI playback device by going into Winamp’s Preferences -> Plug-ins -> Input -> Nullsoft MIDI Player -> Devices Tab and select the second midiOut / Microsoft MIDI Mapper choice (this is the one that came with Winamp v5.63):

Winamp MIDI Device Setting

Note: If you change the default MIDI Mapper device back to Microsoft GS Wavetable Synth in the VirtualMIDISynth Configurator then Winamp will show two entries for midiOut / Microsoft GS Wavetable. In this scenario, pick the second one. Why it doesn’t list VirtualMIDISynth specifically I do not know. I may send feedback to Coolsoft and/or Winamp about it.

Just for the heck of it, I swapped out Winamp’s current MIDI plug-in with a really old one that supported auto-loading Soundfonts. Its device listing is somewhat different and lists VirtualMIDISynth by name:

Winamp MIDI v2.63b Device Setting

I tried the auto-load Soundfont option that this plug-in has for MIDI files that use a specific Soundfont; however, it didn’t work. Pretty sure that option only works with Sound Blasters (this did work in my old system).

Anyway, I’m still playing with different Soundfonts to get the best sound. Now I need to install a virtual MIDI keyboard so I can play specific instruments. Hope this information helps someone out there. 🙂

Website Changes for September 2012

For a long time back in the past I used to post little news snippets on the home page of my main website at www.markheadrick.com about changes I’d make to the site; however, I haven’t been sure if each little change really warranted a separate blog posting so a lot of things have never been mentioned unless it was something radical. Yes, I am well aware that 99.99% of the people out there couldn’t give a flying fruitcake about any of it; however, that’s beside the point. LOL 🙂 So, what I thought I would do is create a monthly post about changes made to my various sites and update that post during the month with updates. The primary focus being on my main site as the others have the own “news” sections about changes made to them. If it’s something major with code examples and what not then those will have their own post with a reference to the change in these posts. Yeah.. that’s the ticket!

Saturday, September 22, 2012

I noticed that I had the title of one my movies slightly wrong. The Lord of the Rings: The Fellowship of the Ring is now correct. I missed one of the “The”s LOL. While I was at it, I also added the DVD Empire and ImDB links as well as a trailer for the movie! Naturally, I also updated my main DVD/Home Theater page.

Tuesday, September 18, 2012

After reading The Guide For Fixing & Preventing Hacks a few days ago, I decided to go through my various directories (at my webhost) and delete old and no longer used files (many being renamed versions of other files for backup purposes) and create some .htaccess redirects for pages that once existed that were now just pages that said to go to the new page.

Today, I also tweaked my hardware page to use locally stored copies of my cable modem’s speed test images with links to the originals at the speed test sites to slightly improve page load time and to reduce the dependency on those sites actually being up for the page to render properly. I also completely removed some of the older speed test references.

 We’ll just have to wait and see how this approach goes. 🙂

Blog Updated to WordPress Version 3.4.2 and Other Changes.

I just finished updating my blog to WordPress Version 3.4.2 which is a maintenance and security update. This post is just as much a test of the upgrade as it is anything. It’s been a long time since I made a post about upgrading WordPress because there’s really not much to say about it. All I do is backup the database and files, click “update” in the admin section, and I’m done. The whole process takes like 30 seconds. Since only modified files are updated now, the code changes I make to vars.php and wp-login.php rarely need to be added back in.

I used to add little news snippets on the front of my main website every time I changed something on one of the pages. Most recently, I changed the Entertainment/Now Playing page where I merged the TV and Movie section and added the GetGlue Check-In and Sticker Widgets on the side to show what I’ve watched most recently. I’ve probably made other tweaks here and there but I can’t remember where and what LOL. I suspect after I hit publish on this post I’ll uncover some issues that I’ll need to address.

Hope everyone had a great Labor Day Weekend and I’m looking forward to the NASCAR Sprint Cup race this weekend at Richmond to determine the final chase line-up! 🙂