Developer’s Network has taken the pledge to help WordPress pluging and theme developers with providing guidance and help with coding and theming. Developer’s Network will provide assistance with WordPress loops and of course! theme customization.
Writing a WordPress Plugin:
The ultimate and only goal of a WordPress plugin is to provide a specfic piece of functionality to the WordPress blog which enhances and makes easy to access wordpress content as well as automating some the pre-requisites. WordPress plugin can also alter/enhance existing features and functionality.
To write a WordPress pluging, we need to use plugin Api, which is a pre-defined collection of methods which can be used by the custom plugin. These APIs generally provides and interface to interact with WordPress core features and makes it easy to re-use the code and thus less coding to do.
WordPress is developed with PHP scripting language, so the foremost requriment in making of a WordPress plugin is that one should be aware of PHP scripting language. Also, if one is aware of WordPress workflow, it will be an added anvantage.
So, we gonna write an advanced plugin just to start with WordPress. It is assumed that you have already developed few WordPress plugings and looking for some big-big bang!!
So, we will develop a plugin which can add a dynamic (a changeable at admin’s will) footer content. The footer section of any website contains links to important pages and this can also help for better page rank in popular search engines.
Requirements:
- Develop a plugin with which, the content of the footer can be changed at will.
- There should be an admin side interface from where the admin can set the content for footer.
This should be very straight forward. Just adding/pasting some text or creating some links with provided interface. The text goes before the link in the footer. The ideal candidate links can be ‘terms & conditions’, ‘contact us’ and else such.
So, the very first step is to create a function which injects the content to footer
function footer_content($ss__text = NULL, $ss__links = NULL) {
if ($ss__text) {
// $ss__text is the string text which is added from admin side
$output .= $ss__text;
}
if ($ss__links) {
$output .= $ss__links;
}
if (empty($ss__text) && empty($ss__links)) {
//set some default content or leave it as it is.
}
}
