High-Pitched Noise Over Speakers When Moving Mouse

I had a problem and found the solution, so I’m posting incase anyone Googles and come across this. 😉

Ever since I formatted my computer, I’d hear a constant high-pitched sound coming out of my headphones (very faint) and it’d change in pitch every time I moved my mouse. Turns out muting my line-in in my sound control panel fixed it. Some type of interference I guess.

Hope this helps anyone having the same problem.

Keeping Your Blog’s Theme Up To Date Using SVN

Zialus asked me to explain how I keep my blog’s theme up to date using SVN while keeping my modifications. The answer is too long for Twitter, so I’m writing a small blog post about it.

  • I checked out a copy of the theme I use to my computer (easier to work on it from my PC than my server). The SVN URL for themes hosted on WordPress.org is http://themes.svn.wordpress.org/. Find your theme there. For example my blog’s theme is http://themes.svn.wordpress.org/mystique/1.72/ (as of the time of this post).
  • I made the changes I wanted to the theme on my computer (tweaks and such) and then uploaded it to my server.
  • When a new version of the theme is released, I run svn diff > file.diff on my local checkout to get a file containing all of my modifications (this will be handy for the next step).
  • I use svn switch to switch to the new version SVN URL. Your SVN client will attempt to merge in any changes by the theme author into your modified files, but it may run into collisions (where the theme’s author and you have modified the same area of a file). You’ll need to manually fix any collisions (this is why I check out to my PC instead of my server). I tend to just hit revert on the file and then using the diff file from the previous step for reference, re-add my modifcations.
  • Upload the new version of the theme (with your modifications to your server).

Questions? Feel free to ask via my comments section. 🙂

Tracking WordPress Remote HTTP Requests

UPDATE: You can find improved code in this newer blog post. Use that instead.

I thought I’d share a bit of code that I run on my local WordPress test install to see when WordPress is contacting another website. I originally wrote this to help debug my oEmbed code, but it’s useful for a wide variety of purposes. 🙂

[php]<?php

if ( !defined(‘DOING_AJAX’) )
add_filter( ‘http_request_args’, ‘debug_http_api’, 10, 2 );

function debug_http_api( $r, $url ) {
echo ‘<p style="text-align:left">HTTP API was used to fetch <code>’ . esc_html( $url ) . ‘</code></p>’;

return $r;
}

?>[/php]

The above code will output something like this any time a HTTP request is made using the HTTP API, but only if the request was not made from an AJAX handling script (as it will break the AJAX response):

HTTP API was used to fetch http://www.google.com/

While I’m using a filter to do this, I’m actually using the filter much like an action as I’m not modifying the passed data but merely using the filter as a place to hook in and catch the URL.

Ugly Betty Uses WordPress

Jane noticed that Ugly Betty uses WordPress, so I thought I’d post some screen caps. It’s been heavily reworked, but you can still tell the production staff used WordPress as a base.

Pretty funny.

I’ll Be Attending WordCamp San Francisco

I’ll be attending WordCamp San Francisco on May 1st. If you’re planning on being there, make sure you say hi. I like putting a face to all those online / IRC nicknames. 🙂

EDIT: Just to be clear, registration isn’t actually open (yet), I’m merely stating my intent to go and was curious who else was planning on attending. 😉

EDIT #2: Registration is now open!

WordPress: Using Filters With get_posts()

Something I just learned and thought I’d share to save others the trouble: if you’re attempting to filter the results of get_posts(), for example with the posts_where filter, you need to disable suppress_filters.

For example, here’s how to fetch some posts from within the past 30 days (based on an example from the Codex):

[php]<?php

function last_thirty_days( $where = ” ) {
global $wpdb;

$where .= $wpdb->prepare( " AND post_date > %s", date( ‘Y-m-d’, strtotime(‘-30 days’) ) );

return $where;
}

add_filter( ‘posts_where’, ‘last_thirty_days’ );

$some_posts = get_posts( array( ‘suppress_filters’ => false ) );

// Important to avoid modifying other queries
remove_filter( ‘posts_where’, ‘last_thirty_days’ );

?>[/php]