wordpress as a content management system
DESCRIPTION
WordPress as a Content Management System, by Setyagus Sucipto (http://twitter.com/agoes82), from iCreativeLabs Studio, Bandung for WORDCAMPID - WordCamp Indonesia 2010. Auditorium Gunadarma University, Depok, January 30, 2010TRANSCRIPT
Content Management System
WordPress As Content Management
System
Setyagus Sucipto
iCreativeLabs Studio
WordCamp Indonesia 2010
The Idea
WordCamp Indonesia 2010
A content management system (CMS) is software that makes it easy for non-techies to organize and manage web content.
Content Management SystemCapabilities
• Simple and easy for manage• Hide the complicated code and algorithm • Automated templates• Easily editable content• Scalable feature sets• Web standards upgrades• User role• Workflow management
• WordPress lets you create pages (stand alone content) and posts .
• Automated template.• Easy for editable content.• Easy Plugin for plug and play (scalable)• Automatic upgrade• Workflow management• Framework
WordPress What WordPress have and provide?
• User role for limited access• Not hide complicated code
WordPress What WordPress not have?
• User Role • Short Tags • Create Simple Organized Menu For User• Hide complicated admin panel • Hide complicated tags (postmeta and
customfield)
What User Need
WordCamp Indonesia 2010
Implementation
• Use Plugin API/Action References• Use Plugin API/Filter References• Create Bridges for plugin that we want to
modified • Never Touch the WordPress core
What We Do
• For Remove Control Metaremove_meta_box
• Add New Control Meta add_meta_box
• Hook An Action add_action
WordPress Plugin API
1. function post_categories_meta_box_($post) {2. global $wp_query, $current_user_roles; 3. ?>4. <div id="categories-all" class="tabs-panel">5. <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">6. <?php 7. $childOf = '';8. 9. foreach($current_user_roles as $role){10. $childOf .= $childOf == '' ? $role: ','.$role;11. } 12. wp_category_checklist_($post->ID, '&include='.$childOf, false, $popular_ids) ?>13. </ul>14. </div> 15. <?php 16. }17. }
18. require_once('../wp-admin/includes/template.php');19. remove_meta_box('categorydiv','post','normal');20. remove_meta_box('postcustom','post','normal');21. add_meta_box('categorydiv2', __('Categories'), 'post_categories_meta_box_', 'post', 'side', 'core');
Sample Code Plugin API – Modified Categories Listing
• It’s will simple for modified• Simple for upgrade • We just adding what we need
Bridges The Plugin Make the plugin like you need
• User have limited access to each category• User only can post to specific categories• Prevent user for make changes the post that
not related with his privileges
User Role
User Role Screenshot
User Role Implementation
• Hide complicated things in simple tags• User don’t need to know php code and html• Put the complicated tags with 3 steps (open
tags – content – close tags)
Short Tags
1. /* function.php at the themes folder */2. <?php3. function quoteTheText($quote){4. return ‘<div class=“redq”>’.$quote.’</redq>’;5. }
6. function add_shortcode(‘quotetext’,’quotethetext’);
7. ?>
Short Tags Sample Code
Short Tags Implement
MenuSimple and Organized
VS
• Use adminized plugin for hide the backend panel
• Create simple menu and organized • Create specific post form for user• Hide the custom field• Just show what user need
Hide complicated admin panel
• Organized what menu that user want• Add new parent menu using
add_menu_page• Add new sub menu page using
add_submenu_page
Create Simple Menu
1. /* function.php at the themes folder */
2. add_menu_page($config['themename'].' Options', $config['themename'], 'level_7', 'icl/index', 'icl_noop');
3. add_submenu_page('icl/index', 'Configuration Options', 'Configuration', 'administrator', 'icl/configuration', 'icl_noop');
4. add_submenu_page('icl/index', 'Role Options', 'User Role', 'administrator', 'user_role/index', 'icl_noop');
5. if (current_user_can('manage_options') || $icl_utility->is_can_access_category($icl_utility->get_option('general', 'category_video_news', array('option_value'), FALSE, TRUE)))
6. {7. add_submenu_page('icl/index', 'Movie Options', 'Movie', 'level_7', 'movie/index',
'icl_noop');8. }9. if (current_user_can('manage_options') || $icl_utility->is_can_access_category($icl_utility-
>get_option('general', 'category_kontes', array('option_value'), FALSE, TRUE)))10. {11. add_submenu_page('icl/index', 'Daftar User Submit', 'Daftar User Submit', 'level_7',
'submission', 'icl_noop');12. }13. add_submenu_page('icl/index', 'Banner Options', 'Banner', 'administrator', 'banner/index', 'icl_noop');
Sample Code
Simple Menu The Result
Modified Form To Post
1. $wpdb->query($sqlPost);2. $post_id = $wpdb->insert_id;3. 4. if (intval($post_id) > 0)5. {6. if ($data['movie_source'] == 1)7. {8. add_post_meta($post_id, 'movie', WPICL_MOVIE_URL . $data['movie_file'], TRUE);9. }10. add_post_meta($post_id, 'movie_image', (($data['image_file'] != '') ? WPICL_IMAGE_URL .
$data['image_file'] : get_bloginfo('stylesheet_directory') . '/images/logo-register.png'), TRUE);11. 12. $sql = 'INSERT INTO '.$wpdb->term_relationships;13. $sql .= ' (object_id, term_taxonomy_id) VALUES ('.$post_id.', '.$data['movie_category'].')';14. $sql = mysql_real_escape_string($sql);15. $wpdb->query($sql);16. }
Post Sample Code
• WordPress it’s be simple for modified • Hide all the complicated thing and just show
the end user need
In Review
Thank You