Like the blog? Get the book »

Author Profile: Chris Coyier

Display a Random Post (with AJAX Refresh)

Display a Random Post (with AJAX Refresh)

I think you'll be surprised at how ridiculously easy this is. We are going to leverage some serious smartness from both WordPress and from the JavaScript library jQuery.

Move Your WordPress Files Out of the Root Directory

Move Your WordPress Files Out of the Root Directory

I usually recommend that people install WordPress at the root directory of their sites. Even if you intend to mostly use WordPress for a blog, and run it at /blog/, you can still do that when WordPress is installed in the root directory. It's just a matter of changing some simple settings. But just because WordPress is installed and controlling your site from the root directory, that doesn't mean that the WordPress core files need to be located in that same location.

Making an Expanding Code Box

Making an Expanding Code Box

On blogs that like to share snippets of code like this one, it is common to use the <pre></pre> tag to wrap the code so that the spacing/indenting is maintained and long lines do not wrap. While this is desirable behavior, it can be undesirable to have those un-wrapped lines break out of their containers awkwardly and overlap other content.

Putting the_content() into a PHP Variable

Putting the_content() into a PHP Variable

There are probably a couple ways to do this, but here is a really easy one:

ob_start();
the_content();
$content = ob_get_clean();
Spam Link Injection Hacked (and How I Hopefully Fixed It)

Spam Link Injection Hacked (and How I Hopefully Fixed It)

Just recently my other blog CSS-Tricks was hacked. I first found out by a very helpful reader emailing me a screenshot from the mobile version of my site.

Use Google-Hosted JavaScript Libraries (…still the Right Way)

Use Google-Hosted JavaScript Libraries (…still the Right Way)

I previously posted on how to include jQuery in your WordPress theme the Right Way. That is, to use the wp_register_script function to register the script first. It's literally a one-liner in your header.php or functions.php file, but by default, it loads the internal version of jQuery that ships with WordPress.

Free Theme: WP Typo

Free Theme: WP Typo

A big thanks to everyone for being supportive of the website launch for Digging Into WordPress. As a way of saying thank you, and to celebrate our launch, I'd like to present to you a brand new free WordPress theme for you to download. It's called WP Typo. You can view the demo here and download the theme here. It was designed by myself, then coded through WP Coder (as part of this review), and a little additional coding again my myself.

Including jQuery in WordPress (The Right Way)

Including jQuery in WordPress (The Right Way)

If you want, you can just download jQuery, put it on your server and link to it from your header.php file in the <head></head> section. But that can cause you grief. For one thing, some plugins use the jQuery library, and they are going to load it as well. This can cause problems. How was your plugin to know you already had it loaded?

Advertise Here

Sign up for the newsletter!

Never spam, only good stuff

Recent posts

Loading...

Random posts

Loading...
© 2009–2017 Digging Into WordPress Powered by WordPress Monzilla Media shapeSpace