Hide the WordPress Editor menu from the dashboard

As of WordPress 3.4.2, the Editor sub-menu under Appearance will give you access to your theme files. I forget it’s there, usually. Today I realized I had reason to want to lock it up.

Why?
Security. Your editor is a gateway for hackers and other unkind folk. Lock that thing up.

How?
So easy. So, so easy. Add this to your functions.php:

function remove_editor_menu() {
  remove_action('admin_menu', '_add_themes_utility_last', 101);
}
add_action('_admin_menu', 'remove_editor_menu', 1);

Done.

Wwwowie zowie. Be happy.

Adding stylesheets and js to WordPress

Sometimes you want to call a separate css stylesheet, or more importantly, extra js libraries you might be using for special functionality in your theme. To do this, add the following bit of code to your functions.php file


/**
* Register with hook 'wp_enqueue_scripts', which can be used for front end CSS and JavaScript
*/
add_action( 'wp_enqueue_scripts', 'stylesheets' );
add_action( 'wp_enqueue_scripts', 'scripts' );


/**
* Enqueue stylesheets
* In this case, I'm including a stylesheet for FlexSlider.
* When you view the source of your rendered site, you'll see the stylesheet with id='flexslider-css'
*/
function stylesheets() {
wp_register_style( 'flexslider-css', get_template_directory_uri() .'/flexslider.css' );
wp_enqueue_style( 'flexslider-css' );
}


/**
* Enqueue scripts
* ... and here I'm including the js for FlexSlider.
*/
function scripts() {
wp_register_script( 'flexslider-js', get_template_directory_uri() .'/jquery.flexslider.js' );
wp_enqueue_script( 'flexslider-js' );
}

Image Alt Tags

Email showing alt image tagsIf I had a quarter for every website I inherited from a previous developer that had missing alt tags, I probably would be able to afford a posse of minions to serve me chocolate and coffee right now. Needless to say, I am without coffee and chocolate, minions, or a posse.

What are alt tags?

Very simply, alt tags hold text (or ‘alternate’) representations of the image. Well, you’re thinking, why on earth would one ever need THAT?

Alt tags are used for visually impaired visitors, who might use a screen reader.

In Internet Explorer (one gold star for them, at least), alt tags are used as a sort of tool-tip when you hover over an image that is inside a link tag. This might be helpful even for those that can see the image.

You can use alt tags to help improve your SEO. Especially if you’re sporting a big image that’s an important part of the page, you’ll want to be sure to say that this big blob of space that’s being hoarded by an image is actually something very relevant to your website. By using the alt tag, you help search engine spiders to understand that this space you’re filling with an image is relevant to your site content.

Image alt tags are also visible in cases where images don’t load. Maybe a user has a slow internet connection, or maybe you accidentally deleted the photo the image is linked to. If you’re sending out an email with an image in it, be forewarned – email clients today will generally ask your permission before loading images for security purposes. Before your recipient grants that permission, they’re only seeing the image alt tags.

Imagine my surprise today when I noticed the email that I knew to be legitimately from my credit card company was sending me a ‘Phishing Email’! Whoa. Block? Report? Delete? What negative repercussions such an image alt tag could have.

Where does the alt tag go?
The image alt tag should be inside the <img> tag, like this:

<img src=”../images/hobbit.jpg” alt=”The Hobbit” height=”300″ width=”300″>

If you want to be really meticulous about your code, the syntax inside the tag should be alphabetical, in other words, you would write your image tag like this:

<img alt=”The Hobbit” height=”300″ src=”../images/hobbit.jpg” width=”300″>

As meticulous as I can be with my code, this is too meticulous even for me. Practically speaking, I write image tags as they logically enter my head – source first (src), then alt, then height and width. It slows the browser down by the smallest micron of time when rendering, but I cherish my sanity much more than my browsers, so this is my method.

PHP curly braces crashing my Dreamweaver

Really, really hate that. I’m in the middle of a project, no coffee, trying to focus…and the software I take for granted fails on me. Every time I tried to type the next curly brace { my dreamweaver would break. argh.

I thought it was a case of a file size bug, and added a bunch of blank lines. Alas, crash, crash, crash…  After googling the issue, I found this saving technique.

Find your cache file, named soemthing like ‘WinFileCache-4DD32B57′. On Windows 7, it’s located in:
(C:Users[your user folder]AppDataAdobeDreamweaver 9Configuration)

Delete that bad boy, restart Dreamweaver, and curly brace your heart out. Shazam!

Want SEO, will Blog

So you purchased the perfect domain name, hired the designer, spent time going over mockups and working with your provider to get the look of your new site just right. You’ve finalized the design, and now the e-dust has settled just a bit with website completion, upload, launch, and grand opening announcements. You’ve paid your web designer and have your product and contact information published on a beautiful site on the web. Your meta tags are all in place and your pages are full of content-relevant keywords. You’ve submitted your site to be indexed by the search engines, but you’re sipping morning coffee and itching to do something more to promote your site. So now what?

Blogs are a terrific way to super-charge your website’s SEO rankings. Search engine spiders eat blogs alive (eww) because they’re constantly refreshed with new content. Spiders will visit your site more often when they detect content is changing more frequently. Content-relevant keywords will also help improve SEO. If you sell imported Italian silk ties, your blog entries about poodle grooming will probably not help your conversion rate! Blogs that contain keywords relevant to the main site’s content, with high keyword density, have a better chance of ranking higher on search engines.

Blogs are like Veggies…well, kinda.

Let’s face it – It’s not always easy to write fresh content daily, or several times a week. The web is full of articles – would it hurt to ‘borrow’ one every once in a while, you ask, through fluttering eyelashes? YES! Duplicate content can hurt your SEO ranking on search engines. Fresh, original, content relevant content is best. If you don’t have time, or just aren’t a natural writer, consider hiring a freelancer to write articles for you. Expect to pay about $20-$30 per article, for quality writing. You can pay less, but expect to receive articles that are either copied and modified (if you’re lucky), or written by someone who doesn’t have a very good command of the English language.

The title of your blog is important! Think of it as a headline that will pull your readers in, but also make sure that your blog titles are getting archived. We use WordPress for our blog, and have it set up to poll both category name as well as blog entry title for the link, because when it’s indexed by a search engine, our keywords are more relevant than post1, post2 or other meaningless auto-generated links the blog gives entries.

Please allow a self-serving plug here when I say if you’re unsure how to set up a blog, hire someone (okay, us) to do it for you. If you need some help with content, hire a quality writer to write some entries for you. There are so many benefits to blogging, that the cost to set one up will be worth it’s weight in gold ten times over if done properly.