SlideShare une entreprise Scribd logo
1  sur  31
Télécharger pour lire hors ligne
#KC2011



                       Wordpress Custom
                          Contents


                                     Enrico Corinti

lunedì 21 marzo 2011
Chi sono

                       • Enrico Corinti, 34 anni, Ascoli Piceno
                       • Web Developer/Wordpress Fan
                       • http://www.webeing.net/code
                       • @enricocorinti

lunedì 21 marzo 2011
Argomenti
                  • Make it Custom!
                   • Custom Post Types
                   • Custom Write Panels
                   • Custom Taxonomies
                  • Let it Views!
                   • Custom Templating
                   • Post Formats (Hot! 3.1)
                  • Un esempio: Slides - Autori (#kc2011)
lunedì 21 marzo 2011
Wordpress Custom is
                            better!
                       •   Completa separazione di concetti e contenuti

                       •   Write Panels differenziati e customizzati per la
                           gestione di contenuti differenti

                       •   Valore semantico al contenuto

                       •   Completa separazione dei templates e views

                       •   Custom Permalinks

                       •   Wordpress per blogger o Wordpress come CMS?


lunedì 21 marzo 2011
Make it custom!




lunedì 21 marzo 2011
Make it custom!
                            Post Types (CPT)


                       • Contenuto: aggregazione di informazioni
                         multimediali necessarie a descrivere ad un
                         dato




lunedì 21 marzo 2011
Make it custom!
                       Post Types (CPT)
       • Post                  • Books
       • Pages                 • Authors
       • Attachment (media)    • Products
       • Revisions             • Video
       • Nav Menus (WP 3.x)    • Events
       • [Links]               • ...
lunedì 21 marzo 2011
Make it custom!
                        Write Panels
       • Excerpt
                               • Book Author
       • Custom Fields
                               • Address
       • Discussion
                               • Email
       • Author
                               • Price
       • Revisions
                               • ...
       • ...
lunedì 21 marzo 2011
Make it custom!
                              Taxonomies
                       • Tassonomia: classificazione gerarchica di
                         concetti (o dati) necessaria a stabilire un
                         ordine nella catalogazione degli stessi.
                       • Utile per categorizzare molteplici
                         informazioni e classificare i contenuti in un
                         CMS, ad esempio per conferire un ordine di
                         lettura strutturato


lunedì 21 marzo 2011
Make it custom!
                        Taxonomies

                               • Book Genre
       • Categories
                               • Product Versions
       • Tags
                               • Document type
       • Link Categories
                               • ...

lunedì 21 marzo 2011
Make it custom!
                        Formats (3.1)
       • Categorizzare la             • Aside
               rappresentazioni dei
               post                   • Gallery
       • Customizzare i               • Link
                                                • Audio
               templates              • Image
                                                • Chat
       • Miscuglio di concetti        • Quote
               e confusione nella
               creazione dei          • Status
               contenuti              • Video
lunedì 21 marzo 2011
Andiamo nel pratico




                         http://wordcamp.essereweb.net
                                   User: guest
                                  Passwd: guest

lunedì 21 marzo 2011
Register Post Type

  add_action('init', 'create_wc11_slides_type');
  function create_wc11_slides_type() {
  	 register_post_type( 'wc11_slides',
  	 	 	 	 'public' => true,
      	 	 'has_archive' => true,
  	 );
  }




lunedì 21 marzo 2011
Register Post Type -
                           Altri parametri
                       • Labels
                       • Supports (Write Panels)
                       • Rewrite
                       • Taxonomies
                       • ...
                       http://codex.wordpress.org/Function_Reference/
                       register_post_type
lunedì 21 marzo 2011
Add Meta Boxes
     //Preparo il mio box
     function wc11_author_info_box() {
       //... elementi HTML del box
     }




lunedì 21 marzo 2011
Add Meta Boxes
     //Aggiungiamo il box
     function create_wc11_author_info_box() {
         add_meta_box(
               'wc11_author_box_id',
               ‘Dati Autore’,
               'wc11_author_info_box',
               'wc11_authors' );
     }



lunedì 21 marzo 2011
Add Meta Boxes
    //Preparo le azioni da fare al salvataggio
    function save_postdata( $post_id ) {
      //...operazioni da fare al salvataggio
    }




lunedì 21 marzo 2011
Add Meta Boxes
//Hook Actions in Wordpress

// WP 3.0+
add_action('add_meta_boxes','wc11_author_info_box');

// backwards compatible
add_action('admin_init', 'wc11_author_info_box', 1);

/* Do something with the data entered */
add_action('save_post', 'save_postdata');


lunedì 21 marzo 2011
Register Taxonomy
  //Registro la mia nuova tassonomia
  function create_wc11_slide_taxonomies()
  {
  register_taxonomy('wc11_topic_areas','wc11_slides’,
        array(
         'query_var' => true,
         'rewrite' => array( 'slug' => 'slides' )
         ));
  }
  //hook into the init action
  add_action('init',’create_wc11_slide_taxonomies',
  0 );

lunedì 21 marzo 2011
Register Taxonomy -
                          Altri parametri
                       • Labels
                       • Hierarchical
                       • show_in_nav_menus
                       • show_tagcloud
                       • ...
                       http://codex.wordpress.org/Function_Reference/
                       register_taxonomy
lunedì 21 marzo 2011
Let it Views!




lunedì 21 marzo 2011
New Templates Hierarchy




lunedì 21 marzo 2011
New Templates Hierarchy




lunedì 21 marzo 2011
Template Functions
  <?php
   //Elenco dei CPT
   get_post_types( $args, $output, $operator );

  //Tipo di contenuto associato al post
   get_post_type($post->ID);

  //Conditional Function for archives
  is_post_type_archive( $post_types );




lunedì 21 marzo 2011
Template Functions
    <?php
    //Tagcloud
     wp_tag_cloud( array( 'taxonomy' =>
    'taxonomy_name' ) );

    //Liste e Dropdown
     $args = array( 'taxonomy' => 'taxonomy_name' ) ;
     wp_list_categories( $args ); 		 	 	
     wp_dropdown_categories( $args );
    ?>




lunedì 21 marzo 2011
Template Functions
       <?php 
        //Array - Elenco completo
        $terms = get_terms( $taxonomies, $args ); 
        foreach ( $terms as $term ) { … } 	 	 	
                                           	

            //Elenco di link filtrato per
            IDget_the_term_list( $id , $taxonomy );

        //Array filtrato per ID
        $terms = get_the_terms( $id , $taxonomy );
        foreach ( $terms as $term ) { … }
       ?>

lunedì 21 marzo 2011
Post Formats
                • Meta-informazioni aggiuntive associate
                  al post
                • Un nuovo modo per semplificare e
                  diversificare la presentazione dei
                  contenuti
                • Un modo alternativo alle tassonomie
                  per presentare lo stesso contenuto in
                  modi differenti
lunedì 21 marzo 2011
Post Formats
    //Add theme capability to manage formats
    add_theme_support( 'post-formats', array( 'aside',
    'gallery' ) );

    //Check formats
    if ( has_post_format( 'aside' )) {
      //Faccio qualcosa per lo “stile” Aside
    }

    //Built-in “post_class()” add a “format-aside” class
    to our theme classes
    <div id="post-<?php the_ID(); ?>" <?php post_class
    (); ?>>
lunedì 21 marzo 2011
Take it easy... Plugins
         • More...
            • Fields,
            • Types,
            • Taxonomies
         • Custom UI
         • WP Post Formats

lunedì 21 marzo 2011
References
         • http://codex.wordpress.org/Post_Types#Custom_Types
         • http://codex.wordpress.org/Function_Reference/
              register_taxonomy
         • http://kovshenin.com/archives/custom-post-types-in-
              wordpress-3-0/
         • http://blog.artera.it/cms/wordpress-3-1-post-formats
         • http://www.slideshare.net/miziomon/custom-taxonomies-
              custom-post-type



lunedì 21 marzo 2011
Grazie! :)



                            @enricocorinti
                            http://www.webeing.net/code
                            enrico.corinti@webeing.net



lunedì 21 marzo 2011

Contenu connexe

En vedette

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

En vedette (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Wordpress Custom Contents

  • 1. #KC2011 Wordpress Custom Contents Enrico Corinti lunedì 21 marzo 2011
  • 2. Chi sono • Enrico Corinti, 34 anni, Ascoli Piceno • Web Developer/Wordpress Fan • http://www.webeing.net/code • @enricocorinti lunedì 21 marzo 2011
  • 3. Argomenti • Make it Custom! • Custom Post Types • Custom Write Panels • Custom Taxonomies • Let it Views! • Custom Templating • Post Formats (Hot! 3.1) • Un esempio: Slides - Autori (#kc2011) lunedì 21 marzo 2011
  • 4. Wordpress Custom is better! • Completa separazione di concetti e contenuti • Write Panels differenziati e customizzati per la gestione di contenuti differenti • Valore semantico al contenuto • Completa separazione dei templates e views • Custom Permalinks • Wordpress per blogger o Wordpress come CMS? lunedì 21 marzo 2011
  • 5. Make it custom! lunedì 21 marzo 2011
  • 6. Make it custom! Post Types (CPT) • Contenuto: aggregazione di informazioni multimediali necessarie a descrivere ad un dato lunedì 21 marzo 2011
  • 7. Make it custom! Post Types (CPT) • Post • Books • Pages • Authors • Attachment (media) • Products • Revisions • Video • Nav Menus (WP 3.x) • Events • [Links] • ... lunedì 21 marzo 2011
  • 8. Make it custom! Write Panels • Excerpt • Book Author • Custom Fields • Address • Discussion • Email • Author • Price • Revisions • ... • ... lunedì 21 marzo 2011
  • 9. Make it custom! Taxonomies • Tassonomia: classificazione gerarchica di concetti (o dati) necessaria a stabilire un ordine nella catalogazione degli stessi. • Utile per categorizzare molteplici informazioni e classificare i contenuti in un CMS, ad esempio per conferire un ordine di lettura strutturato lunedì 21 marzo 2011
  • 10. Make it custom! Taxonomies • Book Genre • Categories • Product Versions • Tags • Document type • Link Categories • ... lunedì 21 marzo 2011
  • 11. Make it custom! Formats (3.1) • Categorizzare la • Aside rappresentazioni dei post • Gallery • Customizzare i • Link • Audio templates • Image • Chat • Miscuglio di concetti • Quote e confusione nella creazione dei • Status contenuti • Video lunedì 21 marzo 2011
  • 12. Andiamo nel pratico http://wordcamp.essereweb.net User: guest Passwd: guest lunedì 21 marzo 2011
  • 13. Register Post Type add_action('init', 'create_wc11_slides_type'); function create_wc11_slides_type() { register_post_type( 'wc11_slides', 'public' => true, 'has_archive' => true, ); } lunedì 21 marzo 2011
  • 14. Register Post Type - Altri parametri • Labels • Supports (Write Panels) • Rewrite • Taxonomies • ... http://codex.wordpress.org/Function_Reference/ register_post_type lunedì 21 marzo 2011
  • 15. Add Meta Boxes //Preparo il mio box function wc11_author_info_box() { //... elementi HTML del box } lunedì 21 marzo 2011
  • 16. Add Meta Boxes //Aggiungiamo il box function create_wc11_author_info_box() { add_meta_box( 'wc11_author_box_id', ‘Dati Autore’, 'wc11_author_info_box', 'wc11_authors' ); } lunedì 21 marzo 2011
  • 17. Add Meta Boxes //Preparo le azioni da fare al salvataggio function save_postdata( $post_id ) { //...operazioni da fare al salvataggio } lunedì 21 marzo 2011
  • 18. Add Meta Boxes //Hook Actions in Wordpress // WP 3.0+ add_action('add_meta_boxes','wc11_author_info_box'); // backwards compatible add_action('admin_init', 'wc11_author_info_box', 1); /* Do something with the data entered */ add_action('save_post', 'save_postdata'); lunedì 21 marzo 2011
  • 19. Register Taxonomy //Registro la mia nuova tassonomia function create_wc11_slide_taxonomies() { register_taxonomy('wc11_topic_areas','wc11_slides’, array( 'query_var' => true, 'rewrite' => array( 'slug' => 'slides' ) )); } //hook into the init action add_action('init',’create_wc11_slide_taxonomies', 0 ); lunedì 21 marzo 2011
  • 20. Register Taxonomy - Altri parametri • Labels • Hierarchical • show_in_nav_menus • show_tagcloud • ... http://codex.wordpress.org/Function_Reference/ register_taxonomy lunedì 21 marzo 2011
  • 21. Let it Views! lunedì 21 marzo 2011
  • 24. Template Functions <?php //Elenco dei CPT  get_post_types( $args, $output, $operator ); //Tipo di contenuto associato al post get_post_type($post->ID); //Conditional Function for archives is_post_type_archive( $post_types ); lunedì 21 marzo 2011
  • 25. Template Functions <?php //Tagcloud wp_tag_cloud( array( 'taxonomy' => 'taxonomy_name' ) ); //Liste e Dropdown $args = array( 'taxonomy' => 'taxonomy_name' ) ; wp_list_categories( $args ); wp_dropdown_categories( $args ); ?> lunedì 21 marzo 2011
  • 26. Template Functions <?php  //Array - Elenco completo $terms = get_terms( $taxonomies, $args );  foreach ( $terms as $term ) { … } //Elenco di link filtrato per IDget_the_term_list( $id , $taxonomy ); //Array filtrato per ID $terms = get_the_terms( $id , $taxonomy ); foreach ( $terms as $term ) { … } ?> lunedì 21 marzo 2011
  • 27. Post Formats • Meta-informazioni aggiuntive associate al post • Un nuovo modo per semplificare e diversificare la presentazione dei contenuti • Un modo alternativo alle tassonomie per presentare lo stesso contenuto in modi differenti lunedì 21 marzo 2011
  • 28. Post Formats //Add theme capability to manage formats add_theme_support( 'post-formats', array( 'aside', 'gallery' ) ); //Check formats if ( has_post_format( 'aside' )) { //Faccio qualcosa per lo “stile” Aside } //Built-in “post_class()” add a “format-aside” class to our theme classes <div id="post-<?php the_ID(); ?>" <?php post_class (); ?>> lunedì 21 marzo 2011
  • 29. Take it easy... Plugins • More... • Fields, • Types, • Taxonomies • Custom UI • WP Post Formats lunedì 21 marzo 2011
  • 30. References • http://codex.wordpress.org/Post_Types#Custom_Types • http://codex.wordpress.org/Function_Reference/ register_taxonomy • http://kovshenin.com/archives/custom-post-types-in- wordpress-3-0/ • http://blog.artera.it/cms/wordpress-3-1-post-formats • http://www.slideshare.net/miziomon/custom-taxonomies- custom-post-type lunedì 21 marzo 2011
  • 31. Grazie! :) @enricocorinti http://www.webeing.net/code enrico.corinti@webeing.net lunedì 21 marzo 2011