Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
WordPress Web Application Development - Second Edition

You're reading from   WordPress Web Application Development - Second Edition Build rapid web applications with cutting-edge technologies using WordPress

Arrow left icon
Product type Paperback
Published in May 2015
Publisher Packt
ISBN-13 9781782174394
Length 404 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Author (1):
Arrow left icon
Rakhitha Nimesh Ratnayake Rakhitha Nimesh Ratnayake
Author Profile Icon Rakhitha Nimesh Ratnayake
Rakhitha Nimesh Ratnayake
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. WordPress as a Web Application Framework FREE CHAPTER 2. Implementing Membership Roles, Permissions, and Features 3. Planning and Customizing the Core Database 4. Building Blocks of Web Applications 5. Developing Pluggable Modules 6. Customizing the Dashboard for Powerful Backends 7. Adjusting Theme for Amazing Frontends 8. Enhancing the Power of Open Source Libraries and Plugins 9. Listening to Third-party Applications 10. Integrating and Finalizing the Portfolio Management Application 11. Supplementary Modules for Web Development A. Configurations, Tools, and Resources Index

Enhancing features of the questions plugin

In the previous sections, we illustrated how to quickly adapt WordPress into different kind of implementations by customizing its core features. However, I had to limit the functionality to the most basic level in order to keep this chapter short and interesting for the beginners. If you are willing to improve it, you can try other new features of such an application. Here, we will be looking at some of the enhancements to this plugin and how we can use core WordPress features to implement them.

Customizing the design of questions

This is one of the major requirements in such an application. Here, we have a very basic layout and it's difficult to know whether this is a question or just a normal post. Consider the following screenshot for a well-designed question interface:

Customizing the design of questions

Remember that we customized the comments list for adding new options. Similarly, we can customize the design of questions to create an interface such as the previous screenshot by using a separate template file for the questions custom post type. We have to create a file called single-wpwa_question.php and change the design and functionality as we want.

Categorizing questions

Categories allow us to filter the results and limit it to a certain extent. It's an essential feature in the question-answer application so that users can directly view questions related to their topic instead of browsing all the questions. WordPress provides categories by default. However, these categories are mainly intended for posts. Therefore, we have to use custom taxonomies to create categories for custom post types such as questions. More details about taxonomies will be discussed in the following chapters.

Approving and rejecting questions

Currently, our application can post questions without any approval process. However, this is not the ideal implementation as it can create a lot of spam questions. In a well-built application, there should be a feature to approve/reject questions when needed. This feature can be easily built with WordPress admin lists. We have a list of questions in the backend, and we can use the Bulk Actions dropdown on top to add custom actions and implement this feature.

Adding star rating to answers

The author who asked the question can mark the answers as correct or incorrect. However, there can be scenarios where answers are not marked as correct are more suitable than answers marked as correct. Therefore, we can introduce star rating features to answers so that public can rate the answers. The person who looks for the answer can consider the rating before choosing answers. Implementation of this requirement is similar to the functionality of the Mark as Correct button. We have to get a js plugin for star rating and integrate to the interface through the wpwa_comment_list function. Then we can use AJAX to mark the status of answers.

We have looked at some of the possible enhancements to such an application. You can think of many more such functionalities and implement them in your own version.

In the following chapters, we'll see the limitations in this approach in complex web applications and how we can organize things better to write quality and maintainable code.

You have been reading a chapter from
WordPress Web Application Development - Second Edition
Published in: May 2015
Publisher: Packt
ISBN-13: 9781782174394
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime