Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Metaboxes. Do them right.

Aniket Pant
February 23, 2013

Metaboxes. Do them right.

My slides for WordCamp Pune 2013 - http://2013.pune.wordcamp.org

Aniket Pant

February 23, 2013
Tweet

More Decks by Aniket Pant

Other Decks in Technology

Transcript

  1. Metaboxes.
    Do them right.

    View Slide

  2. Let’s tweet about this
    @aniket_pant
    #wcpune2013

    View Slide

  3. Throw your questions at
    me anytime.
    Ask me some thing right now!

    View Slide

  4. I’m Aniket Pant.
    And I have been around for
    over 2 years now. I love to
    code and get dirty with front-
    end.
    I am also the Curator of
    Mark My Word, a content and
    design conference.
    We owe this to ourselves. We owe this to ourselves. We just can’t let this go.

    View Slide

  5. I bet this will remind you
    of a college lecture.
    Introduction to
    Metaboxes 101

    View Slide

  6. Introduced in
    version 2.5
    Gives life to the
    awesome CMS
    called WordPress

    View Slide

  7. Trust me that they are
    really awesome.
    What are
    Metaboxes?

    View Slide

  8. View Slide

  9. Metaboxes are a great
    addition to WordPress.

    View Slide

  10. Makes things simpler to maintain
    and manage.
    Implementation is fast and
    simple.
    You will definitely fall in love
    with how you can make your site
    awesomer with it.

    View Slide

  11. One simple reason.
    They are cool.
    Why Metaboxes?

    View Slide

  12. There is nothing better than
    adding more features onto an
    already existing CMS.

    View Slide

  13. View Slide

  14. And then you can use these
    features to intensify what you are
    building.

    View Slide

  15. How do we
    implement
    Metaboxes?

    View Slide

  16. Use a library Download a
    plugin
    Write the
    code yourself
    / /

    View Slide

  17. Libraries to implement
    Metaboxes

    View Slide

  18. Custom
    Metaboxes
    and Fields for
    WordPress
    by Jared
    Atchison
    jaredatchison.com
    WPAlchemy
    by Far In Space
    farinspace.com/
    wpalchemy-
    metabox

    View Slide

  19. Custom Metaboxes and Fields
    for WordPress
    Still in development
    It’s simply awesome
    Plug-and-play
    Lots of built in features like time
    and date picker

    View Slide

  20. WPAlchemy
    Extensive documentation
    Used in many websites
    A little slow on the maintainace
    Comes along with features you
    can directly use

    View Slide

  21. For those who wish to
    use plugins

    View Slide

  22. There is a plugin called Meta Box
    and it does everything for you.

    View Slide

  23. View Slide

  24. Meta Box is well maintained.
    Compatible with WordPress 3.5.1
    Gives full control via a full-fledged
    user interface.

    View Slide

  25. And we can
    code it too

    View Slide

  26. $meta_boxes[] = array(
    ‘id’ => ‘personal’,
    ‘title’ => ‘Personal Information’,
    ‘pages’ => array(‘post’, ‘page’, ‘album’),
    ‘context’ => ‘normal’,
    ‘priority’ => ‘high’,
    ‘fields’ => array(
    array(
    ‘name’ => ‘Full name’,
    ‘desc’ => ‘Format: Firstname Lastname’,
    ‘id’ => $prefix . ‘fname’,
    ‘type’ => ‘text’,
    ‘std’ => ‘Anh Tran’,
    ‘validate_func’ => ‘check_name’
    )
    )
    );
    ?>
    This is just
    one bit of
    the actual
    code.
    }

    View Slide

  27. Looks
    complex.

    View Slide

  28. It is complex.
    I will recommend you to use the
    libraries even if you wish to code
    everything yourself.

    View Slide

  29. These are live projects.
    Case Studies

    View Slide

  30. Case Study #1:
    Current News
    Project by Web Mutiny

    View Slide

  31. View Slide

  32. View Slide

  33. We needed new fields -
    Place, Date, Subheading, Intro
    and Timestamp.
    And we used Custom Metaboxes
    and Fields for WordPress
    because it was perfect for us.

    View Slide

  34. Case Study #2:
    Smashing Magazine
    Job Board

    View Slide

  35. http://jobs.smashingmagazine.com

    View Slide

  36. View Slide

  37. Smashing Magazine’s Job Board
    is a great example of Custom
    Fields and Taxonomies put into
    good use.

    View Slide

  38. Use metaboxes whenever you
    need to put in more fields to your
    website.

    View Slide

  39. I have spoken on
    Theme Development &
    Customization.
    It’ll give you a good picture of
    Theme Development with WP.
    http://aniketpant.com/speaking/
    wordcamp-jabalpur-2011

    View Slide

  40. I hope you will use
    metaboxes in your next
    project.
    Thank you
    for listening.
    We are the ones, who will achieve, what the world dreams.
    Because we still believe.

    View Slide

  41. Liked my talk?
    Follow me on twitter:
    @aniket_pant
    Mail me:
    me[at]aniketpant[dot]com
    Checkout my blog:
    aniketpant.com

    View Slide