Document Feedback for WordPress

Most large knowledge databases online provide a large amount of articles ending with a small text block: "Was this resource helpful?", which is pretty handy for site owners to decide on most and least valuable posts. Since WordPress is a CMS heavily focused on blogging and content creation, the new Document Feedback plugin is the solution to these problems in the WordPress context. Daniel Bachhuber from Automattic had this plugin started and I realized that had been a missing functionality in the overall plugin repository at the moment. I was lucky to get several commits of mine into the plugin… Continue Reading

Including scripts and styles properly

Since this has been a discussed topic over support forums and IRC this week, a very quick scripts and style guide for WordPress. The function for including a stylesheet is wp_enqueue_style: [php]wp_enqueue_style( $handle, $src, $deps, $ver, $media );[/php] You can define the handle for the style (as a reference for other styles later), the location, dependent styles (when you need a style to be loaded after other styles), it's version if needed and the type of stylesheet (all, print, screen, handheld) Each script is included via wp_enqueue_script: [php]wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer );[/php] The first four arguments are identical,… Continue Reading

Overcome the WordPress Autosave Limitations

WordPress includes a handy feature called 'autosave' that periodically persists an autosave version of a post at the moment of writing. Since accidents happen, it's always good to have some recent version of a long text instead of starting from scratch when you don't have the proper backup. Autosave is handy, but since WordPress is no longer 'yet another blogging platform', it lacks important extensions to that feature. When you work with custom post types (or even plain old posts and pages), you might need to alter the standard save behavior. Therefore you take advantage of the save_post hook. Then… Continue Reading

Add a TinyMCE button to WordPress post editor

Most themes and large plugin utilize the WordPress Shortcode API by adding code snippets that could be parsed inside of a page or post. One of the handy ways to present a UI behavior for your customers is by embedding the functionality to the TinyMCE editor as an extra button. You need to create two files and embed them in your theme/plugin or create an extra piece of code (say, via another plugin) to trigger this behavior. The first file should be the JavaScript logic behind the button (as TinyMCE interaction is entirely JS-driven) and the second one is the… Continue Reading

DX Plugin Base v.1.1 released

I've released a major update of my DX Plugin Base plugin which servers as a skeleton for WordPress plugin creation. Some of the old code has been refactored and simplified and a few new features have been added as well. Currently the list of code snippets working and included in the sample plugin base is: custom post types and taxonomies setup sample admin menu and subpage example of the Settings API in the admin pages - creating 2 options with a validation hooked function for further use registration of activate/deactivate hooks adding 2 metaboxes on pages - on the right… Continue Reading

swpMVC – WordPress Rails-alike framework

Just noticed on Twitter this one: [blackbirdpie url="https://twitter.com/dimensionmedia/statuses/239848270657118208"] I'm very fond of more abstract development practices and a good MVC modeling with ActiveRecord has always been a pleasure to see. Since WP itself has too much procedural programming with global variables, this one as a concept looks very neat. I don't believe it would have any influence at all for the core or for smaller plugins, but at least could be a great start for a larger plugin (some eCommerce or real estate framework). Continue Reading

Plugin Base Skeleton

I got tired working on plugins and writing the same code snippets all over again, looking in the same old tutorial sites or my favorite WP 3 Plugin Dev book. So I released a startup script for plugins - http://wordpress.org/extend/plugins/dx-plugin-base/ . It contains most of the important snippets required for every plugin - registration of custom post types or taxonomies, registering activation and deactivation hooks, admin pages, metaboxes. I'm going to add widget/shortcode registration with some samples. This would make it easier to use it as a new plugin startup script and save some time about it. I also brainstorm on the… Continue Reading