Having recently built a custom WordPress theme making use of the icon font Font Awesome, I came across an issue where the icon tag would be stripped from the TinyMCE editor.
Using the standard markup provided on the Font Awesome pages (Gamepad), the tag would be removed when alternating between Text and Visual editing mode.
<i class="fa fa-gamepad"> fa-gamepad
Continue reading “Prevent WordPress TinyMCE Editor removing Font Awesome tags”
If you are like myself and have an alternative or shorter domain name that you would prefer to use for the built-in WordPress URL shortening service, then this may just be the perfect plugin for you.
The Custom Shortlink Domain plugin was committed to the WordPress Plugin Directory today (2012-04-07) and provides the ability to override the domain name used. Continue reading “WordPress Custom Shortlink Domain Plugin”
Although it is fairly uncommon to be adding AJAX functionality to your WordPress plugins, it can be necessary for it to be added. Luckily it is quite easy and straight forward to integrate the required components as and when they are required.
To help explain how this can be achieved, we will be creating a plugin called “Ajax Example“, stored in the folder “ajax-example” inside the plugin directory of your WordPress install.
Continue reading “Using front-end AJAX requests in your WordPress plugins”
When you activate a plugin via the WordPress admin panel it calls the action hook “activated_plugin“, which updates the “active_plugins” site option stored in the database to determine which plugins your site should load.
The option value is a serialized array of the active plugins saved in alphabetical order according to the plugin directory and file name, for example:
Continue reading “Forcing a WordPress plugin to be loaded before all other plugins”
Adding custom columns to the WordPress admin pages is fairly easy, however not all the filters available to you are displayed on Plugin API Filter Reference page. The following article will take you through the process of adding additional columns to the comments admin page using two undocumented filters.
If you are not a plugin author intending to use this functionality within a plugin, you should place the following code examples into your theme’s functions.php file.
Continue reading “Adding custom columns to the WordPress comments admin page”
Styling different pages in WordPress is a relatively easy process if you make use of the default body classes that are made available to you, especially the unique page ID class “page-id-123“.
The problem with using the ID class to identify an individual page is that a page ID can quite easily change when working with a development version or even migrating your blog from one install to another. Continue reading “WordPress append page slug to body class”
Although the WordPress Admin Bar can be hidden by a user visiting their profile page in the Admin Panel (Users > Your Profile), there may be a situation where you want to force the removal without instructing the user to amend their settings or updating their settings automatically.
When the issue of removing the Admin Bar first cropped up, the solution was to remove the associated init action, however this is not the correct method of disabling it and should not be used. Continue reading “How to remove the Admin Bar in WordPress 3.1 correctly”
When inserting images into post or page content WordPress automatically adds three class name to the image tag along with the other attributes, these are the alignment (alignnone), size (size-full) and the attachment id (wp-image-123).
If you need to add additional class names to the defaults without having to manually add them every time you insert a new image, you can make use of either the get_image_tag_class or get_image_tag filters. Continue reading “WordPress append image dimensions as class names”
If you are a theme or plugin author, you may require additional functionality to allow for additional page content to be added, managed and displayed.
One way this can be achieved, without resorting to custom page meta inputs, is to simply enable support for excerpts on pages. Continue reading “How to enable excerpts for pages in WordPress”
If you make use of some basic mark-up in your WordPress page content, you may have encountered an issue where <br /> tags are appearing where they shouldn’t and are affecting your theme layout.
To prevent this happening but leave the auto conversion of double line-breaks into paragraph tags, I had a dig into the wpautop function that runs before the content is outputted to the screen. Continue reading “WordPress: Prevent auto tags in page content”