WordPress Themes, Plugins, Tutorials, Tips And More...

Tag: Usability

Simple Tweaks To Enhance WordPress Shortcode Usability

WordPress

Although WordPress shortcodes haven’t disappointed website administrators in terms of rendering complete control over the site’s content and positioning, we have some unexplored options for pacing up their usability. This tutorial speaks about some easy-to-follow steps that can be implemented for making the most of shortcodes in WordPress. Here’s hoping by the end of this tutorial, you’d have unleashed the hidden potential of WP shortcodes.

Let’s take a quick look at WordPress shortcodes

Introduced in WordPress version 2.5, WordPress shortcode API is basically a simple set of functions that allows you to publish dynamic content with the help of macros. One of the greatest advantages of using shortcodes is that you can create exclusive content types including content generators, forms etc. without the need for any kind of programming skills. For example, below is the WordPress shortcode that can be used for adding a photo gallery into a web page:

In addition to above shortcode, there is also an API which handles all the confusing parsing, freeing you from the hassles of writing a bespoke regular expression for each individual WordPress shortcode. Rendering support for self-closing and enclosing shortcodes, this API also includes certain helper functions for moderating the settings and other default attributes.

A brief on working of WordPress shortcodes

Each time a specific shortcode is being inserted into a WordPress blog post/page, the same is replaced by a different piece of content. To put it simply, we are asking WordPress to detect the macro that is included within the square brackets([]) followed by replacing the same with a suitable dynamic content that has been generated by the PHP function. For instance, if you want to display the most recent blog posts, you can use the following shortcode:

[recent- posts]

As an extension to the above shortcode, you can even opt for displaying a specific number of recent blog posts by using the following shortcode:

[recent- posts posts=”10”]

Now, some simple tweaks that can improve WordPress shortcode usability

  1. Pay attention to usage of a flawless widget interface

One of the best approaches for enhancing the usability of WordPress shortcodes is having a perfect widget interface in place. By adding widgets into your web pages, you can conveniently split the content into several blocks and include individual functionality for each one of them. That means, the forms displayed after incorporation of widgets can be filled up with anything that you intend to add into the site’s content. You are free to use checkboxes, textboxes, dropdowns in your shortcode attributes.

  1. Use Filters for adding content to a shortcode

You can start off by using the pu_shortcode_button filter for adding dynamic content to the shortcode dropdown. This filter fetches a specific parameter of the array and works well on all the other shortcodes. Here, you need to ensure that the key of the array is exactly similar to the text that is displayed on the shortcode dropdown.

  1. Add buttons directly to the TinyMCE interface

If you are working with a couple of shortcodes, then it is easy for you to remember their names. But, if you’re working with several shortcodes, then remembering each one individually becomes a daunting task. In order to eliminate this, you can opt for adding buttons to the TinyMCE interface. As the first step in this process, you need to add the dropdown to TinyMCE content editor. Doing this will display a detailed list of shortcodes included within the post/page. You can use the mce_buttons filter for adding a new button to the TinyMCE editor. Further, to add multiple buttons, you can simply opt for adding new elements to the end of $buttons array. This will lead to returning of the entire array and you can simply click on the respective button(s) to get the job done. The code snippet involved with this process is shown below:

  1. Define new filters for including specific type of shortcodes

WordPress offers you the convenience of extending the existing code functionality via actions or filters. While actions allow you to add new code functions, filters enable you to pass in parameters, moderate the site’s content and a lot more. Although WordPress comes equipped with a wide range of actions and filters, you can opt for defining your own for use at specific locations within the WordPress website. Below is the code snippet that allows you to use a unique filter for adding new tags to the existing shortcode dropdown:

In the above code, the function apply_filters() instructs WordPress to run all the functions that already exist within the filter. This code allows you to add specific elements to the shortcode tags array which can further be utilized for building a new dropdown menu.

Conclusion

In a nutshell, I would like to say that adhering to the aforementioned tricks can definitely allow you to make the most of your WordPress shortcodes. Have you tried any other technique of boosting the usability of WP shortcodes? If yes, don’t forget to share its details using the comments section provided right under this post.

Best WordPress Plugins For SEO And Usability

Once you done with installing the WordPress and includes all basic functionality to improve your site, it’s highly require to go more into depth and understand that what your WordPress site demands more in terms of both SEO and usability. You do find many of plugins out there which may helps you out in one-to-many ways, but still unless and until you heard from something well in front you too get confused easily with which one to go for. Here, with this article, you will find best WordPress plugins for SEO and usability which are available for free.

WordPress

Lightbox Plus ColorBox

The plugin implements ColorBox as a lightbox image overlay tool for WordPress. It permits users to view larger versions of images without having to leave the page on which they are at the moment. The plugin able to add easily to WordPress gallery images, display simple slide shows, video, forms and external content in overlays.

More Info | Download

Use Google Libraries

The plugin allows your WordPress site to use the content distribution network side of Google’s AJAX Library API, instead of serving these files from your WordPress install directly.

More Info | Download

Simple URLs

The plugin works as a complete URL management system which allows you to create, manage and track outbound links from your site by using custom post types and 301 redirects.

More Info | Download

Widget Logic

The plugin works as an extra backbone for every widget in use, giving an extra control field called as the “Widget logic.” The plugin lets you control the pages which the widget will appear on; letting you use WP’s Conditional Tags or any general PHP code.

More Info | Download

RB Internal Links

Although the plugin has not been maintained from over 2 years now, but still it’s worth a shot to try and use for your WordPress site. The plugin lets you link to posts and pages within your blog using shortcodes, which are similar to a wiki or a CMS with a best part is not to remember full URLs, post ids or slugs with the WYSIWYG.

More Info | Download

Members

The plugin provides an extended support that let you give you control over your blog. In short it’s a user, role and content management plugin which was built to make your WordPress a more powerful CMS.

More Info | Download

WordPress SEO by Yoast

The plugin lets you improve your WordPress SEO by having a fully optimized WordPress site using the WordPress SEO plugin by Yoast. The plugin is one of the best WordPress plugin ever created.

More Info | Download

W3 Total Cache

The plugin allows you to have an easy Web Performance Optimization (WPO) using caching: browser, page, object, database, minify and content delivery network support.

More Info | Download

Also See: WP Super Cache Vs W3 Total Cache – Which One You Choose?

NextGEN Gallery

The plugin provides a powerful engine for uploading and managing galleries of images, with the ability to batch upload, import Meta data, add/delete/rearrange/sort images, edit thumbnails, group galleries into albums.

Not only this, but it also provides two front-end display styles (slideshows and thumbnail galleries), both of which come with a wide array of options for controlling size, style, timing, transitions, controls, lightbox effects.

More Info | Download

Photo Credit: Flickr/OFFICIAL LEWEB PHOTOS

Powered by WordPress & Theme by Anders Norén