Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

WordPress as a Content Management System


Published on

WordPress as a Content Management System, by Setyagus Sucipto (, from iCreativeLabs Studio, Bandung for WORDCAMPID - WordCamp Indonesia 2010. Auditorium Gunadarma University, Depok, January 30, 2010

Published in: Technology

WordPress as a Content Management System

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