Wordpress Web Application Development - Third Edition
Rakhitha Nimesh Ratnayake
- 536 páginas
- English
- ePUB (apto para móviles)
- Disponible en iOS y Android
Wordpress Web Application Development - Third Edition
Rakhitha Nimesh Ratnayake
Información del libro
Learn in easy stages how to rapidly build leading-edge web applications from scratch.About This Book• Develop powerful web applications rapidly with WordPress• Explore the significant features and improvements introduced in WordPress 4.7 by learning the numerous tips and techniques in this book. • Unleash the power of REST API endpoints to make your interaction with websites new and innovative.Who This Book Is ForThis book is targeted at WordPress developers and designers who want to develop quality web applications within a limited time frame and maximize their profits. A prior knowledge of basic web development and design is assumed.What You Will Learn• Develop extendable plugins with the use of WordPress features in core modules• Develop pluggable modules to extend the core features of WordPress as independent modules• Manage permissions for a wide range of content types in web applications based on different user types• Follow WordPress coding standards to develop reusable and maintainable code• Build and customize themes beyond conventional web layouts• Explore the power of core database tables and understand the limitations when designing database tables for large applications• Integrate open source modules into WordPress applications to keep up with the latest open source technologies• Customize the WordPress admin section and themes to create the look and feel of a typical web applicationIn DetailWordPress is one of the most rapidly expanding markets on the Web. Learning how to build complex and scalable web applications will give you the ability and knowledge to step into the future of WordPress. WordPress 4.7 introduces some exciting new improvements and several bug fixes, which further improve the entire development process.This book is a practical, scenario-based guide to expanding the power of the WordPress core modules to develop modular and maintainable real-world applications from scratch. This book consistently emphasizes adapting WordPress features into web applications. It will walk you through the advanced usages of existing features such as access controlling; database handling; custom post types; pluggable plugins; content restrictions; routing; translation; caching; and many more, while you build the backend of a forum management application.This book begins by explaining how to plan the development of a web application using WordPress' core features. Once the core features are explained, you will learn how to build an application by extending them through custom plugin development. Finally, you will explore advanced non-functional features and application integration.After reading this book, you will have the ability to develop powerful web applications rapidly within limited time frames.Style and approachAn extensive, practical guide that explains how to adapt WordPress features, both conventional and trending, for web applications.
Preguntas frecuentes
Información
Customizing the Dashboard for Powerful Backends
- Understanding the admin dashboard
- Customizing the admin toolbar
- Customizing the main navigation menu
- Adding features with custom pages
- Building options pages
- Using feature-packed admin list tables
- Adding content restrictions to admin list tables
- Awesome visual presentation with admin themes
- The responsive nature of the admin dashboard
Understanding the admin dashboard
- The admin toolbar
- The main navigation menu
- Option and menu pages
- Admin list tables
- Responsive design capabilities
Customizing the admin toolbar
class WPWAF_Dashboard {
public function __construct() { }
}
?>
Removing the admin toolbar
class WPWAF_Dashboard {
public function __construct() {
$this-> set_frontend_toolbar(FALSE);
}
public function set_frontend_toolbar($status) {
show_admin_bar($status);
}
}
Managing the admin toolbar items
add_action( 'wp_before_admin_bar_render', array( $this,
'customize_admin_toolbar' ) );
- As usual, we start by adding the necessary actions to the constructor of the dashboard plugin, as shown in the following code:
public function customize_admin_toolbar() {
global $wp_admin_bar;
$nodes = $wp_admin_bar->get_nodes();
echo "<pre>";
var_dump($nodes);
exit;
}
- Then, we can use print_r() on the returned result to identify the nodes. The following code is a part of the returned nodes list, and you can see the main item IDs called user-actions and user-info:
Array
(
[user-actions] => stdClass Object
(
[id] => user-actions
[title] =>
[parent] => my-account
[href] =>
[group] => 1
[meta] => Array()
)
[user-info] => stdClass Object
(
[id] => user-info
[title] =><img alt='' src='http://1.gravatar.com/avatar/d3e0fb2e11ff3767d1359c559afbe304? s=64&d=mm&r=g' /><span class='display-name'>Free Member</span>
[parent] => user-actions
[href] => http://localhost/packt/wordpress-web-
develop-test/wp-admin/profile.php
)
)
- We need to use those unique IDs to add or remove menu items. Now we will remove all the items other than the first item and create menu items specific to the forum application. So, let's remove the preceding code and modify the customize_admin_toolbar function as follows:
public function customize_admin_toolbar() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu('updates');
$wp_admin_bar->remove_menu('comments');
$wp_admin_bar->remove_menu('new-content');
$wp_admin_bar->remove_menu('customize');
}
- By default, the admin toolbar contains four items for site updates, comments and new posts, pages, customize, and so on. Explore the result from print_r and you will find the respective keys for the preceding items such as updates, comments, customize, and new-content.
- Then, use the remove_menu function on the wp_admin_bar object to remove the menu items from the toolbar. Now, the toolbar should look like the following screenshot:
- Next, we need to add application-specific items to the toolbar. Since we are mainly focusing on forums, we can have a menu called Forums to contain links to forums and topics, as shown in the following updated code of the customize_admin_toolbar function:
public function customize_admin_toolbar() {
global $wp_admin_bar;
// Remove menus
if ( current_user_can('edit_wpwaf_topics') ) {
$wp_admin_bar->add_menu( array(
'id' => 'wpwaf-forums',
'title' => __('Forum Components','wpwaf'),
'href' => admin_url()
));
$wp_admin_bar->add_menu( array(
'id' => 'wpwaf-new-topics',
'title' => __('Topics','wpwaf'),
'href' => admin_url() . "post-new.php?post_type=wpwaf_topic",
'parent' => 'wpwaf-forums'
));
}
if ( current_user_can('edit_posts') ) {
$wp_admin_bar->add_menu( array(
'id' => 'wpwaf-new-forums',
'title' => __('Forums','wpwaf'),
'href' => admin_url() . "post-new.php?post_type=wpwaf_forum",
'parent' => 'wpwaf-forums'
));
}
}