Newer posts are loading.
You are at the newest post.
Click here to check if anything new just came in.

February 24 2014

14:00

February 06 2014

06:01

10 Free Parental Control Plugins For Chrome And Firefox

If you want to block some websites that you do not want your children to access then use these Parental control plugins for the Google Chrome. The meaning of Parental control is “to have a control on the web content that you would like to see or hide”. With this Parental control you can easily hide or block your unwanted contents on web. In the twenty first century you can easily access almost everything through internet at anywhere. So these parental control plugins will help you in this case.

In this post, we are presenting 10 free and amazing parental control plugins for the Google Chrome and Firefox. All these Parental control plugins will provide you the full control on the web content. Have a look at these Parental control plugins and download your favorite one which suite your requirement.

Parental Control App

Parental Control App is a Free extension that enables safe browsing on the web. PC app makes sure your children practice safe browsing.

TinyFilter

The tinyFilter extension is a tiny Web content filtering tool. As any other content filter, it uses predefined rules to filter a variety of Web sites. Additionally, tinyFilter provides a profanity filter to mask words that may be offensive to the user.

Nanny for Google Chrome

Nanny for Google Chrome allows you to be more productive and less distracted by blocking sites.

WebFilter Pro

Cloudacl WebFilter is cloud based content filtering application which monitoring several million websites and billion of web pages to keep you family especially your kids have a safer internet surfing environment.

Website Blocker

Website Blocker is useful when you want to concentrate on work.

Blocksi

Web Filter and Parental Control application. Protects your employees, students and family from inappropriate content.

BlockSite

BlockSite is an extension, which automagically blocks websites of your choice. Additionally, this extension will disable all hyperlinks to these websites, by just displaying the link text without the clicking functionality.

FoxFilter

FoxFilter is a personal content filter that helps block pornographic and other inappropriate content. All filtering features are free! Premium features available with small support fee.

Anti-Porn Pro

Cloudacl WebFilter is cloud based porn content filtering application monitoring millions web sites and billion of web pages to keep you family especially your kids away from sex, nudity and adult content.

ProCon Latte Content Filter

LeechBlock is a simple productivity tool designed to block those time-wasting sites that can suck the life out of your working day. All you need to do is specify which sites to block and when to block them.

January 08 2014

15:02

40 Best Responsive WordPress Free Plugins

Do you want to impress mobile surfers or want to create an awesome responsive website? If your answer is “yes” then use these new responsive WordPress plugins. In this post, we are showcasing 40 wonderful responsive WordPress Plugins for you. Without breaking the layout on mobile devices now you can easily and safely add new features to your responsive WordPress website with responsive WordPress plugins. In this post, you will find different categorizes of plugins like Short codes and Page Builders, images and video, sliders, menus, forms and other.

With these WordPress plugins you can make your website more stunning and eye-catching that gives mobile visitors an awesome and superb experience. Grab this amazing chance and start browsing through this fresh collection. Check this out and get to pick one and do not forget to share your precious opinion with us via comment section below. Your comments are always more than welcome. Have fun!!!!

Wapple Architect Mobile Plugin

( Download )

Wapple Architect Mobile Plugin for WordPress is a plugin that allows you to mobilize your blog in minutes.

WP Fluid Images

( Download )

WP Fluid Images replaces the fixed width and height attributes so your images resize in a fluid or responsive design.

WordPress Mobile Pack

( Download )

The WordPress Mobile Pack is a complete toolkit to help mobilize your WordPress site. It has a mobile switcher, themes, widgets, and mobile admin panel.

Juiz Smart Mobile Admin

( Download )

Used with the default administration theme, this plugin offers you a smartphone support for your dashboard.

Responsive TwentyTen

( Download )

Makes your TwentyTen themed site have a responsive and fluid layout.

Ultimate Coming Soon Page

( Download )

Creates a Coming Soon page or Launch page for your Website while it’s under construction and collects emails from your visitors.

FitVids for WordPress

( Download )

This plugin makes videos responsive using the FitVids jQuery plugin on WordPress.

WP Orbit Slider

( Download )

WP Orbit Slider is a jQuery slider that uses custom post type and taxonomies. Oh, its also responsive!

WP Mobile Detector

( Download )

The WP Mobile Detector automatically detects over 5,000 mobile devices and displays a compatible mobile theme.

Juiz Smart Mobile Admin

( Download )

Used with the default administration theme, this plugin offers you a smartphone support for your dashboard.

GPP Shortcodes

( Download )

GPP Shortcodes is a free WordPress plugin that allows you to easily add “flat design” buttons, boxes, icons, pricing tables, tabs, toggles and column layouts in your posts and pages without modifying CSS, HTML or PHP.

Responsive Plugin

( Download )

Convert any theme into responsive theme.

Simple Responsive Images

( Download )

Add the possibility for site to have it content images responsive.

Symple Shortcodes Free WordPress Shortcodes

( Download )

Tired of using a theme with built-in shortcodes, switching themes and then losing all your awesome styles? No worries, this is why I’ve created the Symple Shortcodes plugin! Now you can add buttons, highlights, boxes, toggles, tabs, pricing tables…among other awesomeness and take them with you no matter what theme you decide to use.

PB Responsive Images

( Download )

Adds support for the proposed responsive image format in post content, and helper functions for theme authors.

Advanced Responsive Video Embedder

( Download )

Embed videos with a click of a button from many providers with full responsive sizes. Show videos as thumbnails and let them open in colorbox.

Style My Gallery

( Download )

Style galleries using popular scripts – currently only FlexSlider. Supports multiple galleries per page.

Vixy YouTube Embed and Download

( Download )

A simple method of embedding YouTube videos (with download links) into your pages. Easy to use, but with powerful features for those that need them.

Responsive Video Embeds

( Download )

Automatically resize WordPress auto-embeds, including video and other iframes, in a responsive fashion.

Meta Slider

( Download )

4 sliders in 1! Choose from Nivo Slider, Flex Slider, Coin Slider or Responsive Slides.

Meteor Slides

( Download )

Easily create responsive slideshows with WordPress that are mobile friendly and simple to customize.

WP Parallax Content Slider

( Download )

A customizable JQuery content slider with CSS3 animations and parallax effects.

WOW Slider

( Download )

Add beautiful image slider to your WordPress blog! Awesome effects, fancy templates, point-and-click wizard. Fully responsive, pure CSS fallback.

Portfolio Slideshow

( Download )

Add a clean, responsive javascript slideshow to your site. The slideshow integrates well into any design, supports fluid-width themes, and offers lots of options for power users, too.

Super Responsive Slider

( Download )

Plugin that lets you create a slider very easy and with spectacular results.

Smooth Slider

( Download )

Smooth Slider is a WordPress Plugin for creating a dynamic slideshow/s for featured Posts, Pages, Media Images and Custom Post Types on a WordPress site.

EasyRotator for WordPress

( Download )

Add beautiful, responsive EasyRotator photo rotators and sliders to your WordPress site in seconds.

Breezing Forms

( Download )

Professional form builder for beginners and experts. Create any kind of form you need. Powerful and flexible, yet easy to use.

Responsive Select Menu

( Download )

The Responsive Select Menu plugin automatically turns any WordPress 3 Menu into a select box / dropdown on mobile devices.

Responsive Page Tester

( Download )

Gives users with content creating permissions the ability to preview their site in a responsive testbed.

WEN’s Responsive Column Layout Shortcodes

( Download )

This WordPress plugin gives you an easy way to add columns to any section – page , post or other content.

Gmedia Gallery

( Download )

Manage files, show image galleries and photo slideshows, play music on your site Gmedia Gallery plugin. Gmedia Library provides a comprehensive interface for handling galleries, image and audio files.

Pricer Ninja

( Download )

A great tool for adding responsive pricing tables to your WordPress website.

Responsive Column Widgets

( Download )

Creates a custom responsive column widget box.

Oik nivo slider

( Download )

Shortcode for the jQuery Nivo slider; “The Most Awesome jQuery Image Slider”; reputed to be the world’s most popular jQuery image slider.

Flowplayer 5 for WordPress

( Download )

A HTML5 responsive video player plugin. From the makers of Flowplayer.

Royal Responsive Menu

( Download )

The Royal Responsive Menu plugin automatically turns any WordPress 3 Menu into a select box / dropdown on mobile devices.

Responsive WordPress Slider

( Download )

The best responsive WordPress slider plugin. Made lite and free.

Responsive 3D Slider

( Download )

The Morpheus responsive 3D slider is a new plugin for wordpress which to create sliders with galleries, presentations, infographics and many more.

SlideDeck 2 Lite Responsive Content Slider

( Download )

Create responsive content sliders on your WordPress blogging platform. Manage SlideDeck content and insert them into templates and posts.

November 26 2013

14:00

10+ WordPress Plugins to Boost Your Social and Organic Traffic

One of the best things about WordPress is the ability to extend the functionality of your WordPress installation with the use of plugins. You don’t have to mess around with the core files of WordPress since these plugins can easily achieve the same result and exist independent of the core WordPress files. At the time of writing this article there are over 27,000 plugins available via the official repository and many more in the form of premium WordPress plugins. I know how well the readers on 1stWebDesigner love their WordPress content, so I have decided to do a roundup of some of the very best WordPress plugins you can use on your site to attract more visitors via organic and social channels.

Put Your Best SEO Foot Forwardgetting the SEO basics covered

Social
Making sure you have a good permalink structure, adding a proper title and meta description for your posts, generating a valid sitemap, no-indexing pages you don’t want Google to show in the search result, having Google Authorship show up for your articles, and others are some of the things you would want your SEO plugin to handle, and thankfully there are quite a few WordPress plugins that will help you setup SEO on your WordPress site. There are many plugins out there that does very little or as much as you want when it comes to SEO, here are a few of them:

It’s important to have a sitemap for your website, this helps the search engines to discover content on your site. There are multiple sitemap options, if you use one of the plugins mentioned above you will get the option to generate a sitemap. Yoast has a video module that you can purchase to get video sitemaps, it also comes with Google+ Authorship, Web Master Tools verification and more. Premium SEO Pack offers a lot of additional features like integrated Google Analytics, monitor 404 pages, SEO slug optimizer, SEO friendly images, 301 link redirect, social stats, internal link generator, etc. So depending on which plugin you use you might not need to use these other plugins that can help you with SEO on your website.

  • Broken Link Checker – can be used to keep tabs on 404 pages and the plugin will send you an email. You can then go in and manually fix or redirect them.
  • SEO Friendly Images – If your images do not have the alt attribute, SEO Friendly Images will add them according the options you set.
  • Simple 301 Redirects – provides an easy way to add a 301 redirect for the posts, pages on your WordPress site. You can even set wildcard redirect rules using this plugin.
  • Automatic SEO Links – is quite useful to generate internal links from within your content. Set up your keywords and urls and the plugin will intelligently add the url to the keyword within your WordPress posts.

Content Optimizationbecause content is king

This is again something that some of the SEO plugins like Yoast and Premium SEO Pack can handle but if you need a standalone solution with specific set of features you might want to check out Scribe. It should be a good tool when you want to work on a content marketing strategy, it can help you with keyword research to finding good related content.

Related Contentyour users want MOAR

Related Post
Having related posts show up in your post is a great way to add some internal links to relevant content on your site. There are quite a few number of options on WordPress when it comes to related posts and here are a few of the best choices.

  • Zemanta Related Posts – Along with some great responsive related post layouts, this plugin offer stats about pageviews and clicks from the related content block.
  • SEO Auto Links & Related Posts – Like the Automatic SEO Links plugin this plugin can help you with internal links along with the ability to show related content to your visitors.
  • Outbrain – A related post plugin that comes with detailed stats, so you can see what related posts are working best for your content.
  • Yet Another Related Posts Plugin (YARPP) - Comes with a lot of features like cached related posts, adding related post in RSS feed , etc.

Time To Get Your Social Onincrease social sharing and audience

Social
Showing visitors your active social channels is a great way to get them to follow you. Most social networks has their own badges and buttons you can use to get this done but if you want to get something that stands out from the others you could try a plugin that lets you add social buttons to you site, Arqam – Retina Responsive WP Social Counter Plugin might be a good option if you have a responsive WordPress theme.

Premium SEO Pack and Yoast SEO plugin comes with the ability to add Facebook Meta data to your content. If you want to take it a step further and add support for Twitter Cards you can check out TCWP – Supercharged Twitter Card Management for WP. Do you want to allow your visitors to tweet out specific content from within your post? There is a plugin for that too.

One of my favorite social tool is Social Locker for WordPress. This plugin lets your visitors unlock content in exchange for a tweet, Facebook Share ( or like ) or Google + Share( or +1 ). I have had good success with it while used in moderation. You can see this plugin in action on a site that I run.

The Need For Speed – Improve the speed and performance of your website

The speed in which your website loads is one of the factors Google looks at when ranking a website and any webmaster can tell you how important it is to rank well in Google for your keywords. A faster website also means that your visitors don’t have to wait to see the content you offer. There are various options out there that you can use to speed up your WordPress installation. One of the best ways to do this is by using a caching plugin. This allows your content to be cached and you can serve them faster when there is a new request for that information.

Personally I have used W3 Total Cache in the past and can say it does a really good job (but there is a bit of learning curve to it and it needs to be set up properly).

Next up you could try minification of JavaScript and CSS on your site. There are multiple plugins you can use to achieve this. Personally I have stuck with W3 Total Cache which comes with JavaScript and CSS minify option, so in my case I didn’t use another plugin to get this done. If your preferred caching plugin does not have a minify option, then you can look into WP Minify, AssetsMinify or Better WordPress Minify.

Schema Microdatadon’t forget this in the grand scheme of things

Schema
Most major search engines have accepted schema.org microdata to better understand the content on a page and this enables them to show rich snippets in search results. There are various plugins that helps you add this information into your post. Some WordPress themes comes with these features built in to the theme. If your theme does not have that you can always use a plugin to get this up and running on your WordPress powered site. Some of the options you have for this are:

So there you have it, some of the best WordPress plugins that will help you with on page SEO and boost social interactions on your site. Let me know if your favorite plugin failed to make it to the list, just drop me a tweet or G+ post about the plugin and why you think it should be listed here.

September 10 2013

14:15

40 Fresh jQuery Plugins To Make Your Website User Friendly

Lots of jQuery plugins are available in the internet market. Some give you outstanding results and reduce your work load with their awesome functionality while some give you only tension and increase your work load. And as you see every year so many latest and new jQuery plugins are released. All these jQuery plugins offer different functionalities and therefore, it is difficult for the users to choose which jQuery plugin is suitable for his work or which one is not.

You do not have to worry anymore, in this assortment we are showcasing 40 new and outstanding jQuery plugins for you. Check this out and get to pick one that suits you and feel free to download. All these jQuery plugins are useful and fresh. Please give us your feedback about this superb collection of jQuery plugins because your feedback is very precious and important for us.

Flexisel – Responsive Carousel Plugin

( Demo | Download )

Resize your browser window to see how you the plugin can adjust to the window width. Flexisel will adapt responsively as the screen width gets smaller…

Swipebox – A Touchable jQuery Lightbox

( Demo | Download )

Swipebox is a jQuery “lightbox” plugin for desktop, mobile and tablet.

Sidr – Creating Facebook-Like Side Menus

( Demo | Download )

The best jQuery plugin for creating side menus and the easiest way for doing your menu responsive.

Unslider – A ‘Super-Tiny’ jQuery Slider

( Demo | Download )

The jQuery slider that just slides. No fancy effects or unnecessary markup, and it’s less than 3kb.

jQuery Nested – Create Multi-Column, Dynamic Grid Layouts

( Demo | Download )

Nested is a jQuery plugin which allows you to create multi-column, dynamic grid layouts.

jResponsive – Super-Smooth Transition Layouts

( Demo | Download )

JResponsive will organize your content in an efficient, dynamic and responsive layout. It can be applied to a container element and it will arrange its children in a layout that makes optimal use of screen space, by “packing” them in tightly. One of the very famous website that using this type of layout is Pulse.

MultiDialog

( Demo | Download )

MultiDialog utilizes jQuery UI Dialog Widget for a full featured Modalbox / Lightbox application.

FlexNav – Flexible, Device Agnostic Navigation

( Demo | Download )

A jQuery Plugin for Responsive Menus.

Flaunt.js – Responsive Navs with Nested Click-To-Reveal

( Demo | Download )

Flaunt.js is a jQuery script that allows you to create a responsive, nested navigation out the box. Flaunt was built to overcome responsive design challenges which faced a huge percentage of websites. This challenge was to show nested navigation items on click-demand, without the event taking you through to the page you’ve pressed…

SlideToucher – Touch Enabled jQuery Plugin for Content Swiping

( Demo | Download )

SlideToucher, touch enabled jQuery plugin for content swiping. Supports vertical and horizontal swipes.

LiquidSlider – A Responsive jQuery Content Slider

( Demo | Download )

A Responsive jQuery Content Slider.

Dropdown.dot.js – Flexible Dropdowns Based on dot.js Templates

( Demo | Download )

A JQuery Plugin for super-flexible Dropdowns based on dot.js Templates.

Typeahead.js – A Fully-Featured Autocomplete Library

( Demo | Download )

A fast and fully-featured autocomplete library.

iCheck – Customize Checkboxes & Radio Buttons

( Demo | Download )

iCheck plugin works with checkboxes and radio buttons like a constructor.

Chardin.js – Simple Overlay Instructions for Apps

( Demo | Download )

Simple overlay instructions for your apps.

jQuery Alpha Image Plugin

( Demo | Download )

This plugin can change selected colours to transparent on your image and give result as image or imagedata. This plugin works on IE9+, Chrome, Firefox, Safari. I didn’t try in opera.

ScrollUp

( Demo | Download )

A Lightweight Plugin for Creating a Customisable “Scroll-to-Top”.

Adding Alarms to the Digital Clock

( Demo | Download )

Adding Alarms to the Digital Clock.

Ractive.js

( Demo | Download )

Ractive.js is different. It solves some of the biggest headaches in web development – data binding, efficient DOM updates, event handling – and does so with almost no learning curve.

Firechat

( Demo | Download )

Firechat is an open-source, real-time chat widget built on Firebase. It offers fully secure multi-user, multi-room chat with flexible authentication, moderator features, user presence and search, private messaging, chat invitations, and more.

Albumize

( Demo | Download )

Albumize is a jQuery plugin that lets you manage collection of images in the web page as albums. With albumize, you can browse albums, add cover image to albums and switch between albums.

PowerTip – A jQuery Hover Tooltip Plugin

( Demo | Download )

PowerTip features a very flexible design that is easy to customize, gives you a number of different ways to use the tooltips, has APIs for developers, and supports adding complex data to tooltips. It is being actively developed and maintained, and provides a very fluid user experience.

jQuery Pin – Pin Any Element Within a Container

( Demo | Download )

Query.Pin is here to help! Pin any element to the top of a container. Easily disable it for smaller screen-sizes where there’s no room for that kind of shenanigans.

Perfect-Scrollbar – A jQuery Scrollbar Plugin

( Demo | Download )

Tiny but perfect jQuery scrollbar plugin.

Complexify

( Demo | Download )

Complexify aims to provide a good measure of password complexity for websites to use both for giving hints to users in the form of strength bars, and for casually enforcing a minimum complexity for security reasons.

Pickadate.js

( Demo | Download )

The mobile-friendly, responsive, and lightweight jQuery date & time input picker.

Cool Kitten

( Demo | Download )

It is a collection of HTML/CSS and JavaScript files to be used for web designers and developers.

Google Map

( Demo | Download )

A jQuery Plugin allows you to easely manipulate the Google Map API. You are now able to create maps, add some markers et create routes.

qTip2 – Pretty powerful tooltips

( Demo | Download )

The second generation of the advanced qTip plugin for the ever popular jQuery framework.

Magnific Popup

( Demo | Download )

Fast, light, mobile-friendly and responsive lightbox and modal dialog plugin. Open inline HTML, ajax loaded content, image, form, iframe (YouTube video, Vimeo, Google Maps), photo gallery. In/out animation effects are added with CSS3 transitions.

AutoHideInput

( Demo | Download )

AutoHideInput is a simple jQuery plugin that hides and shows the information entered by the user.

Progression.js

( Demo | Download )

A jQuery plugin that gives users real time hints & progress updates as they complete forms.

Thumbnail Grid with Expanding Preview

( Demo | Download )

A tutorial on how to create a thumbnail grid with an expanding image preview similar to the effect seen on Google Images.

App Showcase with Grid Overlay

( Demo | Download )

A tutorial about creating a simple grid overlay with subtle transitions for an app showcase.

jQuery TourBus

( Demo | Download )

A light weight jQuery plugin that is a must have for any developer to easily create modal windows. Put focus on important elements by applying a mask to your page and opening a customizable pop up modal window.

Pop Easy

( Demo | Download )

A light weight jQuery plugin that is a must have for any developer to easily create modal windows. Put focus on important elements by applying a mask to your page and opening a customizable pop up modal window.

Smint : Sticky Menu with Smooth Scroll

( Demo | Download )

SMINT is a simple plugin for lovers of one page websites.

FlipClock

( Demo | Download )

Least.js

( Demo | Download )

Random & Responsive jQuery, Html5 & Css3 Gallery with Lazyload.

Making Chart

( Demo | Download )

Make Pretty Charts For Your App with jQuery and xCharts.

06:30

How To Stay Cool When Your Client Wants To Maintain Their Own WordPress Site


  

So your client doesn’t want you to maintain their website for them. I encounter this a lot working with DIY-minded small business owners, and I used to dread it – I mean really dread it. Back in the day, allowing your client access to a website meant constantly fixing it after they broke it. Or worse, they would break it then try to fix it themselves after 3-hours of researching the error code on Google. Yikes.

July 15 2013

06:30

July 08 2013

03:59

Top jQuery Slider Plugins for Frontend Web Developers

Advertise here with BSA


Common JavaScript techniques include Ajax content, dynamic forms, and modal windows. The content slider/slideshow interface has always been around but has gained a tremendous audience over the past few years. And with the continuing growth of jQuery it is safe to assume that more developers will be creating projects with an open source license.

In this collection I want to present 30 of the most interesting jQuery slider plugins. Each one should work properly with the most current version of jQuery and they also provide their own documentation. It is a great way to introduce yourself into the system and start building websites with some more dynamic effects.

iView

iview sliding plugin slideshow jquery

Commonly the jQuery iView plugin helps to put together iframe content within a slider. This standard interface allows developers to create animated captions so the entire slideshow interface behaves dynamically. And you can embed lots of other content aside from iframes, like YouTube videos or background images. You can see these features in this live demo.

Adaptor

jquery box slider adaptor open source

Adaptor is another plugin created as a jQuery content slider. This user interface is much sleeker than other common plugins, yet I have noticed the file sizes are a bit larger as well. It comes with a number of default animations which are much more powerful than CSS3 alternatives. You can download the source off Github or check out a live demo from the plugin homepage.

Galleria

jquery plugin galleria github sliding slideshow

The Galleria plugin is definitely one of the best image slideshow galleries. It comes with a very easy-to-use interface that anyone should understand. It is also completely free to download and comes with its very own documentation page. This may take a bit of time getting adjusted to all of the settings. But Galleria will captivate your visitors because it is easy to use and so simple to understand.

Slider.js

sliderjs open source jquery plugin

I have personally used Slider.js in a couple situations and never had a problem with it. This plugin is very basic when first added into a webpage. You should attempt to update a few sections in the CSS where you may control the colors and UI elements. Currently the plugin has been undergoing upgrades for v2 which should be released sometime during 2013.

SlidesJS

slidesjs open source jquery plugin slideshow

SlidesJS is a completely different project in comparison to Slider.js. This also runs on jQuery but SlidesJS is much more refined to be placed within responsive layouts. You can fill up images which take over the entire width of the screen and it will look great. Check out the files in SlidesJS Github repo to learn more.

Evo Slider

Evo Slider tabbed accordion slideshow

Breaking away from the image sliding content we have Evo Slider. This is built for housing HTML content, which may be images, but it could be anything you like. Every one of the slides will fold into each other like a horizontal accordion. Check out the list of examples to see how this could be implemented into your projects.

bxSlider

bxslider jquery responsive plugin slideshow

bxSlider has gotten a lot of solid publicity in recent months. It just happens to be one of the simplest, cleanest, and easiest plugins to use on any website. Features include a responsive layout and the ability to touch/swipe on a mobile device. There is an older deprecated version floating around the web but you can find the most up-to-date released in this Github repo.

Unslider

Unslider jquery open source plugin background images

Unslider behaves more as a fullscreen interface block than a typical image slideshow. jQuery is used as the backend plus you have the option of customizing many parameters like the animation speed or delay between slides. It even supports keyboard navigation for moving next/previous without a mouse! It is a newer project but definitely worth the leap. Check out the plugin homepage to learn more.

Tiny Carousel

tiny carousel jquery open source plugin

Tiny Carousel is a more lightweight alternative for typical HTML sliding content. The carousel means once you reach the end of the content list, it will automatically restart from the beginning and slide through again. You can even set the orientation to slide horizontal or vertical on the page. This is a plugin worth looking into if you need the carousel-type functionality.

Basic Slider

basic slider jquery open source plugin

With a name like Basic Slider you can probably formulate an opinion of this plugin. This has been created with a mindset of being simple and lightweight. You will find all the essential functionality and nothing more – this leaves room for customization of the skin design via CSS styles. There are more details on the plugin repo or you can see alternative code examples on the plugin homepage.

Skitter Slider

skitter slider jquery plugin open source preview

Using this plugin you will find some really big oversized UI elements! Skitter is a jQuery slideshow plugin with content sliding for image galleries. It also has captions which display through animation after switching between slides. I really like the interface, but designers may find the controls are somewhat clunky.

Liquid Slider

liquid slider responsive jquery plugin

Looking at the homepage for Liquid Slider you can tell it was developed with some grace by Kevin Batdorf. This plugin is meant to be very simple and responsive when needed. It will use CSS3 transitions when possible but also falls back onto jQuery for older browsers. Even the plugin documentation is fantastic and certainly worth a quick peek.

ResponsiveSlides.js

responsive slides js jquery plugin slideshow

ResponsiveSlides.js is another plugin doing exactly what you might expect! You can build a responsive slideshow panel switching between photos and other content. It is really easy to install and you have the option of turning off all standard user interface controls. This means users will have to sit and watch the slideshow rather than jumping ahead. But from customizing options you can include controls and image captions, as in this demo on the main website.

SlideDeck

slidedeck jquery plugin sliding panels

SlideDeck is one of my personal favorites as it is a very professional jQuery plugin for developers. There have been a few iterations released leading up to the current version, which supports any type of media from images to videos and HTML content. Granted this one does cost some money but working on certain projects this may be worth the investment.

RSlider

fullscreen jquery slideshow image plugin

RSlider is a beautiful fullscreen image slider using jQuery. I have not introduced any other fullscreen plugins and this is certainly one worth noting. It is totally free to download and may be used in any website project with fullscreen background images. The controls are also easy to customize, and you can read more on their official blog post.

Coin Slider

coin slider plugin jquery open source

The Coin Slider plugin is really unique with its library of various jQuery animation effects. The transitions between each slide are seamless and beautiful. This is even supported in older browsers going back to Internet Explorer 6! A great choice for compatibility with any website.

PlusSlider

Plus Slider jquery slideshow plugin

Looking at the PlusSlider it is definitely a more basic version of any image slideshow. You can quickly implement either images or HTML into the content and attach this to an unordered list on the page. The design almost reminds me of SlideShare with the similar navigation arrows and panel icons at the bottom.

AnythingSlider

csstricks jquery slider js plugin

Another fairly basic example is the AnythingSlider released by CSS Tricks. This content slider is managed as a very bare-bones starting kit to get something up and running on your website. The documentation on Github is easy to go through and provides an excellent starting point for new developers.

wmuSlider

wmuslider plugin open source jquery preview

For a darker and more unique interface please check out wmuSlider. It was created by Brice Lechatellier and you can see a live demo on his website. The arrow keys are translucent and only appear on the slideshow when hovering. Additionally the files themselves are very small but there are not so many alternative parameter methods for customization.

Choco Slider

choco slider open source jquery plugin

One really good beginner’s plugin for content sliding is Choco Slider. This very tasty jQuery plugin is easy to customize and easy to install. But it also comes with very bare features in comparison to other choices. Developers who want to get their hands dirty may try this out as a simpler solution for a simpler website layout.

Superslides

superslides open source jquery plugin slideshow

Superslides is another beautiful fullscreen jQuery-based image slideshow plugin. You merely input the image files that you need and the design will fit them naturally into the full page background. Additionally there are navigation arrows and small circular icons for transitioning between slides. The source code is very easy to work with and you can find more examples in the Github repository.

jQuery Carousel

jquery carousel slider plugin open source

To jump back into carousels we have this jQuery Carousel plugin released by Thomas Jaggi. It is responsive and works to fit any type of content into the slides, plus the whole slideshow will restart from the beginning after hitting the last one. The interface itself is swipe-enabled which is good news for tablet & smartphone users.

touchSlider

touch slider jquery plugin webdev preview

Looking at the demos for TouchSlider it does use a very specific interface design. This may not fit well into all your sites and so it is notable that this plugin may not be for everyone. But it does include a nice core functionality and the design is always customizable. Check out the plugin Github repository to learn a bit more.

Responsive Carousel

filament group open source responsive carousel

Filament Group released a great plugin for responsive content carousels. This is free to download off Github and customize into your own projects. Currently it is still in development and the full documentation has not been completed either. But you may want to check out what has already been done and see if this plugin might fill a void in your project work.

rcarousel

rcarousel open source jquery slideshow plugin

Here we have yet another great carousel plugin named rcarousel. It is a continuous content slider built for housing much more than just images. You can add other types of HTML/CSS content into each slide and they will display properly. Also the animation effects are simple yet effective to achieve the typical carousel interface.

Flux Slider

fluxslider jquery plugin open source numbers

I have known about Flux Slider for a while and only recently got the chance to use it. This is simply an amazing plugin which allows for a great number of custom jQuery transition effects. You may select between 3D or 2D animations, and these can be dispersed intermittently and used within various transitions on the page.

iOSSlider

iosslider touch slideshow plugin jquery

iOS Slider is a really unique project built to work specifically on touch devices. The whole plugin can be implemented very quickly if you know how to setup the default parameters. It is also one of my favorites because you can manipulate both images and text within the sliding box. It works great on tablets and smartphones to fit nicely into a responsive layout.

Lean Slider

lean slider jquery open source slideshow panels

Taking a peek at Lean Slider this is still one of my favorite new releases. This is a typical content slider which can house images, HTML content, videos, and other forms of embedded media. It also behaves like a carousel where you can move forwards or backwards in any direction continuously. The plugin homepage offers a lot of documentation and you can learn more by scanning notes on the plugin Github repo.

Craftyslide

craftyslide open source jquery demo preview slideshow

The Craftyslide plugin is a free open source project for tiny slideshows. The files are only 2KB and it has been created from the ground-up to remove all the excessive frills you can find in other plugins. This is meant as a starting template which looks good on its own, but may also be customized for nearly any website. Craftyslide may also be found on Github with related documentation and support questions.

Blueberry

blueberry jquery plugin slideshow open source preview

Last on the list we have Blueberry which is actually one of the better fluid slider plugins. This will adapt to any layout size and the image captions are beautiful. It does require a bit of extra HTML markup added into the page. But if you don’t mind the effort Blueberry can deliver one amazing jQuery-based slideshow performance.

Final Thoughts

Although there are many other alternatives to choose from, jQuery is easily the best-supported open source JavaScript library. So many free plugins have already been released and developers are putting out new ideas every month. I hope this collection may offer ideas for webmasters who have been looking to implement a slider interface. Additionally if you know about other jQuery plugins which we missed please share with us in the post discussion area.


Advertise here with BSA

June 29 2013

07:00

At A Glance: How To Secure Your WordPress Site [Infographic]


  


  

Securing your self-hosted WordPress site is absolutely essential. That’s the reason for our continuous coverage of this particular topic throughout the years. With WordPress becoming more and more dominant as the motor of today’s web, the topic stays at the top of our advice list. Throughout the last four years, the number of WordPress blogs having been hacked has more than doubled from 81,000 to over 170,000 per year. The fresh infographic by WPTemplate.com aggregates everything you need to know to properly secure your site and gives you a decent hint sheet to always keep your eyes on.

May 31 2013

21:15

13 Best WordPress Chat Plugins

As we all know very well that WordPress is a well-known and free blogging site. And with the time WordPress has become more famous and improved. WordPress introduced so many interesting and amazing features but now WordPress is also introducing some other outstanding applications and plugins especially for social media sites.

In this assortment, we are showcasing some useful and outstanding WordPress Chat Plugins. Have a look at these stunning WordPress chat Plugins. If you want to download these WordPress chat plugins you can download them without any cost. You can also tell us what you think about this post and share your precious opinions with us via comment section below. Enjoy and have fun everyone!!!!!

ClickDesk Live Support – Live Chat

ClickDesk is a value combo of best wordpress live chat, help desk, voice chat and social toolbar for your website. Install it Free today!

Envolve Chat

Envolve Chat – A customizable chat toolbar for your website.

Quick Chat

Self hosted WordPress chat plugin supporting private chat, chat rooms, avatars, user list, words filtering, smilies, caching plugins and more.

Zopim Live Chat

Zopim is an award winning chat solution that helps website owners to engage their visitors and convert customers into fans!

WP ChatBlazer

WP Chatblazer is a plugin to allow you to embed a Chatblazer application to chat on a WordPress page. Embed instant messaging and video chat directly.

Video Chat Plugin

The AVChat Video Chat Plugin for WordPress is designed to increase members engagement and web site revenues with a stunning video chat solution.

FlexyTalk – Live Chat

Start chatting to your site’s visitors and FACEBOOK fans from any device including mobile phone . FREE account with unlimited chats.

Banckle Live Chat

Through Banckle Live Chat Plugin, you can effectively communicate and conduct live chat sessions with the visitors of your WordPress website.

Acobot Live Chat & Contact Form

Enhance your WordPress with a virtual robot in 3 minutes or less and boost your sales like never before. It’s simple, easy and fast.

Live Chat with Multimedia Tools

Add live chat with multimedia tools to your site.

PHP Live

Chat with your website visitors.

Ultimate Live Chat

Add live chat support and real-time monitoring onto your WordPress website with Ultimate Live Chat from UltimateLiveChat.com

Barc Chat

Barc Chat provides a simple yet feature rich chat room for your whole community to interact in real-time directly on your site.

May 17 2013

13:00

WordPress Plugin Development from Scratch, Part 4/4: Settings Page

Welcome to the final part of our tutorial series on WordPress Plugin Development for Designers. In the last three parts, we discussed the importance of plugins for you as designers and identified a basic structure for design based plugins while integrating a jQuery slider into WordPress.

Today we are going to complete the basic structure of a plugin by learning how to create a WordPress plugin settings page for our slider. Stay tuned as settings are an important part in customizing the functionality of a Plugin.

So let’s get started.

WordPress Plugin Development Series:

(note that in order to test the final version, you will have to install it on your WordPress installation)

What is a WordPress Plugin Settings Page?

In any kind of system, configuration settings define the data which needs to be initiated before the system starts working. These settings determine the functionality and features of your system.

Consider the SlidesJS slider, which we developed through the last three parts. We didn’t have any configuration settings and hence we had to stick with the default features. This slider is not going to suit every WordPress theme and not every designer is going to like the default features.

So it’s ideal to have some options which can change the existing behavior of the plugin to suit the requirements of each user. Let’s assume we need to auto play the slider or change the existing transition interval as it is too slow; unfortunately we don’t have settings at the moment and we need to use what the plugin offers.

In the next few sections we will be adding options in different ways to allow us to customize the plugin.

Planning Settings for SlidesJS Slider

SlidesJS comes with dozens of configuration options on its own. In this tutorial I am going to use a few of these configurations to help you understand the plugin settings creation process on WordPress.

Following is a list of configurations which we are going to implement in this tutorial.

  • Play button – Sliders can contain a button for play/pause functionality. We can enable or disable play button in the common settings page.
  • Autoplay – Most sliders will play automatically when they’re loaded. We can enable or disable autoplay in the common settings page.
  • Effects – Sliders have multiple transition effects. Currently we are using the slide effect. We can allow the user to choose the effect from the common settings page.
  • Transition Duration – is the time between slide transitions. Sometimes we need it to transition faster or slower depending on the type of content. We can use the common settings page to configure transition duration.

Now we have identified the necessary settings to be included in the plugin. Let’s move forward by building the common plugin settings page.

Creating the Admin Menu Page for Plugin Settings

WordPress does not come with specially designed pages for plugin options. We can either use the admin menu page or the options page to make the HTML forms required for configuring options. I am going to use the admin menu page to implement the options. First we have to use the following code to add the page to the left menu.


add_action('admin_menu', 'fwds_plugin_settings');

function fwds_plugin_settings() {

    add_menu_page('1stWD Slider Settings', '1stWD Slider Settings', 'administrator', 'fwds_settings', 'fwds_display_settings');

}

We have to use the action called admin_menu to add a new menu item and fwds_plugin_settings is the name of the function to add the page.

Inside the function we can use the built-in add_menu_page to create the menu item. You will be able to see a screen like the following, once you include the above code in the plugin.

WordPress Plugin Development from Scratch, Part 4/4: Settings Page

Even though it’s not mandatory, it’s ideal to have a general idea about the parameters of the add_menu_page function.

  • Parameter 1 (1stWD Slider Settings) - is the title used in your HTML page.
  • Parameter 2 (1stWD Slider Settings) - is the title used for the menu item on the left menu.
  • Parameter 3 (administrator) - is the capability needed to add the page. You can keep it as administrator in most of the cases..
  • Parameter 4 (fwds_settings) - is a unique key used for the menu item.
  • Parameter 5 (fwds_display_settings) - is the function name used to implement the HTML form.

Having learned about the parameters, let’s implement the HTML form required for adding settings fields.


function fwds_display_settings() {

    $slide_effect = (get_option('fwds_effect') == 'slide') ? 'selected' : '';

    $fade_effect = (get_option('fwds_effect') == 'fade') ? 'selected' : '';

    $interval = (get_option('fwds_interval') != '') ? get_option('fwds_interval') : '2000';

    $autoplay  = (get_option('fwds_autoplay') == 'enabled') ? 'checked' : '' ;

    $playBtn  = (get_option('fwds_playBtn') == 'enabled') ? 'checked' : '' ;

    $html = '</pre>
<div class="wrap"><form action="options.php" method="post" name="options">
<h2>Select Your Settings</h2>
' . wp_nonce_field('update-options') . '
<table class="form-table" width="100%" cellpadding="10">
<tbody>
<tr>
<td scope="row" align="left">
 <label>Slider Effect</label>
<select name="fwds_effect"><option value="slide">Slide</option><option value="fade">Fade</option></select></td>
</tr>
<tr>
<td scope="row" align="left">
 <label>Enable Auto Play</label><input type="checkbox" name="fwds_autoplay" value="enabled" /></td>
</tr>
<tr>
<td scope="row" align="left"><label>Enable Play Button</label><input type="checkbox" name="fwds_playBtn" value="enabled" /></td>
</tr>
<tr>
<td scope="row" align="left">
 <label>Transition Interval</label><input type="text" name="fwds_interval" value="' . $interval . '" /></td>
</tr>
</tbody>
</table>
 <input type="hidden" name="action" value="update" />

 <input type="hidden" name="page_options" value="fwds_autoplay,fwds_effect,fwds_interval,fwds_playBtn" />

 <input type="submit" name="Submit" value="Update" /></form></div>
<pre>
';

    echo $html;

}

First I have used five variables to get the current values of the settings from database. Initially all of those options will be empty and hence I have added default values as necessary. We can use get_option function to retrieve any option value from the database.

Then the most important thing is the form action. Since we are creating an options page, we can use options.php as the action.

Afterwards we create the necessary fields for our configuration settings. The transition effect is designed as a dropdown box to contain the two effects in the SlidesJS slider. We use checkboxes for both autoplay and play button options. A textbox will be used for transition duration.

In a normal scenario we need to save these values manually once the form is submitted. Fortunately WordPress provides a built-in method for updating options without using any additional code. All you have to do is specify two hidden fields in your form with predefined values.

The first field should be named action while its value should be update. The next hidden field should be named page_options. Its value should contain all the field names in the form separated by commas.

That’s it. Once you enter values and hit the update button, values will be saved automatically and your options page should look something similar to the following.

WordPress Plugin Development from Scratch, Part 4/4: Settings Page

Now we have the values of configuration options to initialize the slider.Final task will be to use these settings to initialize the slider dynamically.

Initializing Slider with Dynamic Configuration Settings

Our slider initialization code resides in the slidesjs.initialize.js file. We need a method to pass the dynamically configured settings into the JavaScript file, so let’s see how we can alter the fwds_scripts function and pass the data to the JavaScript file.

function fwds_scripts() {
    wp_enqueue_script('jquery');
    wp_register_script('slidesjs_core', plugins_url('js/jquery.slides.min.js', __FILE__), array("jquery"));
    wp_enqueue_script('slidesjs_core');

    wp_register_script('slidesjs_init', plugins_url('js/slidesjs.initialize.js', __FILE__));
    wp_enqueue_script('slidesjs_init');

    $effect      = (get_option('fwds_effect') == '') ? "slide" : get_option('fwds_effect');
    $interval    = (get_option('fwds_interval') == '') ? 2000 : get_option('fwds_interval');
    $autoplay    = (get_option('fwds_autoplay') == 'enabled') ? true : false;
    $playBtn    = (get_option('fwds_playbtn') == 'enabled') ? true : false;
    $config_array = array(
            'effect' => $effect,
            'interval' => $interval,
            'autoplay' => $autoplay,
            'playBtn' => $playBtn
        );

    wp_localize_script('slidesjs_init', 'setting', $config_array);

}

The initial part of including scripts will be similar to the code we used in the previous part. First we need to get the configured option values from the database using the get_option function, as we used earlier. Then we have to assign all the values into an array to be passed into the script.

WordPress provides a method called wp_localize_script for passing values to JS files. First parameter of this function is the key used for the required js file. Then we can define the variable name, which is used to access the values from JavaScript file. Finally we pass the option values array to the function.

Then we need to alter the initialization script as following in order to accept values dynamically.

jQuery("#slides").slidesjs({
    navigation: false,
    play: {
      active: setting.playBtn,
      effect: setting.effect,
      auto: setting.autoplay,
      interval: setting.interval,
    },
  });
});

We can configure all the options we used in the options page using the play array defined in the SlidesJS configuration. You can access any value using the setting variable.

The initial plan also included the configurations for slider dimensions, but the width and height configurations in SlidesJS don’t work as documented. Dimensions are assigned from both CSS and plugin files making it hard to enable configuration and hence I have omitted it here.

Now we have completed our plugin with some basic configuration options. The final output of the slider will look like the following image once you enable all the options, including the play button.

WordPress Plugin Development from Scratch, Part 4/4: Settings Page

Wrap Up

Throughout this series, we learned how you can build a design based WordPress plugin from scratch. Now you should have a much better understanding of developing a simple plugin. Now it’s time for you to move forward with the examples. Unless you practice these theories, you wont become a good plugin developer. So make sure to try out different sliders and configure different options to get a better understanding of plugin development.

Things to Take Away

We discussed lots of theories and techniques in detail. Now I’ll summarize the most important things to take away from this plugin development series in order to get you started practicing. You should know:

  • How to define a plugin and the file structure
  • How to include CSS and JavaScript files and pass the data dynamically
  • Using Custom Post Types to create different types of data for components
  • How to work with extra fields inside custom posts
  • How to create a plugin options page

I suggest you try these techniques for at least another three sliders to understand the concepts. Once you complete that task you can move onto creating something like an accordion, tabs or another similar component using the same techniques.

In future tutorials I’ll show you how to use the same codes to create different types of plugins with minimal modifications.

Until then, I hope you will try these theories. Let me know about your experiences, questions, suggestions or any comments regarding this tutorial series.

Looking forward to hearing from you.

May 06 2013

16:51

16 Beautiful jQuery Pagination Plugins

Here, we are presenting a collection of some useful and free to use jQuery pagination plugins for you that you can integrate on your website in order to split pages and posts into several pages. These pagination plugins make pagination easy for the website developers. These plugins are designed for you so that website pagination will no longer be a tough task for you. With these plugins, you can divide the data into multiple pages once it is loaded into the page. Furthermore, server side pagination allows you to extract necessary amount of data and then loaded on the page.

In this post, you will find a list of some useful jQuery pagination plugins that allow you to create proper pagination setups for your website. We hope that you will find this collection useful for you. Feel free to share your opinions with us via comment section below. Have fun.

Extreme Makeover: jPaginator CSS3 Edition

( Demo | Download )

jPaginate: A Fancy jQuery Pagination Plugin

( Demo | Download )

jQuery Quick Pagination

( Demo | Download )

Pajinate – A jQuery Pagination Plugin

( Demo | Download )

SimplePagination

( Demo | Download )

Easy Paginate jQuery plugin for pagination

( Demo | Download )

jQPagination

( Demo | Download )

Sweet Pages: A jQuery Pagination Solution

( Demo | Download )

jQuery Pagination Plugin

( Demo | Download )

jPaginator

( Demo | Download )

jQuery Pagination Plugin: Smart Paginator

( Demo | Download )

Easy pagination with jQuery and Ajax

( Demo | Download )

jPaginate – jQuery Pagination System Plugin

( Demo | Download )

jQuery Pagination revised

( Demo | Download )

Pagination with jQuery, MySQL and PHP.

( Demo | Download )

AJAX Pagination using jQuery and PHP with Animation

( Demo | Download )

April 28 2013

11:30

Photoshop in Web Design: 5 Plugins to Make your Workday More Pleasant


  
GuideGuide Still nowadays lots of web designs start as a Photoshop draft. This gets more and more elaborate and has to be converted to HTML and CSS during the late stages of the project. No wonder, that services for PSD to HTML conversion still face no shortage of orders. A lot of developers have created a flood of plugins for facilitating the task of turning PSD to HTML. I went and dug up five of which I opine belong to the best.

April 22 2013

13:00

4 Very Useful WordPress Plugins That You Probably Didn’t Know Existed

WordPress plugins have made our lives so, so much easier. In fact, there are already nearly 25,000 plugins developed.

And there are plenty of articles all over the internet featuring the most popular and the most known WordPress plugins that will turn your website into a powerful CMS, blog, forum, etc.

I am here to show you four lesser known plugins that are very useful.

1. Faster Image Insert

Basically this plugin moves the whole media manager over to your post or page editing interface. It is a really useful plugin mainly because you do not have to open an extra window anymore, just add an image to your content.

It is right there, below your text editor or you can drag it anywhere you want. Also, another feature I totally love is multi editing. Here is a great tutorial for you.

Download Faster Image Insert Plugin Here

2. Plugins Garbage Collector

Now, this plugin can actually make your website faster. It increases your website’s loading speed by cleaning up the database of your website.

The official description of this plugin says: “It scans your WordPress database and shows what various things old plugins (which were deactivated or uninstalled) left in it. Cleanup is available.” How does it do it?

Well, this plugin scans the whole database of your WordPress site. And then it shows all the tables from that database to you. It looks just like this screenshot below.

PluginsGarbageCollector

As you can see, there is a lot of green and a lot of red. Mainly you should worry about those red records. As they show you any tables left behind after uninstalling a plugin. Some plugins delete every data and clean up when you delete them. But some do not. So this plugin will solve it for you. Feel free to download it here.

3. Video Thumbnails

Some time ago I was maintaining a video based WordPress site for one of my clients. They were paying for a fast and spacious server.

They used to embed and publish approximately 20 videos a day. 

And the biggest and most time consuming headache they had was manually creating and attaching a thumbnail to their video posts.
I had no idea what to do about it until I found Video Thumbnails. So what does it do so good to deserve to be included in this list? Very simple…

VideoThumbnails

“It simplifies the process of automatically displaying video thumbnails in your WordPress template.”

It supports all of these online players: YouTube, Vimeo, Blip.tv, Justin.tv, Dailymotion and Metacafe.

And also this plugin’s official description says that it will work without a problem with popular video embedding plugins as: Viper’s Video Quicktags, Simple Video Embedder, Vimeo Shortcode and WP YouTube Lyte.

I have to admit – I have not tried to use this plugin together with any of the ones mentioned above.

But for your peace of mind I can assure you that the plugin descriptions are usually reliable sources of information.

Something else I wanted to mention is that this plugin even has some features for advanced WordPress users who would love to customize their theme.

Just head over to Video Thumbnails Official WP page to find out more about it.

4. Search Meter

This plugin is a great weapon to improve your marketing strategy, customer service or in any other way please your visitors.

SearchMeter

This plugin has been made to track what your readers really want, and let me tell you from my own experience, this plugin does it really well. Basically, when you head over to your WordPress Dashboard you will be shown exactly what your readers are searching for, when and how often.

Not only does it show you what terms they search for, it will even tell you if they find what they are looking for.

This kind of search statistics enables you to give your readers more of what they are already looking for and adjust your content accordingly if they are struggling to find what they are looking for.

Last Piece Of Advice

Whenever I am talking about WordPress plugins I always like to remind people that if overused, they can actually do more harm than good.

So please make sure you install only the most essential plugins, instead of any plugin you think will make your site better.

To find out what kind of harm can be done when you have too many plugins read this great article about it over at WP Beginner.

Do you know any useful, yet little known plugin worth mentioning here?

April 18 2013

13:00

WordPress Plugin Development for Designers – Custom Post Types

Hello Everyone! Welcome back to the third part of this series on WordPress Plugin development for designers.

In the first part we identified the importance of WordPress plugins for you as designers and the basic structure of a plugin. Then we followed it up with the necessary coding required for developing plugins in the second part, by creating a jQuery slider for WordPress.

I am happy to announce that SlidesJS has won the voting contest and I’ll be using it through the rest of this tutorial series.

I hope you have used the slider plugin and tried to fix the responsive issue we had in the demo. We got good responses containing the possible solutions. So we are going to start the third part by fixing the responsive issue in the slider.

Download Slider Version 2 | Demo

Following is an image from demo we created in the previous part, illustrating the responsive issue.

wpdd_part3_1

Making SlidesJS Responsive

SlidesJS is designed to use 940px as its default width. Most of the websites are designed in a grid with at least 960px width. So default SlidesJS slider will be responsive in full width pages. We are using the TwentyEleven theme in this demo. It doesn’t offer the full width in its default pages or posts. Therefore we have to adjust the slider according to our themes to make it responsive.

CSS media queries can be used effectively to make the slider responsive. So let’s take a look at the default media queries provided by SlidesJS.

<style>
<!--
/* For tablets & smart phones */
   @media (max-width: 767px) {
     body {
       padding-left: 20px;
       padding-right: 20px;
     }
     .container {
       width: auto
     }
   }

   /* For smartphones */
   @media (max-width: 480px) {
     .container {
       width: auto
     }
   }

   /* For smaller displays like laptops */
   @media (min-width: 768px) and (max-width: 979px) {
     .container {
       width: 724px
     }
   }

   /* For larger displays */
   @media (min-width: 1200px) {
     .container {
       width: 1170px
     }
   }

-->
</style>

960px layouts will fit into the media query between 768px and 979px. Slider container is defined as 724px for that particular width range. Basically what you have to do is adjusting the width of slider container based on your themes content area dimensions. So the updated media queries to suit TwentyEleven theme are as follows.

<style>
<!--
    /* For tablets & smart phones */
    @media (max-width: 767px) {
      body {
        padding-left: 20px;
        padding-right: 20px;
      }
      .container {
        width: 400px
      }
    }

    /* For smartphones */
    @media (max-width: 480px) {
      .container {
        width: 300px;
      }
    }

    /* For smaller displays like laptops */
    @media (min-width: 768px) and (max-width: 1199px) {
      .container {
        width: 600px
      }
    }

    /* For larger displays */
    @media (min-width: 1200px) {
      .container {
        width: 600px
      }
    }
-->
</style>

You can see that I have modified the widths of all the media queries to suit TwentyElevan theme container sizes. Now let’s look at the slider after the code updates. Make sure to add these styles for media queries into the example.css file in the plugin.

wpdd_part3_2

We have completed the responsive version of static slider for WordPress. But it’s useless until we enable the capabilities for adding images dynamically through the WordPress dashboard. So let’s get started on making dynamic sliders.

Planning the Dynamic Slider Functions

In the current version of the plugin, we are using the images inside the plugin folder. But we want to put our own images in an user friendly method. Also we should be able to create multiple sliders for different locations of our web sites. Let’s list down the functionality we need to implement in this part.

  • Create multiple sliders
  • Upload images dynamically through WordPress media uploader.
  • Assign and remove images of sliders at any given time

Implementing these functionalities is not a very difficult task for people who are knowledgeable in working with PHP. But as designers you might find it a little difficult to understand if you have zero background about PHP. So I am going to explain things as simple as possible to make it easy for you.

Also keep in mind that you don’t need to understand each and every detail discussed here. I’ll tell you the tasks you need to focus and tasks you can omit as designers. So stay tuned and get ready with your code editor.

Creating Slider – Role of Custom Post Type

Most of you will be familiar in working with WordPress posts. Even if you haven’t developed or designed anything on WordPress, there is a high possibility that you have wrote an article on a WordPress blog. WordPress posts are designed to write article, tutorials or some content for your website. Following image displays the post creation screen of WordPress.

wpdd_part3_3

Usually we get fields like post title, post content, categories, featured image to insert necessary data for specific posts. Similarly WordPress provides a technique called Custom Post Types. Basically custom post type can be considered as a special kind of post. We can use custom post types to create some amazing designs and features to WordPress. In this part we are going to use specific custom post type to create sliders.

Most important thing to keep in mind is that custom post types doesn’t show in the normal post section and hence will not get displayed on your blog. We have the capability to create unique designs for these post types and decide where we should display them.

Creating Slider Post Type

I assume that you have already installed and activated the previous version of the plugin we developed in the last part. Here I’ll be adding and modifying the existing codes of the plugin.

First we have to register a new post type for sliders. You can insert the following code into the end of the 1wd_slider.php file of the plugin.


add_action('init', 'fwds_register_slider');

function fwds_register_slider() {

    $labels = array(

       'menu_name' => _x('Sliders', 'slidesjs_slider'),

    );

    $args = array(

       'labels' => $labels,

       'hierarchical' => true,

       'description' => 'Slideshows',

       'supports' => array('title', 'editor'),

       'public' => true,

       'show_ui' => true,

       'show_in_menu' => true,

       'show_in_nav_menus' => true,

       'publicly_queryable' => true,

       'exclude_from_search' => false,

       'has_archive' => true,

       'query_var' => true,

       'can_export' => true,

       'rewrite' => true,

       'capability_type' => 'post'

    );

    register_post_type('slidesjs_slider', $args);

}

WordPress executes an action called init in its initialization process of a user request. We can call any function on the init action. Here I have used a function called fwds_register_slider.

Inside the function we have to define some labels and parameters for custom post types. Labels will decide the text displayed on menu items and forms. There is a bunch of arguments to configure various features of a custom post type. Finally we register the custom post type using the register_post_type function. First parameter to this function will be the name of the custom type. You can use any unique name for that. Next we pass the arguments as the second parameter.

Understanding the complete code and configurations is not necessary at this stage as a beginner in WordPress. Following is a preview of the custom post type section for Sliders once we include this code.

wpdd_part3_4

As you can see, there is a separate section for Slider posts on the left menu and the label is converted into the text we used in the labels variable.

Things to Focus

  • Whenever you want to create Sliders, Accordions, Tabs or similar design components, use the following block of code with a new function name for init action.
  • In the labels section, change the text you want to appear and the unique post type name according to your preference.
  • Keep the arguments variable as it is now and don’t worry about the various parameters used there for the moment.
  • Finally use the same unique name used in the labels array for the register_post_type function.

Each time you use this code with different function and unique post type, new section will be added to the left menu. Now try to use Sliders in the dashboard.

We can use this section to create sliders. But still it works as normal post type and won’t do anything different. Our next task is to add images into sliders. Let’s move forward.

Creating Slider Image Fields

We have to insert different images to each new slider. WordPress meta boxes can be used effectively to add additional fields to the slider creation screen. Consider the following code.


add_action('add_meta_boxes', 'fwds_slider_meta_box');

function fwds_slider_meta_box() {

    add_meta_box("fwds-slider-images", "Slider Images", 'fwds_view_slider_images_box', "slidesjs_slider", "normal");

}

function fwds_view_slider_images_box() {
    global $post;

    $gallery_images = get_post_meta($post->ID, "_fwds_gallery_images", true);
    // print_r($gallery_images);exit;
    $gallery_images = ($gallery_images != '') ? json_decode($gallery_images) : array();

    // Use nonce for verification
    $html =  '<input type="hidden" name="fwds_slider_box_nonce" value="'. wp_create_nonce(basename(__FILE__)). '" />';

    $html .= '
'; $html .= "
<table class="form-table">
<tbody>
<tr>
<th><label for="Upload Images">Image 1</label></th>
<td><input id="fwds_slider_upload" type="text" name="gallery_img[]" value="".$gallery_images[0]."" /></td>
</tr>
<tr>
<th><label for="Upload Images">Image 2</label></th>
<td><input id="fwds_slider_upload" type="text" name="gallery_img[]" value="".$gallery_images[1]."" /></td>
</tr>
<tr>
<th><label for="Upload Images">Image 3</label></th>
<td><input id="fwds_slider_upload" type="text" name="gallery_img[]" value="".$gallery_images[2]."" /></td>
</tr>
<tr>
<th><label for="Upload Images">Image 4</label></th>
<td><input id="fwds_slider_upload" type="text" name="gallery_img[]" value="".$gallery_images[3]."" /></td>
</tr>
<tr>
<th><label for="Upload Images">Image 5</label></th>
<td><input id="fwds_slider_upload" type="text" name="gallery_img[]" value="".$gallery_images[4]."" /></td>
</tr>
</tbody>
</table>
";

        echo $html;

}

First we have to call a new function on add_meta_boxes action to create a meta box for our sliders. Inside the function we define a new meta box using the add_meta_box function as shown in the following code.


function fwds_slider_meta_box() {

    add_meta_box("fwds-slider-images", "Slider Images", 'fwds_view_slider_images_box', "slidesjs_slider", "normal");

}

First parameter is a unique key for meta box followed by meta box title. Third parameter is a new function to execute the meta boxes. Fourth parameter is the unique post type we created earlier and you can leave the final parameter to its default value of normal.

Then we need to create the fwds_view_slider_images_box function to implement the meta box.Inside the function we get the available image values for the current slider from the database. We can save images of each slider into database with slider id and a key (_fwds_gallery_images).

In the initial loading, there wont be any existing images and hence the gallery images will be empty. Then we create the fields for the images using HTML codes. I have used 5 text boxes here to enter 5 images for each slider.

Now your slider creation screen should look like the following image.

wpdd_part3_5

Things to Focus

  • Create add_meta_box functions and load it with respective parameters. If you are creating 2 types of sliders, use 2 add_meta_box functions.
  • Create new function like fwds_view_slider_images_box for each of the sliders you want to use.
  • I have used 5 images per slider. Add or remove text boxes according to your preference to get more or less images per slider.

Uploading Images to Slider

Now we can start uploading images to the slider. Just click the Add Media button on the Slider creation screen to load the WordPress media uploader. Then upload images as you do for normal posts. You should get a screen like the following once an image is uploaded.

wpdd_part3_6

In the link to section on the right, you can select whether to use the image as an attachment or media file. Select media file to get the direct link to the uploaded image. Now copy the link and close the upload window. Then insert the copied image url into the Image 1 field we created earlier. Continue this process for all the slides you want to appear in the slider.

Once all the links are filled, your slider creation screen will look like the following.

wpdd_part3_7

Saving Slider Images

We have uploaded and inserted the images into the slider. Now images need to be saved to the database. Even though image fields are in the slider creation screen, it won’t be saved automatically when the post is saved. We have to use a simple code to insert the data into the database as shown below.


add_action('save_post', 'fwds_save_slider_info');

function fwds_save_slider_info($post_id) {

    // verify nonce

    if (!wp_verify_nonce($_POST['fwds_slider_box_nonce'], basename(__FILE__))) {

       return $post_id;

    }

    // check autosave

    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {

       return $post_id;

    }

    // check permissions

    if ('slidesjs_slider' == $_POST['post_type'] && current_user_can('edit_post', $post_id)) {

       /* Save Slider Images */

       //echo "
";print_r($_POST['gallery_img']);exit;

       $gallery_images = (isset($_POST['gallery_img']) ? $_POST['gallery_img'] : '');

       $gallery_images = strip_tags(json_encode($gallery_images));

       update_post_meta($post_id, "_fwds_gallery_images", $gallery_images);

    } else {

       return $post_id;

    }

}

We call a custom function on save_post action to save the image details to the database. update_post_meta function is used to save these details into the _fwds_gallery_images key. I’ll show you the things you need to know in this section as it might be little complex for the beginners in design.

Things to Focus

  • When you are saving different types of posts like sliders, accordions,tabs, make sure to create new function on save_post action and use this block of code.
  • Inside the check permission section, use your own post type instead of slidesjs_slider.
  • Use your own unique key like _fwds_gallery_images to save the data into the database.

Now when the slider is published, all the images will be saved to the database. Then click on the Sliders section from the left menu and you will get a list shown in the following image.

wpdd_part3_8

You will be able to see a separate shortocde in front of each slider you create. You can use these to generate sliders once we complete the following section.

Generating Slider Using Uploaded Section

In the previous part we used a shortcode function to include images to the slider as shown in the following code.


add_shortcode("1wd_slider", "fwds_display_slider");
function fwds_display_slider() {

 $plugins_url = plugins_url();

 echo '
<div class="container">
<div id="slides"><img alt="" src="'.plugins_url( 'img/example-slide-1.jpg' , __FILE__ ).'" />
 <img alt="" src="'.plugins_url( 'img/example-slide-2.jpg' , __FILE__ ).'" />
 <img alt="" src="'.plugins_url( 'img/example-slide-3.jpg' , __FILE__ ).'" />
 <img alt="" src="'.plugins_url( 'img/example-slide-4.jpg' , __FILE__ ).'" />
</div>
</div>

';
}

As you can see all the images are hard coded in this version. Now we have the option of using dynamic sliders as well as dynamic images. So let’s move into implementing the shortcode.


add_shortcode("1wd_slider", "fwds_display_slider");

function fwds_display_slider($attr,$content) {

    extract(shortcode_atts(array(

               'id' => ''

                   ), $attr));

          $gallery_images = get_post_meta($id, "_fwds_gallery_images", true);

          $gallery_images = ($gallery_images != '') ? json_decode($gallery_images) : array();

          $plugins_url = plugins_url();

         $html = '
<div class="container">
<div id="slides">
';

 foreach ($gallery_images as $gal_img) {

 if($gal_img != ""){

 $html .= "<img alt="" src="&quot;.$gal_img.&quot;" />";

 }

 }

 $html .= '

</div>
</div>
';

     return $html;

}

Now we use the post ID passed to the shortcodes to retrieve the images dynamically. Then we assign each image to the slider using a foreach loop. Finally we return the resulted slider to be displayed inside our pages.

Things to Focus

  • You can use get_post_meta function with specific key to load any kind of details saved in the database.
  • We can pass any number of attributes to shortcode and you have to include them inside the extract function to retrieve the values.
  • Here we are getting image links from database. You can get and save any type of information using the get_post_meta function according to your shortcode type.

Now we have completed our slider plugin for this part and you can try creating sliders with different images. Once created, copy the shortwcode from the list and insert into a post or page to see it in action.

Following image shows the preview of our slider in the TwentyElevan theme.

wpdd_part3_9

Whats Next?

In this part we completed the slider functionality. Now its dynamic and effective to suit various types of sections in your web pages.

What about sizes, effects, speeds of sliders?

Definitely a plugin becomes much more user friendly and customizable when you have options to choose and settings to define it’s features. So in the next part we will be adding options to our slider to complete the initial part of this plugin development series.

By the end of next part you will be able to create basic WordPress plugins for UI components using the techniques discussed here. Until then I hope you will practice these theories with different sliders.

Can You Solve These?

In the previous part I asked you to fix the responsive issues in the slider. In this part I provided more questions to solve and learn. Try the following and let me know how it goes.

  • Can you insert options into slider and use it inside shortcodes?
  • SlidesJS slider does not play automatically. Can you find how it can be set to slide automatically?

Looking forward to your answers.

Wrap Up

In this part I was forced to omit explanations for each and every code line due to the complexity it can cause for you as web designers. Your focus should be on using this code and creating different types of sliders as well as other components without worrying too much about the complex codes.

By now you should be able to insert another type of slider into the same plugin with the instructions I gave on the Things to Focus sections.

Let me know how it goes and any help you need in making different sliders using this plugin.

March 25 2013

13:00

WordPress Plugin Development Course for Designers – Part 2

In the first part of our WordPress Plugin Development Course for Designers we learned about the importance of WordPress plugins for designers and its base structure. Today we are going to talk about the core WordPress theories and techniques required for creating design focused plugins.

Our final goal is to learn WordPress plugin development while integrating a jQuery slider into WordPress from scratch. Throughout this tutorial, we will be learning the necessary coding techniques using sample slider as the example. By the end of this tutorial, you will have a simple template which is common to most of the design based plugins.

Voting for the slider is still going on and SlidesJS is heading the list. So we will be using SlidesJS the slider for explaining necessary codes in this part.

So let’s get started.

What type of files are needed for Design Based Plugins?

Consider the following image which illustrates the files in a common plugin for creating design based components.

wp1stw2d copy

As you can see JavaScript and CSS will be kept in separate folders inside the main plugin. The main PHP file contains the plugin definition and the important initialization functions of the plugin. If you are developing a single file plugin, all the codes will be kept inside the main PHP file.

Although HTML is the most important type of file for you as designers, it doesn’t show up as separate files in the given screen. Actually there won’t be any HTML files inside the WordPress plugin. All the necessary HTML codes are generated through PHP files.

The preceding screen shows the basic folder and file structure of a WordPress plugin. We can add necessary libraries and additional files to modularize our plugin to increase the reusability.

Understanding the Components of Slider

Throughout this series we will be integrating a jQuery slider plugin to learn WordPress plugin development. Therefore it’s important to get used to the main components of a jQuery slider as shown in the following.

  • jQuery library - We need a core library to develop plugins. jQuery is chosen as the core library for the plugin used in this series. You have the freedom to work with other core libraries such as Prototype, Dojo, MooTools, etc.
  • jQuery plugin file - Every plugin has a main file which is built on top of the jQuery library. Usually we have all the codes for a jQuery plugin inside single JavaScript file.
  • Intialization code - All the plugins need to be initialized at some point to make it work. Generally we use inline scripts in the HEAD section of the HTML document to include the initialization code.
  • CSS files used for plugin - Most of the content or image sliders uses CSS to provide slide transitions and animations. Therefore we have CSS files specific to plugins to provide the default look and feel of the sliders.
  • HTML or Images used for sliding - Final component of a slider is the actual text, image or HTML content which gets converted into a slider by the plugin. Unordered list with HTML and images is the most popular technique of defining the data required for the slider.

Now we have identified the main five components of a jQuery slider plugin. Let’s focus on learning how each of these components fit into an actual WordPress plugin.

Including Scripts in WordPress Plugins

Our slider plugin contains two JavaScript files at the moment and will have the third one for plugin initialization code. Most of the beginner developers makes the mistake of including scripts incorrectly inside WordPress plugins. So this section will focus on identifying the mistakes and learning how to avoid those mistakes in order to comply with the best practices.

I assume that most of the readers of this tutorial will be designers. So let’s see how we include script files in static HTML websites.

<html>
  <head>
    <script type='text/javascript' src='http://code.jquery.com/jquery-latest.min.js'></script>
    <script type='text/javascript' src='jquery.slides.min.js'></script>
    <script type='text/javascript'>
          jQuery(function() {
             jQuery('#slides').slidesjs({
                width: 940,
                height: 528,
                navigation: false
              });
          });
    </script>
  </head>
  <body>

  </body>
</html>

We basically hard code all the script files into HEAD section of the HTML document or footer section. This is not a problem at this stage since we are building static websites. Now let’s see how these scripts are included in WordPress plugin by developers who are not experienced in WordPress.

The Wrong Way of Including Scripts

Most inexperienced developers directly includes the scripts inside the PHP files using the echo statement as shown in the following code. This is considered as a bad practice in WordPress plugin development.

function fwds_scripts(){
   echo "<script type='text/javascript' src='http://code.jquery.com/jquery-latest.min.js'></script>";
   echo "<script type='text/javascript' src='jquery.slides.min.js'></script>";
}

The code prints the script files anywhere in the HTML file. It can be header, footer or body depending on location you place it. Even though we have a separate header for WordPress themes, it’s not wise to hard code the files in the header.

In static websites you can manage these files since you will be the only designer. WordPress has a plugin based architecture and hence anyone can write plugins. Therefore there is a high possibility of duplicating the same files with the technique mentioned above.

The Right Way of Including Scripts

Now we are going to look at the right way of including scripts, considering the limitations in above technique. WordPress came up with a concept called action hooks which will be executed at specific points of a request or when a specific event occurs in your system. You can define a functions to be called in these execution points.

It will take time to understand the complete concept of WordPress action hooks, even for an experienced WordPress developer. For the moment think of it as a code that calls PHP function at specific points. Consider the following code.

<?php
function my_custom_function() {
    // Place the code to be executed here
}

add_action('action name', 'my_custom_function');
?>

We can replace the action name with predefined WordPress hooks or using our own custom hooks. You have to use different functions to different actions. In depth knowledge of action hooks will be provided in future tutorials when you get comfortable with basics of plugin development.

Now let’s switch back to the correct method for including scripts. WordPress provides a predefined hook called wp_enqueue_scripts to include script files into pages. Inside our custom function we have to include the scripts one by one. Consider the following code.

<?php

add_action('wp_enqueue_scripts', 'fwds_scripts');
function fwds_scripts() {

  wp_enqueue_script('jquery');

  wp_register_script('slidesjs_core', plugins_url('js/jquery.slides.min.js', __FILE__),array("jquery"));
  wp_enqueue_script('slidesjs_core');

  wp_register_script('slidesjs_init', plugins_url('js/slidesjs.initialize.js', __FILE__));
  wp_enqueue_script('slidesjs_init');

}
?>

Preceding code calls the fwds_scripts function in the execution process using the wp_enqueue_scripts action. I have used fwds(first web designer slider) as the prefix for my functions.

It is recommended to prefix your plugin functions with string related to your plugin name to avoid conflicts with functions in other plugins.

Inside fwds_scripts, we have used two other functions for including script files called wp_enqueue_script and wp_register_script. wp_enqueue_script is used to include the script file to the HTML document. jQuery is one of the libraries which comes in-built with WordPress and hence we can include it directly as shown in the code. Latest version of jQuery will be included in this technique.

wp_register_script is used to register a script file into WordPress. We have to register the slider plugin file and initialization file since it is not built-in with WordPress. First parameter is a unique name to register your library. Next you have to provide the path of the js file. plugins_url function will provide the URL of the plugin folder.

Third parameter specifies the dependent libraries. In this scenario, our plugin file depends on the jQuery library. We don’t have to manage dependencies with this technique. Before registering any script, WordPress checks whether it has been already registered using the given unique name. File is loaded only when it’s not loaded previously. So it will prevent the file duplication discussed in the earlier section.

If you register the same script file with different names, WordPress will not be able to handle the file duplication.

SlidesJs core plugin file is named as jquery.slides.min.js and we have included it in the preceding code. Also we have included the initialization part of the library inside another js file called slidesjs.initialize.js. Following code contains the initialization code inside the js file.

jQuery(function() {
      jQuery('#slides').slidesjs({
        width: 940,
        height: 528,
        navigation: false
      });
});

There are various other recommended ways of including scripts files without using wp_enqueue_scripts action hook. Technique discussed here is good enough for us to learn plugin development as designers. I will also cover the other techniques when required.

Including Styles in WordPress Plugins

Usually most of the jQuery plugins comes up with built-in CSS file to provide its default look and feel. As designers we are used to including CSS files directly in the HTML document. So the beginners of WordPress plugin development tries to apply the same method as I discussed in JavaScript section.

The Wrong Way of Including Styles

Consider the following code to see how beginners include CSS files in WordPress plugins.

function fwds_styles(){
    echo <link rel='stylesheet' href='example.css' type='text/css' media='all' />";
    echo <link rel='stylesheet' href='font-awesome.min.css' type='text/css' media='all' />";
}

The code will include style files everywhere in the HTML document without considering file duplication. This works exactly the same way how JavaScript worked.

The Right Way of Including Styles

Recommended method of including style files is exactly similar to the method we discussed for JavaScript files. wp_enqueue_scripts action will be used again with different function name to include the styles as shown in the following code.

add_action('wp_enqueue_scripts', 'fwds_styles');
function fwds_styles() {

  wp_register_style('slidesjs_example', plugins_url('css/example.css', __FILE__));
  wp_enqueue_style('slidesjs_example');
  wp_register_style('slidesjs_fonts', plugins_url('css/font-awesome.min.css', __FILE__));
  wp_enqueue_style('slidesjs_fonts');

}

We have to use wp_register_style and wp_enqueue_style in this case instead of script functions. Usage and parameters are exactly similar to script functions.

In this part, we are using SlidesJS for implementing the slider plugin. SlidesJS comes up with two CSS files for styles neccessary for look and feel of the presentation and including fonts.

Now we know the basics of including scripts and styles of the jQuery plugin inside the WordPress plugin. Generally we place the initialization code for a plugin, inline within script tags in static HTML files. With WordPress, it’s better to add it to an existing js file or include in a new js file and load using the recommended way.

Assigning Content to Slider Using Shortcodes

Shortcodes can be considered as an alias for reusable piece of code. First we have to define the common code inside a PHP function. Then we can access it anywhere in themes, plugins or page editor by using the alias given for function. Consider the code below for most basic use of WordPress shortcode.

add_shortcode("my_shortcode", "my_shortcode_function");

function my_shortcode_function() {
  return "<h1>Hello Shortcodes</h1>";
}

WordPress provides a built-in method called add_shortcode for defining shortcodes. First parameter is the name (alias) of the shortcode. Second parameter contains the function to be executed when the shortcode is requested. We return a simple string from the shortcode.

Some developers like to directly print the output of the shortcode inside the function. You should always prefer returning output from function and printing externally as shown in the preceding example.

Then you can use [my_shortcode/] to refer the common code in multiple locations. Folowing screen shows how you can use a shortcode inside the post or page editor in WordPress.

shortcodes_editr

Shortcodes can be used inside theme or plugin files with do_shortcode function as shown below.

 <?php echo do_shortcode('[my_shortcode]') ?>

Advanced Usage of Shortcodes

In the previous example, we used the most basic form of shortcode. We can also have attributes and content in shortcodes to add additional features. Consider the following shortcode with attributes and content.


[my_advanced_shortcode name="Nimesh" age="27"] Description about me [/my_advanced_shortcode]

These types of shortcodes contain opening and closing shortcode tags. Information placed between the opening and closing tags is considered content and key-value pairs inside the opening tag is considered as attributes. Following code shows how we can extract these information inside the actual shortcode function.

function my_advanced_shortcode_handler( $atts, $content = null ) {
   extract( shortcode_atts( array(
      'name' => 'Rakhitha',
      'age' => '20'
      ), $atts ) );

   echo $name;
   echo $age;
   echo $content;
}

Content and attributes of the shortcodes will passed as the default parameters to shortcode function. We can directly use the content using the $content variable. Here you will get “Description about me” as the content.

Handling attributes is not straightforward as content. We have to extract each attribute from the $attr array. We can use the extract function as shown here. We define all the attribute with the default values. If attributes are supplied with shortcodes, default value will be replaced by passes value. Finally you can access these attributes using $name and $age.

Integrating Slider Using Shortcodes

In the previous sections we discussed how scripts, styles and initialization code fits into a WordPress plugin. Final part of the slider will be the actual HTML or images used as the content for sliding. Shortcodes will be the ideal method for providing slider content. Now let’s see how images fit into the shortcode.

add_shortcode("1wd_slider", "fwds_display_slider");
function fwds_display_slider() {

  $plugins_url = plugins_url();

  echo '<div class="container">
    <div id="slides">
      <img src="'.plugins_url( 'img/example-slide-1.jpg' , __FILE__ ).'" />
      <img src="'.plugins_url( 'img/example-slide-2.jpg' , __FILE__ ).'" />
      <img src="'.plugins_url( 'img/example-slide-3.jpg' , __FILE__ ).'" />
      <img src="'.plugins_url( 'img/example-slide-4.jpg' , __FILE__ ).'" />
      <a href="#" class="slidesjs-previous slidesjs-navigation"><i class="icon-chevron-left icon-large"></i></a>
      <a href="#" class="slidesjs-next slidesjs-navigation"><i class="icon-chevron-right icon-large"></i></a>
    </div>
  </div>';
}

Now we have integrated all the necessary parts into WordPress plugin. But we still have a slider with static content. Real power of plugin comes when we can add the slider content dynamically and create multiple sliders to use in multiple locations.

Now you can download the static version of WordPress slider plugin here. Copy the downloaded plugin into plugins folder and activate using the admin dashboard. Then create a post or page and insert [1wd_slider/] in the TinyMCE editor and click the publish button to see the slider in action. You will be able to use the navigation button to see how sliding works.

So try out the static version of slider plugin for multiple jQuery libraries using the following template we created throughout this tutorial.

<?php

/*
Plugin Name: 1WD Slider
Plugin URI: http://1stwebdesigner.com/
Description: Slider Component for WordPress
Version: 1.0
Author: Rakhitha Nimesh
Author URI: http://1stwebdesigner.com/
License: GPLv2 or later
*/
function fwds_slider_activation() {
}
register_activation_hook(__FILE__, 'fwds_slider_activation');

function fwds_slider_deactivation() {
}
register_deactivation_hook(__FILE__, 'fwds_slider_deactivation');

add_action('wp_enqueue_scripts', 'fwds_scripts');
function fwds_scripts() {

  wp_enqueue_script('jquery');

  wp_register_script('slidesjs_core', plugins_url('js/jquery.slides.min.js', __FILE__),array("jquery"));
  wp_enqueue_script('slidesjs_core');

  wp_register_script('slidesjs_init', plugins_url('js/slidesjs.initialize.js', __FILE__));
  wp_enqueue_script('slidesjs_init');

}

add_action('wp_enqueue_scripts', 'fwds_styles');
function fwds_styles() {

  wp_register_style('slidesjs_example', plugins_url('css/example.css', __FILE__));
  wp_enqueue_style('slidesjs_example');
  wp_register_style('slidesjs_fonts', plugins_url('css/font-awesome.min.css', __FILE__));
  wp_enqueue_style('slidesjs_fonts');

}

add_shortcode("1wd_slider", "fwds_display_slider");
function fwds_display_slider() {

  $plugins_url = plugins_url();

  echo '<div class="container">
    <div id="slides">
      <img src="'.plugins_url( 'img/example-slide-1.jpg' , __FILE__ ).'" />
      <img src="'.plugins_url( 'img/example-slide-2.jpg' , __FILE__ ).'" />
      <img src="'.plugins_url( 'img/example-slide-3.jpg' , __FILE__ ).'" />
      <img src="'.plugins_url( 'img/example-slide-4.jpg' , __FILE__ ).'" />
      <a href="#" class="slidesjs-previous slidesjs-navigation"><i class="icon-chevron-left icon-large"></i></a>
      <a href="#" class="slidesjs-next slidesjs-navigation"><i class="icon-chevron-right icon-large"></i></a>
    </div>
  </div>';
}
?>

Demo and Challenge

1wd-wordpress-plugin-development-course

If you want to see the working version of what we have created so far, you can check the demo here.

Now, here’s a challenge to you:

If you have installed the plugin and checked, you will notice that it occupies a full width of 940px. And on our demo site the slider has overlapped the sidebar because of this. Question is, can you make it responsive on your own? It’s easy!

The answer will be revealed on the next instalment of our WordPress Plugin Development Course for Designers, watch out for it!

Up Next

In the next part we will be creating the actual integration of jQuery plugin into WordPress. Instead of just hard coding HTML or images inside unordered lists, we will be creating sections to upload images dynamically and create multiple sliders by selecting preferred images.

Until then I would like to suggest following resources to get an idea about the contents in the next part of this tutorial series.

Now it’s your turn.

Integrate various other sliders using the technique we discussed today. Now don’t worry about sliders being static at the moment. I will explain how to make it dynamic and reusable in the next part.

Let me know about the type of sliders you tried and any difficulties you faced in applying the discussed technique.

March 22 2013

17:03

15 Cool Pinterest Plugins For WordPress

Do you want to increase your WordPress websites traffic? If your answer is yes then you should use Pinterest Plugins. These Pinterest Plugins will make your WordPress site more exciting and lively. Website users can easily generate events, interests, hobbies, and much more with these Pinterest Plugins.

In this post, we are sharing 15 awesome and useful Pinterest Plugins for WordPress website. With these WordPress plugins, you can get your posts, images and even your website pinned over in the Pinterest network. You can also tell us what you think about this post and share your precious opinions with us via comment section below. Check this out and get to pick one!

Pinterest Badge

| Download )

A must have plugin that adds a Pinterest badge for linking your blog to your pinterest profile and showing your number of followers.

Pinterest Image Pinner From Collective Bias

| Download )

Extremely lightweight jquery based plugin. Adds “Pin This” button to all images.

Pin It On Pinterest

| Download )

Pin It On Pinterest places a Pin It button at the end of your posts, and allows you to predetermine what gets “Pinned” at Pinterest.

Pinterest Block

| Download )

Block selected posts and pages from getting pinned on Pinterest.

Pinterest RSS Widget

| Download )

A widget to display thumbnails and titles of the latest Pinterest Pins from a specific user via their Pinterest RSS feed.

Pinterest “Follow” Button

| Download )

Add a Pinterest “Follow” button to your sidebar with this widget.

Pinterest Pinboard Widget

| Download )

A simple must-have widget for the Pinterest addict! Displays thumbnails of your latest Pinterest pins on your website.

Pretty Pinterest Pins

| Download )

A plugin to show off images, captions, and links from your latest Pinterest activity.

Pinterest “Pin It” Button

| Download )

Easily add a Pinterest “Pin It” Button to your site and encourage your visitors pin your awesome content.

Skysa Pinterest “Pin It” App

| Download )

Let people share (pin) images from any page of your site on Pinterest.

Pinterest Lightbox

| Download )

Add Pinterest to the NextGEN Gallery plugin.

Pinterest Plugin

| Download )

Show the Pinterest “Pin It” button on top of your images, only when people move their mouse over the image.

My Pinterest Badge

| Download )

A must have plugin that adds a Pinterest badge on your blog to your pinterest profile and showing your number of followers and recent pins.

Pinterest Pin It Button For Images

| Download )

Add a “Pin It” button over your images, so users can add it to Pinterest easily.

Pinterest Image Pin

| Download )

Adds Pinterest button to individual images for one by one image pinning. Enjoy

March 13 2013

13:00

WordPress Plugin Development Course for Designers – Part 1

I assume that you are a freelance designer or someone who work full time as a designer for a web design agency. Most of web designers are used work with static website design.

Now the question is: do you have a future as a static website designer?

The answer would probably be no since most clients and companies are planning to convert their websites to work with a CMS like WordPress, Joomla or Drupal.

WordPress is becoming the new static web site.

WordPress integration is simple enough that almost anyone can setup a WordPress site with an auto installer program. Unless you are familiar in working with a CMS like WordPress, you will definitely face issues moving further as a freelance designer.

WordPress Plugin Development Course for Designers – What to Expect

Being a designer, your main focus should be to learn WordPress theme design and development. But clients are never going to be satisfied, even if you build their websites with professional theme and design. They will ask you for more and more features as they know that it’s easier to build things with WordPress.

WordPress plugins are a quick and easy solution to wrap your site with additional functionality such as social integration, breadcrumbs, Google Maps, etc. If you are not familiar with using and customizing plugins, you will have to need the support of a developer to keep clients from going from you and go looking for another developer who is capable of providing both design and development tasks.

Hiring a developer and creating the custom functionality can be costly for you as a freelance designer. So you should be thinking about learning the skills of plugin development.

What Can You Expect From Us?

So often we see tutorials for learning WordPress plugin development focused on developers. Here we are going to approach it differently by looking at WordPress plugins development from designers perspective. So everything will be created and explained from scratch.

Initial part of this tutorial series will consist of four parts, where we will learn WordPress Plugin Development from scratch. Throughout the series we will be developing a WordPress plugin to integrate your favorite jQuery Slider. Final output will be a complete slider plugin for WordPress, which you use in any part of the CMS.

Let’s take a look at the 4 parts of the series.

  1. Understanding WordPress Plugin Structure
  2. Basics for Creating WordPress Plugin Template
  3. Integrating Your Favorite Slider into WordPress
  4. Enhancing WordPress Plugins with Add On Features

Today we are going take on the first part on the tutorial series. So Let’s get started.

Understanding WordPress Plugin Structure

WordPress plugins lets us create additional functionality without affecting the core system. As designers, our main focus should be to develop quality front-end plugins with awesome designs rather than developing highly technical back-end plugins to provide complex functionality. So it’s important to know the basic structure,initial components and functions of a plugin to get things started.

What are the prerequisites?

Throughout this series you will have to work with technologies like PHP, JavaScript, and MySql. It’s ideal to have basic knowledge of those technologies, although it’s not mandatory. As designers, I don’t expect you to have knowledge on working with server side technologies and databases. But basics of JavaScript will be handy and I assume you have the basic idea.

Should You Create Plugins from Scratch?

I think the answer should be no, in situations where you can find a free plugin to implement the required features. WordPress plugin repository is full of plugins with wide range of capabilities. It’s much easier to find a plugin from the repository rather than creating from scratch.

Even though the repository contains around 20,000 plugins, there is no guarantee that there will be plugins to suit each and every requirement in your projects. In such cases you will have to either modify an existing plugin or write your own plugin from scratch.

Components of WordPress Plugin

We will be focusing on creating web design related plugins throughout this series. So these plugins will have some kind output to the browser using combination of HTML, CSS and JavaScript. This will be considered as the front-end component of the plugin.

Usually we need to change the design components with dynamic data. Therefore we have to create a custom section inside WordPress Admin panel to enter dynamic data and options. This data creation section can be considered as the back-end component of the plugin.

Let’s take a look at the back-end and front-end of a premium slider plugin from Themeforest.

Frond-end of the Plugin

wpbs_08

Back-end of the Plugin

wpbs_09

You can see how these components are used effectively in professional plugins. Simplest plugins will not require a back-end component. Here we will be creating a slider with both front-end and back-end components.

Creating Your First Plugin

First we have to know where to create plugins inside the WordPress installation. WordPress consists of 3 main folders called wp-content, wp-admin and wp-includes. The following screenshots previews the files and folders available inside WordPress installation. Our focus will be on the highlighted wp-content folder, where we install our themes and plugins.

wpbs_04

Inside wp-content, you will find another folder called plugins. Now switch to plugins folder and you will see few default plugin folders created by the WordPress installation. This will be the place where we create our own plugins. Following screen shows the list of folders available inside wp-content folder.

wpbs_03

We can directly create a plugin inside the plugins folder by including the plugin file. But the recommended method is to create each plugin in a separate folder inside the plugins folder.

So let’s name our plugin as 1WD Slider and create a folder called 1wd-slider. It’s important to know that there is no restriction on naming the plugin folder. I prefer using the plugin name as the folder name for keeping consistency. The following image shows our plugin folder inside the plugins.

wpbs_02

Creating Plugin File

Plugins can contain any number of files as you want. For the purpose of this tutorial, I am going to create the plugin as a single PHP file. So create a file called 1wd_slider.php inside your plugin folder. Once again there are no restrictions in naming plugin files. Having created plugin folder and file, let’s see how it displays on WordPress plugins list.

Login to your WordPress account as admin and click on Plugins tab on the left to get a list of available plugins.

wpbs_05

Surprisingly, the plugin list does not show our plugin. What is the reason?

Even though we created both plugin folder and file, we did not inform WordPress to consider it as a plugin. We have to add a PHP comment in predefined format on top of the file to make it a WordPress plugin. Open the 1wd_slider.php file and insert the following PHP comment.

<?php
/* Plugin Name: 1WD Slider
Plugin URI: http://1stwebdesigner.com/
Description: Slider Component for WordPress
Version: 1.0
Author: Rakhitha Nimesh
Author URI: http://1stwebdesigner.com/
License: GPLv2 or later
*/
?>

As a designer you might not be familiar with PHP codes, hence I’ll explain the code in detail. Tags <?php and ?> is used respectively for opening and closing PHP codes. This is similar to script tags in JavaScript. Anything you place between these tags will be executed as PHP codes.

Then we have a multiple line comment which is similar to comment syntax in JavaScript. We can use /* */ for multiple line comments and // for single line comments.

Inside the comment we have defined plugin details in key value structure. Basically Plugin Name will be the most important and mandatory parameter. Once you set the Plugin Name, WordPress will identify your file as a plugin to display in the plugin list. Following screen contains our plugin with complete details.

wpbs_06

Now let’s go through the remainder of parameters by comparing with the screen.

  • Plugin URI – is used to let users know about the details of the plugin and available download options. This isn’t mandatory and you can keep it blank, if you don’t have an intention of making the plugin publicly available.
  • Description – is used to provide a summary of functionality of the plugin.
  • Version – is used to define the version and you can use any numbering format as you wish. Plugins need be upgraded with each WordPress version upgrade. Therefore it’s good to have proper version numbering even though it’s not mandatory.
  • Author and Author URI – is used to provide details about the developer of the plugin.
  • License – is used to define the conditions for using this plugin. We can include standard licence such as GPL2 or just mention something we prefer such as Free to use.

We don’t need to consider about the parameters other than plugin name, in case we are not making the plugin publicly available for use.

Now we have our first WordPress plugin, even though it doesn’t do anything at the moment. We can activate or deactivate plugins from the plugin list.

Let’s discuss more on plugin activation.

WordPress Plugin Activation and Deactivation

Plugins will be on inactive status by default. We can click on the activate link under the plugin name to activate the plugin. Once the plugin is successfully activated, its features will get effected to your website.

Also you should be able to see deactivate link instead of activate link after a successful activation. Clicking the deactivate link will revert the status of the plugin to its original inactive status.

wpbs_07

What Can We Do on Activation/Deactivation

Think about a real world scenario where you activate premium membership of a club or library. Obviously you will get added benefits on activation and you will lose those benefits on deactivation. Similarly we can execute some tasks on plugin activation and deactivation.

WordPress provides a concept called hooks, where you can trigger certain tasks to add new behavior or modify existing behavior. So let’s look into the code for activation and deactivation hooks.

function fwds_slider_activation() {
}
register_activation_hook(__FILE__, 'fwds_slider_activation');
function fwds_slider_deactivation() {
}
register_deactivation_hook(__FILE__, 'fwds_slider_deactivation');

Above code contains two functions called fwds_slider_activation and fwds_slider_deactivation. PHP function is a reusable piece of code where we can execute multiple times. Even as a designer you might have a basic idea about functions since PHP functions are similar to JavaScript functions.

Then we have the two hooks called register_activation_hook and register_deactivation_hook. Don’t worry too much about hooks as you will understand them while learning about plugin development in this series. For the moment just define these hooks with plugin specific activation and deactivation functions and execute necessary codes inside the function.

Why Do We Use Activation/Deactivation Hooks

We can create basic plugins without considering activation and deactivation functions. But advanced plugin will require these functions to provide additional features.

Following is a list of possible things we can do inside plugin activation/deactivation.

  • Create custom database tables on activation to store data and remove tables on deactivation.
  • Create custom options for plugins and activation and reset in deactivation.
  • Validate other dependent plugin on activation.
  • Any other necessary task you need to execute in activation.

Now we have discussed the importance of WordPress plugins for designers and its structure. From next part onwards we will be digging into the technical aspects of WordPress plugins.

Don’t be afraid of complex PHP or JavaScript codes since I will be covering all the necessary details about those codes in a simplified manner to suit web designers.

Time to Take the Poll

I mentioned that we will be covering the theories of WordPress Plugin Development for designers, by creating a complete plugin to integrate a jQuery slider. This tutorial series is meant for you and hence I want to know about your preferred slider instead of going with my favorite.

So make sure to vote for your favorite slider plugin as I’ll be using the most voted plugin for the development to this tutorial. ( Vote for Rhino Slider as it’s my favorite :))

Vote for Your Favorite Slider

Following is the list of sliders available for voting with preview images.

nivo slider

Rhino Slider

rhino slider

flex slider

slidesjs

Coming Up

In the next part we will be digging into the actual code to learn the necessary functionality for creating a plugin. WordPress core functions needed to implement plugins will be discussed in detail from designers perspective. Throughout the next part we will be building a template for creating design based plugins. Until then I suggest that you read the following resources and get an ideas about plugin development.

You can grab a copy of the plugin here. The plugin does not include any functionality yet. So you can only see how it activates and deactivates using WordPress admin.

I have made my explanations in a simplified manner to suit web designers. Still I know that it can be difficult for designers who basically concentrate on HTML, CSS without considering JavaScript.

So let me know anything you didn’t understand through the comment section and I’ll get back to you with much more simplified explanations. Also let me know what is your preferred slider and why you voted for it.

Looking forward to hearing from you.

February 25 2013

08:00

How To Clean Up & Optimize Your WordPress Install

WordPress is a pretty robust application that is kept up to date with regular bug fixes and security patches, but it really benefits from a bit of maintenance to keep it running fast and efficiently. Over time WordPress saves snippets of information to its database, which can become bloated with unnecessary values, thus slowing down your site and putting more stress on your server setup. In this post we’ll look at 10 ways you can give your WordPress install a spring clean to trim the fat and put everything in its place.

Backup your database

Hopefully you will already have some kind of database backup system in place. If not, your entire site is at a serious risk of being completely lost. There are lots of plugins available that not only make backups on command, but can also be set to take scheduled backups and send them to your email account. I recommend WP-DBManager for its combination of useful abilities. Before following any of the other steps in this post, make sure you have a current backup and ensure your saved backups aren’t all residing on your server.

Backup your files

The most important parts of your WordPress install are saved within your database, this includes the post content and all the options you’ve configured for your site. If you’re creating database backups you’ll have safe copies of all this information, but you should also be taking backups of the files on your server. Core WordPress files and plugins can all be re-downloaded from the web, but any images you’ve added to your posts will need backing up so they can be restored should the worst happen. Make manual backups of your wp-content > uploads directory using an FTP app, or use plugins such as WordPress Backup to Dropbox to make scheduled backups for you.

Remove unused settings from old plugins

If your site has been live for a number of years, think of all the plugins you’ve installed and since removed in that period of time. Well built plugins will clean up after themselves, but others might have left their settings as values in the options table of your database. These settings are useless if you’re not even using the plugin they’re related to, so clearing these out will shave a few kbs off your overall database size. I like to install and run the Clean Options plugin every now and again to view the list of values and remove any I know for sure aren’t in use.

Disable & delete post revisions

WordPress automatically saves multiple copies of your posts while they’re being written so they can be restored if an editing mistake is made. This can be quite handy if you’re running a multi-author blog, but for most of us it means there’s an insane number of duplicate posts bloating our databases. You can easily delete existing post revisions using plugins such as WP CleanFix and turn off the post revision feature by adding the following line to your wp-config file:

define('WP_POST_REVISIONS', false );

Delete unused Post Meta information

Every post in your database is saved with a collection of information. Such information can bloat your database with values that are no longer relevant. One such example is the Post Meta Edit Lock values which prevent a post from being altered if another author is currently working on the same post. Seeing as I’ve never used multiple authors this meant every post in my database had a series of lock values associated with it. Deleting these saved a few hundred kbs. The WP CleanFix plugin also has the ability to check and remove these options built right in.

Disable image resizing

Whenever you upload an image using the built-in media tools of WordPress it automatically generates a thumbnail, medium and large variants. If you prepare your images beforehand at the correct dimensions these images are just taking up more and more space on your server. They’re not causing any major harm and don’t slow down your website, but they will make file backups take much longer. Stop these duplicates from being created by changing the dimensions of the thumbnail, medium and large settings to 0 under Settings > Media.

Empty the spam queue

The Akismet plugin does a great job of capturing spam comments before they go live on your posts. Since we don’t see this spam we often don’t think to empty the net. Every spam comment is saved so you can make the final decision as to whether it was wrongly accused, it’s not until you actually empty the spam queue that you’re saving this extra space in your database. Head to Comments > Spam and hit the Empty Spam button to nuke all the junk in a single click.

Reduce spam by closing comments

If you’re running a fairly large site you’ll know that discussion tends to drop on posts as they get older. Usually the only comments added to posts way back in your archives are dirty spam messages, so a simple fix to avoid letting this add bloat to your database is to close comments after a number of weeks. Under Settings > Discussion check the option of Automatically close comments on articles older than X days and enter your desired time period to allow discussion on your latest posts.

Optimize your database

After deleting so much bloat and removing hundreds of unnecessary values your database will now benefit from optimization more than ever. Optimizing your database essentially defrags it and reclaims the unused space. Many of the plugins we’ve talked about so far include a Repair and Optimize feature. WP-DBManager in particular is a good choice that includes the option of scheduled optimization every month.

Check your security

After a good spring clean it makes sense to give your site’s security a quick check over. Use the WP Security Scan to check for vulnerabilities in your setup and protect yourself from common brute-force attacks with the likes of the Login Lockdown plugin.

August 23 2012

13:00

Create an Author Comments Feed in WordPress

In recent years blogs have become so popular that and they’re one of the most common ways people get their daily dose of information. It’s not possible for a single person to provide quality content everyday. As a result, major websites are accepting  guest authors to provide quality content on a regular basis.

Authors play a vital role in these multi-author blogs since they are responsible for providing up-to-date content for their readers. Once a post is published, the author has to respond to comments, fix the issues and update the content according to the latest trends. As an Author, it is important to respond to user comments quickly. When a comment is made, only the administrator gets the notification email to approve the comments. But there is no default functionality to notify the author.

Authors have to view comments of each post regularly and I can tell you that is very hard if you have written a large number of posts. In this tutorial I am going to ease this task by creating an author comments feed for the comments of all posts written by a single author. Then you will be able to view all the comments in one place. So Lets get started.

Plugin Download

Creating The Author Comments Plugin

Although we can create our functionality in the functions.php file of the theme, it’s always recommended to create an independent plugin for custom functionality. So let’s create a folder called Author-Comments-Feed inside the wp-content/plugins folder and insert the following code to index.php file. It is used to provide information about the plugin.

/*
  Plugin Name: Author Comments Feed
  Plugin URI: http://innovativephp.com/
  Description: Generate RSS feed for comments on all the posts of a specific author.
  Version: 1.0
  Author: Rakhitha Nimesh
  Author URI: http://innovativephp.com/about/
  License: GPLv2 or later
 */

Now you will be able to see our plugin in the plugin list on the admin dashboard. So let’s move onto adding our RSS feed.

Adding Custom RSS Feed

WordPress provides a default set of RSS feeds for posts, comments, categories etc. Also we are allowed to create custom RSS feeds using the add_feed function. So let’s add our Author RSS feed.

function add_author_comments_feed() {
    global $wp_rewrite;
    add_feed('wp_author_comments', 'wp_author_comments_feed');
    add_action('generate_rewrite_rules', 'author_comments_rewrite_rules');
    $wp_rewrite->flush_rules();
}

add_action('init', 'add_author_comments_feed');
  • First we add add_author_comments_feed function to be called after WordPress has finished loading using the init action.
  • Then we add our feed using the WordPress add_feed function. We have to pass 2 parameters to this function.
  • First parameter will be the type of feed. I have named it wp_author_comments. Default feed types are RSS1, RSS2, ATOM.
  • Second parameter is the name of the function which is used to generate the RSS feed.
  • Then we have to define custom permalinks for the RSS feed. I have added author_comments_rewrite_rules function using the generate_rewrite_rules filter. I’ll explain these functions in the next section.
  • Finally we flush the rewrite rules structure using $wp_rewrite->flush_rules method to refresh the rewrite rule cache.

Lets move onto creating custom rewrite rules for Author Comments Feed.

Define Custom Rewrite Rules

If you are using the default URL structure of WordPress (using query strings), you don’t need to worry about this section. This section is essential if the site uses a custom permalink structure. So lets take a look at our author_comments_rewrite_rules function.

function author_comments_rewrite_rules($wp_rewrite) {

    $new_rules = array(
        'feed/(.+)/(.+)' => 'index.php?feed=' . $wp_rewrite->preg_index(1)
    );
    $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;

}
  • $wp_rewrite object has all the information about the rewrite rules and it will be passed to the author_comments_rewrite_rules function by default.
  • First we prepare the new rules for the custom feed. In our URL we need feed type and author username. So we define it as feed/(.+)/(.+) and redirect to index.php with feed parameter.
  • Finally we add our new rules to the original rules structure.

Now we are ready with our custom rewriting rules and its time to create the Author Comments Feed.

Generating Author Comments Feed

I am going to use “Universel Feed Writer class” library for generating RSS feed. You can download it here.

Once downloaded add the FeedWriter.php file and FeedItem.php file to your plugin directory.

Then make sure to include FeedWriter.php file in the top of the index file. Also we need slight modification to the autoload function in the downloaded library. Following code shows the default autoload function in the library.

function __autoload($class_name){
    require_once $class_name . '.php';
}

The code above will try to autoload every class in WordPress as well and will generate errors. So modify the above function with the following code to only autoload the classes related to the library.

function __autoload($class_name){
     if($class_name == 'FeedItem'){
         require_once $class_name . '.php';
     }
}

Now lets take a look at our wp_author_comments_feed function which generates the RSS feed.

function wp_author_comments_feed() {

    global $wpdb;

    $username = isset($_GET['auth']) ? $_GET['auth'] : array_pop(explode("/", $_SERVER['REQUEST_URI'])) ;

    $user = get_user_by('login', $username);

    $sql = "SELECT $wpdb->posts.guid,$wpdb->posts.post_title,$wpdb->comments.comment_author,
$wpdb->comments.comment_author_email,$wpdb->comments.comment_date,
$wpdb->comments.comment_content FROM $wpdb->posts inner join $wpdb->comments
on $wpdb->posts.ID=$wpdb->comments.comment_post_ID WHERE
$wpdb->posts.post_author=".$user->data->ID." and $wpdb->posts.post_status='publish'";

    $numComments = $wpdb->get_results($sql);

    $TestFeed = new FeedWriter(RSS2);

    $TestFeed->setTitle('Author Comments Feed of '.$user->data->display_name);
    $TestFeed->setLink('http://www.1stwebdesigner.com');

    foreach ($numComments as $key => $comment) {

        //Create an empty FeedItem
        $newItem = $TestFeed->createNewItem();

        $description = "Comment Author Name : $comment->comment_author <br/>
				Comment Author Email : $comment->comment_author_email <br/>
				Comment : $comment->comment_content <br/>";

        //Add elements to the feed item
        $newItem->setTitle("New Comment on " . $comment->post_title);
        $newItem->setLink($comment->guid);
        $newItem->setDate($comment->comment_date);
        $newItem->setDescription($description);

        //Now add the feed item
        $TestFeed->addItem($newItem);
    }

    $TestFeed->genarateFeed();exit;
}
  • First we have to get the author’s username using the URL. We have to consider both default and custom permalink structures here.
  • In default one URL will look like ?feed=wp_author_comments&auth=username. so we first check if the username is available in query string using the $_GET['auth']
  • We get the username for the custom permalinks by using array_pop(explode(“/”, $_SERVER['REQUEST_URI'])) which splits the URL components.
  • Then we get all the author information by passing username to get_user_by function.
  • Next we get all the comments for the posts written by the author using the join on posts and comments tables. Now we have an array of all the comments for all the posts written by the author.
  • Next we initialize the FeedWriter and set the title and link of the RSS feed. You can customize these values according to your preference.
  • Then we loop through each comment and sets the information for the feed by using setTitle, setLink, setDate, setDescription methods. Then we add items to the RSS feed using addItem function at the end of each loop.
  • Finally we call the genarateFeed function to create the RSS feed and print it to the browser.

Now we have the Author Comments Feed ready. Every author can access the comments feed using ?feed=wp_author_comments&auth=username or /feed/wp_author_comments/username depending on the permalink structure.

It’s important to notice that this plugin will only work with WordPress default comment system which stores the comments on wp_comments table. Plugin will not work with custom commenting systems like DISQUS.

Now authors have their own comment feed and the problem of responding to latest comments is solved. Lets see how we can improve this by using IFTTT.

Getting Email Notifications Using IFTTT

Even though we have a comment feed, it takes time to log into your RSS reader and look for the new comments on your posts. So lets see how we can use IFTTT services to get an email directly to your inbox when the comment feed is updated. First create an account in IFTTT.com and log into your account.

Then click on the Create button in the dashborad and you will get the following screen.

Create Recipe

Click this and you will get a list of channels in the bottom of the page as shown below.

Choose Incoming Channel

Choose Feed and you will get the next screen as following.

Choose a Trigger

Choose New Feed Item and you will be directed to enter the Feed URL.

Complete Incoming Trigger Fields

Enter the URL of the feed and you username in the format which I mentioned in earlier section and click Create Trigger button to get the following screen.

Choose Outgoing Channel

Click that and choose a channel as we did before. Since we want to get an email, its better to select Gmail from the list. You will be directed to the following screen.

Choose Outgoing Action

Click Send an Email to get to the following screen.

Create Action

Enter your email address and customize the content according to your preference. Finally click the Create Action button.

Now every time the feed is updated you will receive an email to your gmail account.This method will save you a lot of time in responding to comments. Hope you enjoyed it and feel free to share your comments.

Older posts are this way If this message doesn't go away, click anywhere on the page to continue loading posts.
Could not load more posts
Maybe Soup is currently being updated? I'll try again automatically in a few seconds...
Just a second, loading more posts...
You've reached the end.

Don't be the product, buy the product!

Schweinderl