Tag: plugin

HTML Demos

I posted a video a few weeks ago of a plugin I was working on to manage HTML demos in WordPress. I’m publishing the code now as version 0.1 — meaning it works, you should feel safe about using it, but it’s not finished. For example, I just realized that the only Javascript library you can include on your page is jQuery.

I think it would be cool to be able to have options to do some post-processing. So, maybe Markdown and HAML for HTML. Obviously SASS and Less for CSS — maybe Stylus? CoffeeScript for Javascript would be nice.

One other thing that I think would be really awesome is if you could associate a demo to a post somehow. Then I could add some extra template tags like the_demo_link(), which would automatically grab the link to the demo for that post. Or maybe another tag that would automatically grab the link for the associated post? Anyway there’s a lot we can do with this.

It’s on Github. I’d love to take pull requests, or any bug reports filed through the issues tracker.


Lots of web people have some way of hosting demos on their site. The one I always think of is CSS-Tricks, but there are many others. I’ve actually done it in the past on my site, but no matter how easy I made it for myself, it was always too hard so I just never used it. But that’s dumb because I publish everything else around here with WordPress and WordPress is really good at keeping track of stuff like this. So I decided to create a custom post type for HTML demos inside WordPress.


The plugin is actually smart enough to insert the HTML after the_content(), which is cool. The styles and scripts are enqueued into the header through external files that the plugin also generates. Bottom line, this should work out of the box with any theme.

If you want to customize how your demos look though, it’s pretty easy. Just add a single-html_demos.php file to your theme and WordPress will use that to generate those pages. So, just like you would customize any other template, you can customize the template for your demos.

View in Plugin Directory Download on Github

Roots Hide WP

Theme author, Ben Word, has been working for some time on Roots: “a starting WordPress theme based on HTML5 Boilerplate & Bootstrap from Twitter.” Back in November, Word wrote an article about how they’re hiding the fact that the theme is powered by WordPress.

In the Roots theme we’re taking several steps to ensure that a visitor to your website won’t know that you’re using WordPress

They do some interesting things, including rewriting URLs to theme assets & plugins to hide the wp-content directory and rewriting URLs to root-relative addresses. Additionally there’s a “walker” class for custom navigation menus, so you could do something like:

wp_nav_menu(array('theme_location' => 'primary_navigation', 'walker' => new roots_nav_walker()));

I’m offering it here as a plugin with some minor changes. Word’s original post is code directly from the Roots theme which is meant to “hide” the fact that a site is running on WordPress. That’s fine for them. I didn’t want to make any decisions about where the assets folder should be for an unsuspecting person who may have been using WordPress for some time. Cleaning wp_head sounds good in practice and I’m sure there’s some stuff in there that most people don’t need, but there’s a reason it got so messy in the first place. I’m still doing a bit of cleaning there, the scripts to make tagging word in Windows Live Writer will be removed along with the wp_generator script that writes out the WordPress version to a meta tag — it’s considered to be a security risk to let people know your WordPress version.

View in Plugin Directory Download on Github

Network Favicons

Network Favicons is a simple WordPress plugin that allows blog owners on a multisite network to upload a favicon to the root of their theme’s directory and have automatically be used as the site’s favicon. This requires a one-to-one relationship between blogs and themes, but that could be as simple as creating a child theme for the favicon if you’re already using the same theme on multiple blogs.

I made the theme for my new hosting network, network.joshbetz.com. This is where I’ll be hosting future client websites and I needed the ability to use custom favicons instead of just having my own favicon displayed on every blog.

Note: If no theme is available in a theme’s directory, the site still just use the default one provided at the domain’s root.

View in Plugin Directory Download on Github

JB Shortener

Almost two years ago I wrote about a new short URL system I started using on this blog. I’m finally releasing this in plugin form with a few additional improvements. WordPress has support for “short urls” built in and will even let you use the wp.me system if you have the Jetpack plugin installed. Instead of using wp.me, I like using my own custom domain. This plugin gives you an option to set the short domain that you’d like to use and includes the helper files to install on the short domain.

Problems Getting WordPress Emails

Are you having problems getting email sent from you WordPress blog?

One of the features that I really like is being able to get emails when new comments are posted. I also use the Contact Form 7 plugin which needs to send mail.

The Problem

I recently switched web hosts to Webfaction. They’ve been great — what I think you should be able to expect out of shared hosting.  The only problem is that they don’t support PHP’s mail function. They claim it’s to reduce spam — mail() can be used to send email defining the from address as whatever you want without having to authenticate. It can be very convenient, but it’s really not the ideal way to send mail using PHP anyway. WordPress does it because it’s pretty rare to find a server that doesn’t support it and the alternatives are too commonly uninstalled.