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 is not a
Content Management System
Do not use it for your websites!
thomas@gasc.fr @methylbro
Tuesday 6th
of May...
involved
edition=2013
spoke
edition=2012
Who I am ?
name=Thomas G.
type=person
spoke
edition=11/12/2012
name=Human Talks
t...
WordPress is web software you can use to
create a beautiful website or blog
wordpress.org
WordPress is shit!
5 horribles things
in WordPress
about themes, metadata, plugins, core, ...
wp-content/themes/
<?php
// WordPress template
while($latest_cat_post->have_posts()) :
$latest_cat_post->the_post();
the_t...
Spaghetti Code
http://en.wikipedia.org/wiki/Spaghetti_code
wp-includes/meta.php
/* post's enhancement with metadata */
function add_metadata(
string $meta_type,
int $object_id,
stri...
Video
Content Managing System
<Content>
Article
Song
Video Clip
Lyrics
http://en.wikipedia.org/wiki/Content_management_sys...
wp-includes/plugin.php
<?php
// how WordPress plugin works
function plugin_footer()
{
echo ‘hello world !’;
}
add_action( ...
SPLObserver Interface
: SPLSubject : SPLObserver
notify()
attach()
update()
http://www.php.net/manual/en/class.splobserver...
wp-includes/class-wp.php
http://develop.svn.wordpress.org/branches/3.9/src/wp-includes/class-wp.php
<?php
class WP {
// .....
HTTPKernel
Request request
resolve
controller
controller
resolve
arguments
view
response Response
terminate
exception
Sub-...
wp-includes/class-wp.php
<?php
class WP
{
// ...
function query_posts()
{
global $wp_the_query;
$this->build_query_string(...
Dependency Injection
http://php-di.org/doc/understanding-di.html
It’s all about interoperability
PHP Framework Interoperability Group
http://www.php-fig.org/
All these things are in Drupal 8
Drupal 8
http://symfony.com/blog/symfony2-meets-drupal-8
- EventDispatcher
- HTTPKernel
-...
Use cool tools
terminal
cool tools
and even more
More powerful than WordPress templates
Template
Engine
CSS
Framework
∞templatesImage
Editor
infinity
More powerful than WordPress plugins
PackagistComposer
30 000+
packages
http://getcomposer.org/doc/00-intro.md
Conclusion: Don’t be afraid (to code) !
Thank you, Any questions?
Illustrations :
http://thenounproject.com/
www.afup.org
French Association of PHP Users
Join
www...
Upcoming SlideShare
Loading in …5
×

Pourquoi WordPress n’est pas un CMS

919 views

Published on

Published in: Technology, Business
  • Be the first to comment

  • Be the first to like this

Pourquoi WordPress n’est pas un CMS

  1. 1. WordPress is not a Content Management System Do not use it for your websites! thomas@gasc.fr @methylbro Tuesday 6th of May 2014 @LaCantine_Tlse, Toulouse
  2. 2. involved edition=2013 spoke edition=2012 Who I am ? name=Thomas G. type=person spoke edition=11/12/2012 name=Human Talks type=event name=PHP Tour type=event name=Paris Web type=event name=Sud Web type=event attendee edition=2012, 2013 name=Forum PHP type=event member volunteer=2012, 2013 office=2014 name=AFUP type=organization attendee edition=2013, 2014 attendee edition=2012, 2013 attendee edition=2014 organized 14 organized 3 2 2 2 inspired inspired http://methylbro.fr/
  3. 3. WordPress is web software you can use to create a beautiful website or blog wordpress.org
  4. 4. WordPress is shit!
  5. 5. 5 horribles things in WordPress about themes, metadata, plugins, core, ...
  6. 6. wp-content/themes/ <?php // WordPress template while($latest_cat_post->have_posts()) : $latest_cat_post->the_post(); the_title(); the_excerpt(); endwhile; <?php // as it should be foreach ($lastest_posts as $post) { echo $post->title; echo $post->excerpt; } http://codex.wordpress.org/Global_Variables
  7. 7. Spaghetti Code http://en.wikipedia.org/wiki/Spaghetti_code
  8. 8. wp-includes/meta.php /* post's enhancement with metadata */ function add_metadata( string $meta_type, int $object_id, string $meta_key, mixed $meta_value, bool $unique = false ); function get_metadata( string $meta_type, int $object_id, string $meta_key = ‘’, bool $single = false ); <?php // define a connexion between 2 posts $post_id = 14; $next_post_id = 17; add_metadata( ‘post’, $post_id, ‘next_post’, $next_post_id ); // what’s happen if … ? wp_delete_post( $next_post_id ); http://codex.wordpress.org/Function_Reference/the_meta
  9. 9. Video Content Managing System <Content> Article Song Video Clip Lyrics http://en.wikipedia.org/wiki/Content_management_system
  10. 10. wp-includes/plugin.php <?php // how WordPress plugin works function plugin_footer() { echo ‘hello world !’; } add_action( ‘wp_footer’ , ‘plugin_footer ); do_action( ‘wp_footer’ ); <?php // how plugins should works class Footer extends SPLSubject { /*...*/ } class FooterPlugin extends SPLObserver { function update() { echo ‘hello world !’; } } $wp_footer = new Footer(); $wp_footer->attach( new FooterPlugin() ); $wp_footer->notify(); http://codex.wordpress.org/Plugin_API
  11. 11. SPLObserver Interface : SPLSubject : SPLObserver notify() attach() update() http://www.php.net/manual/en/class.splobserver.php
  12. 12. wp-includes/class-wp.php http://develop.svn.wordpress.org/branches/3.9/src/wp-includes/class-wp.php <?php class WP { // ... function main( $query_args = '' ) { $this->init(); $this->parse_request($query_args); $this->send_headers(); $this->query_posts(); $this->handle_404(); $this->register_globals(); do_action_ref_array( 'wp', array( &$this ) ); } } // ... require '/template-loader.php' ; 1. initiate build WP_User instance into $current_user global 2. parse request retrieves params into self::$query_vars 3. send http headers send headers and terminate if needed 4. retrieves infos from database parse and execute $wp_query and then retrieves posts 5. handle 404 changes the http headers already sent if a not found error occurred during the request 6. register lot of globals retrieves posts data and set them into globals vars 7. send signal to plugins say to the plugins that they can do things here 8. render php script as template execute a php script as a template and directly output the result
  13. 13. HTTPKernel Request request resolve controller controller resolve arguments view response Response terminate exception Sub-Request Call Controller exception “sub-response” content response? http://symfony.com/doc/current/components/http_kernel/introduction.html
  14. 14. wp-includes/class-wp.php <?php class WP { // ... function query_posts() { global $wp_the_query; $this->build_query_string(); $wp_the_query->query( $this->query_vars ); } } not even passed as parameter !! WTF ?! http://develop.svn.wordpress.org/branches/3.9/src/wp-includes/class-wp.php
  15. 15. Dependency Injection http://php-di.org/doc/understanding-di.html
  16. 16. It’s all about interoperability PHP Framework Interoperability Group http://www.php-fig.org/
  17. 17. All these things are in Drupal 8 Drupal 8 http://symfony.com/blog/symfony2-meets-drupal-8 - EventDispatcher - HTTPKernel - DependencyInjection and more ...
  18. 18. Use cool tools terminal cool tools and even more
  19. 19. More powerful than WordPress templates Template Engine CSS Framework ∞templatesImage Editor infinity
  20. 20. More powerful than WordPress plugins PackagistComposer 30 000+ packages http://getcomposer.org/doc/00-intro.md
  21. 21. Conclusion: Don’t be afraid (to code) !
  22. 22. Thank you, Any questions? Illustrations : http://thenounproject.com/ www.afup.org French Association of PHP Users Join www.phptour.org Lyon, France June, 23rd & 24th 2014

×