Author: Chris Coyier
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 with WordPress at the root through some simple settings. But just because WordPress is installed and controlling your site from the root, doesn't mean that the WordPress core files need to be located at the root.
On blogs that like to share snippets of code like this one, it is common to use the <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.
There are probably a couple ways to do this, but here is a really easy one:
ob_start(); the_content(); $content = ob_get_clean();
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.
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.
quicktags.js in the
A big thanks to everyone for being supportive of the launch the website launch for Digging into WordPress. As 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 (404 link removed 2012/12/29) (as part of this review), and a little additional coding again my myself.
Welcome everyone! Jeff and I are very excited to finally have this site launched. This site is going to serve as an outlet for us both to share WordPress related articles, be it news, tips and tricks, best practices, in-depth explanations, new plugins, reviews, and anything else WordPress related! Feel free to explore the archives already, there are a few good ones in there already. We have plenty of stuff lined up too, but right away we'd like to ask:
Just minutes ago, WordPress Version 2.8 was released! As usual, there are a ton of new features, although much of it affects developers and back-end types more than it does designers or casual bloggers/users of the Admin area.
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> 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?
There are many reasons you might want to get a unique ID for your
<body></body> tag. Let's say you want your header elements to be a different color on your About page, you could apply a bit of CSS via your theme's stylesheet (i.e.,
style.css). For example, you could target the About page with something like this:
Many footers on websites contain text like "© 2009 Your Website". A good measure, surely. We can use some classic PHP and a built-in WordPress function to make this bit of text dynamic so that it will never need to be tampered with manually again. Here is the code to add to your theme template file (e.g.,
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed,
commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis.