WP-Mix

A fresh mix of code snippets and tutorials

Category Archive: HTML

Posts about HTML

Page 1 of 2

Vanilla JavaScript: Focus Input on Page Load

Super quick tutorial today. How to focus the user on any input when the page loads. For example, when you visit the WordPress Login Page, the “Username” field is focused automatically. This technique is very simple and works on any input or element that supports a focused state.

WordPress: Simple Image Upload with jQuery

Some of my free WordPress plugins enable users to select and upload files from their local machine. The uploaded images are handled by WordPress and added to the Media Library. The technique is very basic and easy to implement, requiring only a few snippets added to your WordPress site.

HTML5 Starter Template

Ahh yeah, HTML starter templates at your service..

Disable manual resizing with meta viewport

Just a quick snippet for telling the browser to disable manual resizing of the page. You can see this technique in use here at WP-Mix as well as most of my other websites. If you view the source code of any web page on the site, you can see the meta viewport tag in effect […]

Fix double abbr underlines

The developers at Firefox decided to add their own default styles for <abbr></abbr> and <acronym></acronym> tags — completely ignoring the fact that many sites already include their own styles for abbreviations and acronyms. The result is an ugly double underline and/or text-decoration in Firefox browsers.

Disable caching with HTML

If you can’t use .htaccess to disable caching at the server-level, here is an alternate HTML-only method that disables Cache-Control, Pragma, and Expires headers via <meta /> tags.

jQuery Auto Resize Multiple Textareas

The User Notes Widget that’s included in my Dashboard Widgets Suite plugin enables users to edit notes right on the WP Dashboard. To make things extra awesome, each note automatically expands as the user types more lines of text. This post explains how I achieved this trick, aka multiple auto-resize textareas.

Replace contenteditable with textarea

Working on my WordPress plugin, Dashboard Widgets Suite, I needed a solid way of replacing contenteditable with a textarea on form submit. Here is a simple solution along with some bonus notes on dealing with certain HTML tags.

WordPress Basic Allowed HTML for wp_kses

Here is a function that I use in my plugin, Dashboard Widgets Suite. It provides a sane, practical set of HTML tags and attributes for WP’s wp_kses family of functions.

Add Facebook OG Attributes to HTML Tag

When adding Facebook Open Graph (OG) tags to your web pages, it is a good idea to add the required attributes to the <html></html> tag. Here is one way of doing it.

Disable Pinterest on Your Pages

Pinterest is a social-media service that people can use to collect your site’s images. The Pinterest browser extension and app add a “Pin it” (or whatever) button to the images that are included on your web pages. That way users can just click a button to add your images to their account on Pinterest. Fortunately, […]

Share links without sending referrer information

Here is a quick tip for sending links without including any referrer information. I found this service used at WordPress.com.