SlideShare ist ein Scribd-Unternehmen logo
1 von 39
Downloaden Sie, um offline zu lesen
Add       muscle
                                   to your
by: Gail Villanueva
     sheeromedia.com
          kutitots.com
                                      WordPress
                                     website


  WordCamp Philippines 2010 ● 2 October 2010 ● College of St. Benilde

    Rationale

    Review of Concepts




                         Introduction
So why am I here?

    Promote WP as a low-cost, compact CMS

    Don't fear WP codes!
    
        Backup your database
    
        Test codes locally
Review of Concepts

    Post Types

    WordPress Loop

    Begins here:
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>



    Ends here:
    <?php endwhile; else: ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; ?>




    Conditional Tags

    Custom Fields
Using WordPress as a
 jobsite, portfolio, or
 e-commerce web site




                   WP: Not just a CMS
The “usual” website

    What's in the most basic CMS-driven website?
    
        Homepage
    
        News Section
    
        Inside Pages




             WordPress can do
              more than that!
Portfolio website
Job Site
E-Commerce website

    Post Thumbnails

    Single, Meta, Archive

    The Homepage

    Search




                            Coding fun!
Post Thumbnails

    Displays a thumbnail image by uploading
    through the Post Edit screen.

    Must be enabled in the functions.php first!
Post Thumbnails: Code
Add to function.php:
  add_theme_support('post-thumbnails');


Add to template file:
  <?php the_post_thumbnail( array(300,200) ); ?>
Making our own Custom Post Type

    Getting dirty with functions.php

    Tie 'em up to the template!
Creating a custom panel
Creating a custom panel
Creating a custom panel: The Code
add_action('init', 'product_register');
    function product_register() {
       $labels = array(
               'name' => _x('Products', 'post type general name'),
               'singular_name' => _x('Product Item', 'post type singular name'),
               'add_new' => _x('Add New', 'product item'),
               'add_new_item' => __('Add New Product Item'),
               'edit_item' => __('Edit Product Item'),
               'new_item' => __('New Product Item'),
               'view_item' => __('View Product Item'),
               'search_items' => __('Search Product'),
               'not_found' => __('Nothing found'),
               'not_found_in_trash' => __('Nothing found in Trash'),
               'parent_item_colon' => ''
       );

     $args = array(
               'labels' => $labels,
               'public' => true,
               'publicly_queryable' => true,
               'show_ui' => true,
               'query_var' => true,
               'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',
               'rewrite' => true,
               'capability_type' => 'post',
               'hierarchical' => false,
               'menu_position' => null,
               'exclude_from_search' => false,
               'supports' => array('title','editor','revisions','thumbnail')
     );
     register_post_type( 'product' , $args );
}
Creating custom taxonomies
Creating custom taxonomies: The Code
register_taxonomy("Catalog", array("product"),
  array("hierarchical" => true, "label" => "Catalog",
  "singular_label" => "Catalog", "rewrite" => true,
  'public' => true));
Creating custom More Options
Initialize the Options
add_action("admin_init", "admin_init");


function admin_init(){
    add_meta_box("price-meta", "Product Price",
     "price", "product", "side", "low");

    add_meta_box("details_meta", "Product
     Details", "details_meta", "product",
     "normal", "low");
}
Product Price Panel
function price(){
    global $post;
    $custom = get_post_custom($post->ID);
    $price = $custom["price"][0];
    ?>
    <label>Price:</label>
    <input name="price" value="<?php echo $price; ?>" />
    <?php
}
Product Details Panel
function details_meta() {
    global $post;
    $custom = get_post_custom($post->ID);
    $itemcolor = $custom["itemcolor"][0];
    $itemsize = $custom["itemsize"][0];
    ?>
    <p><label>Item Color:</label><br />
    <textarea cols="50" rows="1" name="itemcolor"><?php
      echo $itemcolor; ?></textarea></p>
    <p><label>Available Sizes:</label><br />
    <textarea cols="50" rows="1" name="itemsize"><?php echo
      $itemsize; ?></textarea></p>
    <?php
}
Save Details
add_action('save_post', 'save_details');
function save_details(){
    global $post;
    update_post_meta($post->ID, "price",
      $_POST["price"]);
    update_post_meta($post->ID, "itemcolor",
      $_POST["itemcolor"]);
    update_post_meta($post->ID, "itemsize",
      $_POST["itemsize"]);
}
Load and close
add_action("manage_posts_custom_column",        "product_custom_columns");

add_filter("manage_edit-product_columns", "product_edit_columns");

function product_edit_columns($columns){

          $columns = array(
              "cb" => "<input type="checkbox" />",
              "title" => "Product Title",
              "description" => "Description",
              "price" => "Product Price",
              "catalog" => "Catalog",

    );

          return $columns;

}
         function product_custom_columns($column){

          global $post;

          switch ($column) {

                case "description":
                    the_excerpt();
                    break;
          case "price":

                $custom = get_post_custom();
                    echo $custom["price"][0];
                    break;
          case "catalog":

                echo get_the_term_list($post->ID, 'Catalog', '', ', ','');
                    break;
          }

}
         ?>
Details Page

    Copy single.php

    Rename new file to “single-product.php”

    Coding time again!
Details Page: The Code
<?php the_post(); ?>

<?php
    query_posts( 'post_type=product');
    ?>

<h2 id="post-<?php the_ID(); ?>"><?php the_title(); ?></h2>


         <?php the_post_thumbnail( array(300,200) ); ?>
    <?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?>
    <p>Product Price: Php<?php echo get_post_meta($post->ID, 'price', true) ?></p>
    <p>Available Color(s): <?php echo get_post_meta($post->ID, 'itemcolor', true) ?></p>
    <p>Sizes: <?php echo get_post_meta($post->ID, 'itemsize', true) ?></p>



<div class="navigation">

    <div class="alignleft"><?php previous_post_link('&laquo; %link') ?></div>
        <div class="alignright"><?php next_post_link('%link &raquo;') ?></div>
</div>
Listing Page

    Create a new Page template

    Use wp_query to generate the “archive”
    (page_products.php)

    Create a new page

    Apply Page template

    Publish!
Listing Page: The Code
<?php /* Template Name: Product Archive */ ?>
    <?php get_header(); ?>
    <div id="content-col1">

<?php
    global $wp_query;
    query_posts( array('post_type' => array( 'product' ),'showposts' => 8, 'paged'=>$paged )
    );?>

<?php if (have_posts()) : ?>

<h2 id="post-<?php the_ID(); ?>"><?php the_title(); ?></h2>

<?php while (have_posts()) : the_post(); ?>

<div class="product">

    <div class="product-image"><a href="<?php the_permalink(); ?>"><?php
        the_post_thumbnail( array(160,100) ); ?></a></div>
         <div class="product-name"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div>
         <div class="product-detail">Php<?php echo get_post_meta($post->ID, 'price', true) ?></div>
</div>

<?php endwhile; endif; ?>

<div class="navigation">
    <div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
    <div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
    </div>

<?php get_sidebar(); ?>
    <?php get_footer(); ?>
Publish an empty “Product” page using “Product Archive” template
The Home Page

    News and Updates (or Blog) section

    Latest from the Listing
Generate all latest custom post entries
<?php
   global $wp_query;
   query_posts( array('post_type' => array( 'product' ),'showposts' => 4));
   ?>

<?php while ( have_posts() ) : the_post(); ?>
   <div class="product">

    <div class="product-image">
          <a href="<?php the_permalink(); ?>"><?php
       the_post_thumbnail( array(160,100) ); ?></a>
       </div>
         <div class="product-name">
            <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
         </div>
         <div class="product-detail">
            Php<?php echo get_post_meta($post->ID, 'price', true) ?>
         </div>
</div>

<?php endwhile; ?>
Generate latest from custom taxonomy
<?php
   global $wp_query;
   query_posts( array( 'catalog' => 'featured-products', 'showposts' => 4 ) );
   ?>

<?php while ( have_posts() ) : the_post(); ?>

<div class="product">

    <div class="product-image">
          <a href="<?php the_permalink(); ?>"><?php
       the_post_thumbnail( array(160,100) ); ?></a>
       </div>
         <div class="product-name">
            <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
         </div>
         <div class="product-detail">
            Php<?php echo get_post_meta($post->ID, 'price', true) ?>
         </div>
</div>

<?php endwhile; ?>
Searching Meta Data

    Meta Data are excluded from standard search

    Solution: Search Everything plugin :)
    https://core.sproutventure.com/projects/show/search-everything

    When, why and
    why you shouldn't

    Useful Plugins




                        When to “plugin”
When, Why, and Why You Shouldn't

    Coding your own themes and custom settings is
    a great learning experience.

    Don't have time? “Plugin!”

    Always remember that development and
    support for plugins depend on the developer.
Useful Plugins

    Custom Post Types
    Custom Post Types UI: http://wordpress.org/extend/plugins/custom-post-type-ui/


    Portfolio
    Woothemes: http://www.woothemes.com/
    25 Free Portfolio and Gallery Themes:
    http://www.1stwebdesigner.com/wordpress/free-portfolio-photo-gallery-wordpress-
    themes/


    Job Listing
    Job Manager Plugin: http://pento.net/projects/wordpress-job-manager-plugin/
    WP Job Board Plugin: http://wpjobboard.net/


    E-Commerce
    WP E-Commerce: http://www.instinct.co.nz/e-commerce/
    WordPress Shopping Cart Plugin: http://tribulant.com/
Reading Material

    Query_Posts:
    http://codex.wordpress.org/Function_Reference/query_posts


    Post Thumbnails:
    http://markjaquith.wordpress.com/2009/12/23/new-in-wordpress-2-9-post-thumbnail-
    images/
    http://codex.wordpress.org/Function_Reference/the_post_thumbnail


    If you want to learn more about custom
    taxonomies:
    http://www.edesignerz.net/html/14991-introducing-wordpress-3-custom-taxonomies
Learn by Deconstruction!

    Monochrome Wireframe theme

    XAMPP for Mac and Windows

    Search Everything plugin
Thank you!
             Gail Villanueva
sheeromedia.com | kutitots.com | binaryfeet.com

      Work Email: gail@sheeromedia.com

Weitere ähnliche Inhalte

Was ist angesagt?

날로 먹는 Django admin 활용
날로 먹는 Django admin 활용날로 먹는 Django admin 활용
날로 먹는 Django admin 활용KyeongMook "Kay" Cha
 
Meet Magento Belarus debug Pavel Novitsky (eng)
Meet Magento Belarus debug Pavel Novitsky (eng)Meet Magento Belarus debug Pavel Novitsky (eng)
Meet Magento Belarus debug Pavel Novitsky (eng)Pavel Novitsky
 
WordCamp Denver 2012 - Custom Meta Boxes
WordCamp Denver 2012 - Custom Meta BoxesWordCamp Denver 2012 - Custom Meta Boxes
WordCamp Denver 2012 - Custom Meta BoxesJeremy Green
 
Shortcodes In-Depth
Shortcodes In-DepthShortcodes In-Depth
Shortcodes In-DepthMicah Wood
 
jQuery from the very beginning
jQuery from the very beginningjQuery from the very beginning
jQuery from the very beginningAnis Ahmad
 
Introduction to Web Components
Introduction to Web ComponentsIntroduction to Web Components
Introduction to Web ComponentsFelix Arntz
 
Building iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoBuilding iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoRob Bontekoe
 
Make your own wp cli command in 10min
Make your own wp cli command in 10minMake your own wp cli command in 10min
Make your own wp cli command in 10minIvelina Dimova
 
Fields in Core: How to create a custom field
Fields in Core: How to create a custom fieldFields in Core: How to create a custom field
Fields in Core: How to create a custom fieldIvan Zugec
 
Working with WooCommerce Custom Fields
Working with WooCommerce Custom FieldsWorking with WooCommerce Custom Fields
Working with WooCommerce Custom FieldsAnthony Hortin
 
Система рендеринга в Magento
Система рендеринга в MagentoСистема рендеринга в Magento
Система рендеринга в MagentoMagecom Ukraine
 
Your code sucks, let's fix it - DPC UnCon
Your code sucks, let's fix it - DPC UnConYour code sucks, let's fix it - DPC UnCon
Your code sucks, let's fix it - DPC UnConRafael Dohms
 
Building secured wordpress themes and plugins
Building secured wordpress themes and pluginsBuilding secured wordpress themes and plugins
Building secured wordpress themes and pluginsTikaram Bhandari
 
Jquery presentation
Jquery presentationJquery presentation
Jquery presentationguest5d87aa6
 
Optimization in django orm
Optimization in django ormOptimization in django orm
Optimization in django ormDenys Levchenko
 
Disregard Inputs, Acquire Zend_Form
Disregard Inputs, Acquire Zend_FormDisregard Inputs, Acquire Zend_Form
Disregard Inputs, Acquire Zend_FormDaniel Cousineau
 
HirshHorn theme: how I created it
HirshHorn theme: how I created itHirshHorn theme: how I created it
HirshHorn theme: how I created itPaul Bearne
 

Was ist angesagt? (19)

날로 먹는 Django admin 활용
날로 먹는 Django admin 활용날로 먹는 Django admin 활용
날로 먹는 Django admin 활용
 
Meet Magento Belarus debug Pavel Novitsky (eng)
Meet Magento Belarus debug Pavel Novitsky (eng)Meet Magento Belarus debug Pavel Novitsky (eng)
Meet Magento Belarus debug Pavel Novitsky (eng)
 
WordCamp Denver 2012 - Custom Meta Boxes
WordCamp Denver 2012 - Custom Meta BoxesWordCamp Denver 2012 - Custom Meta Boxes
WordCamp Denver 2012 - Custom Meta Boxes
 
Shortcodes In-Depth
Shortcodes In-DepthShortcodes In-Depth
Shortcodes In-Depth
 
Quality code by design
Quality code by designQuality code by design
Quality code by design
 
jQuery from the very beginning
jQuery from the very beginningjQuery from the very beginning
jQuery from the very beginning
 
Views notwithstanding
Views notwithstandingViews notwithstanding
Views notwithstanding
 
Introduction to Web Components
Introduction to Web ComponentsIntroduction to Web Components
Introduction to Web Components
 
Building iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoBuilding iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" Domino
 
Make your own wp cli command in 10min
Make your own wp cli command in 10minMake your own wp cli command in 10min
Make your own wp cli command in 10min
 
Fields in Core: How to create a custom field
Fields in Core: How to create a custom fieldFields in Core: How to create a custom field
Fields in Core: How to create a custom field
 
Working with WooCommerce Custom Fields
Working with WooCommerce Custom FieldsWorking with WooCommerce Custom Fields
Working with WooCommerce Custom Fields
 
Система рендеринга в Magento
Система рендеринга в MagentoСистема рендеринга в Magento
Система рендеринга в Magento
 
Your code sucks, let's fix it - DPC UnCon
Your code sucks, let's fix it - DPC UnConYour code sucks, let's fix it - DPC UnCon
Your code sucks, let's fix it - DPC UnCon
 
Building secured wordpress themes and plugins
Building secured wordpress themes and pluginsBuilding secured wordpress themes and plugins
Building secured wordpress themes and plugins
 
Jquery presentation
Jquery presentationJquery presentation
Jquery presentation
 
Optimization in django orm
Optimization in django ormOptimization in django orm
Optimization in django orm
 
Disregard Inputs, Acquire Zend_Form
Disregard Inputs, Acquire Zend_FormDisregard Inputs, Acquire Zend_Form
Disregard Inputs, Acquire Zend_Form
 
HirshHorn theme: how I created it
HirshHorn theme: how I created itHirshHorn theme: how I created it
HirshHorn theme: how I created it
 

Ähnlich wie Gail villanueva add muscle to your wordpress site

Building a Portfolio With Custom Post Types
Building a Portfolio With Custom Post TypesBuilding a Portfolio With Custom Post Types
Building a Portfolio With Custom Post TypesAlex Blackie
 
How to make a WordPress theme
How to make a WordPress themeHow to make a WordPress theme
How to make a WordPress themeHardeep Asrani
 
Extending WordPress. Making use of Custom Post Types
Extending WordPress. Making use of Custom Post TypesExtending WordPress. Making use of Custom Post Types
Extending WordPress. Making use of Custom Post TypesUtsav Singh Rathour
 
PSD to WordPress
PSD to WordPressPSD to WordPress
PSD to WordPressNile Flores
 
WordPress Theme Design and Development Workshop - Day 3
WordPress Theme Design and Development Workshop - Day 3WordPress Theme Design and Development Workshop - Day 3
WordPress Theme Design and Development Workshop - Day 3Mizanur Rahaman Mizan
 
May the core be with you - JandBeyond 2014
May the core be with you - JandBeyond 2014May the core be with you - JandBeyond 2014
May the core be with you - JandBeyond 2014Chad Windnagle
 
[WLDN] Supercharging word press development in 2018
[WLDN] Supercharging word press development in 2018[WLDN] Supercharging word press development in 2018
[WLDN] Supercharging word press development in 2018Adam Tomat
 
Grok Drupal (7) Theming
Grok Drupal (7) ThemingGrok Drupal (7) Theming
Grok Drupal (7) ThemingPINGV
 
laravel tricks in 50minutes
laravel tricks in 50minuteslaravel tricks in 50minutes
laravel tricks in 50minutesBarang CK
 
WordPress Cuztom Helper
WordPress Cuztom HelperWordPress Cuztom Helper
WordPress Cuztom Helperslicejack
 
Apostrophe (improved Paris edition)
Apostrophe (improved Paris edition)Apostrophe (improved Paris edition)
Apostrophe (improved Paris edition)tompunk
 
WordPress as an application framework
WordPress as an application frameworkWordPress as an application framework
WordPress as an application frameworkDustin Filippini
 
Implement rich snippets in your webshop
Implement rich snippets in your webshopImplement rich snippets in your webshop
Implement rich snippets in your webshopArjen Miedema
 
Using shortcode in plugin development
Using shortcode in plugin developmentUsing shortcode in plugin development
Using shortcode in plugin developmentgskhanal
 
WordPress Structure and Best Practices
WordPress Structure and Best PracticesWordPress Structure and Best Practices
WordPress Structure and Best Practicesmarkparolisi
 
Dealing with Legacy PHP Applications
Dealing with Legacy PHP ApplicationsDealing with Legacy PHP Applications
Dealing with Legacy PHP ApplicationsClinton Dreisbach
 

Ähnlich wie Gail villanueva add muscle to your wordpress site (20)

Building a Portfolio With Custom Post Types
Building a Portfolio With Custom Post TypesBuilding a Portfolio With Custom Post Types
Building a Portfolio With Custom Post Types
 
How to make a WordPress theme
How to make a WordPress themeHow to make a WordPress theme
How to make a WordPress theme
 
20110820 header new style
20110820 header new style20110820 header new style
20110820 header new style
 
Extending WordPress. Making use of Custom Post Types
Extending WordPress. Making use of Custom Post TypesExtending WordPress. Making use of Custom Post Types
Extending WordPress. Making use of Custom Post Types
 
PSD to WordPress
PSD to WordPressPSD to WordPress
PSD to WordPress
 
WordPress Theme Design and Development Workshop - Day 3
WordPress Theme Design and Development Workshop - Day 3WordPress Theme Design and Development Workshop - Day 3
WordPress Theme Design and Development Workshop - Day 3
 
May the core be with you - JandBeyond 2014
May the core be with you - JandBeyond 2014May the core be with you - JandBeyond 2014
May the core be with you - JandBeyond 2014
 
[WLDN] Supercharging word press development in 2018
[WLDN] Supercharging word press development in 2018[WLDN] Supercharging word press development in 2018
[WLDN] Supercharging word press development in 2018
 
Grok Drupal (7) Theming
Grok Drupal (7) ThemingGrok Drupal (7) Theming
Grok Drupal (7) Theming
 
laravel tricks in 50minutes
laravel tricks in 50minuteslaravel tricks in 50minutes
laravel tricks in 50minutes
 
WordPress Cuztom Helper
WordPress Cuztom HelperWordPress Cuztom Helper
WordPress Cuztom Helper
 
Apostrophe (improved Paris edition)
Apostrophe (improved Paris edition)Apostrophe (improved Paris edition)
Apostrophe (improved Paris edition)
 
WordPress as an application framework
WordPress as an application frameworkWordPress as an application framework
WordPress as an application framework
 
Implement rich snippets in your webshop
Implement rich snippets in your webshopImplement rich snippets in your webshop
Implement rich snippets in your webshop
 
Using shortcode in plugin development
Using shortcode in plugin developmentUsing shortcode in plugin development
Using shortcode in plugin development
 
WordPress Structure and Best Practices
WordPress Structure and Best PracticesWordPress Structure and Best Practices
WordPress Structure and Best Practices
 
Blog Hacks 2011
Blog Hacks 2011Blog Hacks 2011
Blog Hacks 2011
 
WordCamp Praga 2015
WordCamp Praga 2015WordCamp Praga 2015
WordCamp Praga 2015
 
Dealing with Legacy PHP Applications
Dealing with Legacy PHP ApplicationsDealing with Legacy PHP Applications
Dealing with Legacy PHP Applications
 
Flask – Python
Flask – PythonFlask – Python
Flask – Python
 

Kürzlich hochgeladen

Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 

Kürzlich hochgeladen (20)

Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 

Gail villanueva add muscle to your wordpress site

  • 1. Add muscle to your by: Gail Villanueva sheeromedia.com kutitots.com WordPress website WordCamp Philippines 2010 ● 2 October 2010 ● College of St. Benilde
  • 2. Rationale  Review of Concepts Introduction
  • 3. So why am I here?  Promote WP as a low-cost, compact CMS  Don't fear WP codes!  Backup your database  Test codes locally
  • 4. Review of Concepts  Post Types  WordPress Loop Begins here: <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> Ends here: <?php endwhile; else: ?> <p><?php _e('Sorry, no posts matched your criteria.'); ?></p> <?php endif; ?>  Conditional Tags  Custom Fields
  • 5. Using WordPress as a jobsite, portfolio, or e-commerce web site WP: Not just a CMS
  • 6. The “usual” website  What's in the most basic CMS-driven website?  Homepage  News Section  Inside Pages WordPress can do more than that!
  • 10. Post Thumbnails  Single, Meta, Archive  The Homepage  Search Coding fun!
  • 11. Post Thumbnails  Displays a thumbnail image by uploading through the Post Edit screen.  Must be enabled in the functions.php first!
  • 12. Post Thumbnails: Code Add to function.php: add_theme_support('post-thumbnails'); Add to template file: <?php the_post_thumbnail( array(300,200) ); ?>
  • 13. Making our own Custom Post Type  Getting dirty with functions.php  Tie 'em up to the template!
  • 16. Creating a custom panel: The Code add_action('init', 'product_register'); function product_register() { $labels = array( 'name' => _x('Products', 'post type general name'), 'singular_name' => _x('Product Item', 'post type singular name'), 'add_new' => _x('Add New', 'product item'), 'add_new_item' => __('Add New Product Item'), 'edit_item' => __('Edit Product Item'), 'new_item' => __('New Product Item'), 'view_item' => __('View Product Item'), 'search_items' => __('Search Product'), 'not_found' => __('Nothing found'), 'not_found_in_trash' => __('Nothing found in Trash'), 'parent_item_colon' => '' ); $args = array( 'labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'query_var' => true, 'menu_icon' => get_stylesheet_directory_uri() . '/article16.png', 'rewrite' => true, 'capability_type' => 'post', 'hierarchical' => false, 'menu_position' => null, 'exclude_from_search' => false, 'supports' => array('title','editor','revisions','thumbnail') ); register_post_type( 'product' , $args ); }
  • 18. Creating custom taxonomies: The Code register_taxonomy("Catalog", array("product"), array("hierarchical" => true, "label" => "Catalog", "singular_label" => "Catalog", "rewrite" => true, 'public' => true));
  • 20. Initialize the Options add_action("admin_init", "admin_init"); function admin_init(){ add_meta_box("price-meta", "Product Price", "price", "product", "side", "low"); add_meta_box("details_meta", "Product Details", "details_meta", "product", "normal", "low"); }
  • 21. Product Price Panel function price(){ global $post; $custom = get_post_custom($post->ID); $price = $custom["price"][0]; ?> <label>Price:</label> <input name="price" value="<?php echo $price; ?>" /> <?php }
  • 22. Product Details Panel function details_meta() { global $post; $custom = get_post_custom($post->ID); $itemcolor = $custom["itemcolor"][0]; $itemsize = $custom["itemsize"][0]; ?> <p><label>Item Color:</label><br /> <textarea cols="50" rows="1" name="itemcolor"><?php echo $itemcolor; ?></textarea></p> <p><label>Available Sizes:</label><br /> <textarea cols="50" rows="1" name="itemsize"><?php echo $itemsize; ?></textarea></p> <?php }
  • 23. Save Details add_action('save_post', 'save_details'); function save_details(){ global $post; update_post_meta($post->ID, "price", $_POST["price"]); update_post_meta($post->ID, "itemcolor", $_POST["itemcolor"]); update_post_meta($post->ID, "itemsize", $_POST["itemsize"]); }
  • 24. Load and close add_action("manage_posts_custom_column", "product_custom_columns"); add_filter("manage_edit-product_columns", "product_edit_columns"); function product_edit_columns($columns){ $columns = array( "cb" => "<input type="checkbox" />", "title" => "Product Title", "description" => "Description", "price" => "Product Price", "catalog" => "Catalog", ); return $columns; } function product_custom_columns($column){ global $post; switch ($column) { case "description": the_excerpt(); break; case "price": $custom = get_post_custom(); echo $custom["price"][0]; break; case "catalog": echo get_the_term_list($post->ID, 'Catalog', '', ', ',''); break; } } ?>
  • 25. Details Page  Copy single.php  Rename new file to “single-product.php”  Coding time again!
  • 26. Details Page: The Code <?php the_post(); ?> <?php query_posts( 'post_type=product'); ?> <h2 id="post-<?php the_ID(); ?>"><?php the_title(); ?></h2> <?php the_post_thumbnail( array(300,200) ); ?> <?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?> <p>Product Price: Php<?php echo get_post_meta($post->ID, 'price', true) ?></p> <p>Available Color(s): <?php echo get_post_meta($post->ID, 'itemcolor', true) ?></p> <p>Sizes: <?php echo get_post_meta($post->ID, 'itemsize', true) ?></p> <div class="navigation"> <div class="alignleft"><?php previous_post_link('&laquo; %link') ?></div> <div class="alignright"><?php next_post_link('%link &raquo;') ?></div> </div>
  • 27. Listing Page  Create a new Page template  Use wp_query to generate the “archive” (page_products.php)  Create a new page  Apply Page template  Publish!
  • 28. Listing Page: The Code <?php /* Template Name: Product Archive */ ?> <?php get_header(); ?> <div id="content-col1"> <?php global $wp_query; query_posts( array('post_type' => array( 'product' ),'showposts' => 8, 'paged'=>$paged ) );?> <?php if (have_posts()) : ?> <h2 id="post-<?php the_ID(); ?>"><?php the_title(); ?></h2> <?php while (have_posts()) : the_post(); ?> <div class="product"> <div class="product-image"><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail( array(160,100) ); ?></a></div> <div class="product-name"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div> <div class="product-detail">Php<?php echo get_post_meta($post->ID, 'price', true) ?></div> </div> <?php endwhile; endif; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div> <div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div> </div> <?php get_sidebar(); ?> <?php get_footer(); ?>
  • 29. Publish an empty “Product” page using “Product Archive” template
  • 30. The Home Page  News and Updates (or Blog) section  Latest from the Listing
  • 31. Generate all latest custom post entries <?php global $wp_query; query_posts( array('post_type' => array( 'product' ),'showposts' => 4)); ?> <?php while ( have_posts() ) : the_post(); ?> <div class="product"> <div class="product-image"> <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail( array(160,100) ); ?></a> </div> <div class="product-name"> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> </div> <div class="product-detail"> Php<?php echo get_post_meta($post->ID, 'price', true) ?> </div> </div> <?php endwhile; ?>
  • 32. Generate latest from custom taxonomy <?php global $wp_query; query_posts( array( 'catalog' => 'featured-products', 'showposts' => 4 ) ); ?> <?php while ( have_posts() ) : the_post(); ?> <div class="product"> <div class="product-image"> <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail( array(160,100) ); ?></a> </div> <div class="product-name"> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> </div> <div class="product-detail"> Php<?php echo get_post_meta($post->ID, 'price', true) ?> </div> </div> <?php endwhile; ?>
  • 33. Searching Meta Data  Meta Data are excluded from standard search  Solution: Search Everything plugin :) https://core.sproutventure.com/projects/show/search-everything
  • 34. When, why and why you shouldn't  Useful Plugins When to “plugin”
  • 35. When, Why, and Why You Shouldn't  Coding your own themes and custom settings is a great learning experience.  Don't have time? “Plugin!”  Always remember that development and support for plugins depend on the developer.
  • 36. Useful Plugins  Custom Post Types Custom Post Types UI: http://wordpress.org/extend/plugins/custom-post-type-ui/  Portfolio Woothemes: http://www.woothemes.com/ 25 Free Portfolio and Gallery Themes: http://www.1stwebdesigner.com/wordpress/free-portfolio-photo-gallery-wordpress- themes/  Job Listing Job Manager Plugin: http://pento.net/projects/wordpress-job-manager-plugin/ WP Job Board Plugin: http://wpjobboard.net/  E-Commerce WP E-Commerce: http://www.instinct.co.nz/e-commerce/ WordPress Shopping Cart Plugin: http://tribulant.com/
  • 37. Reading Material  Query_Posts: http://codex.wordpress.org/Function_Reference/query_posts  Post Thumbnails: http://markjaquith.wordpress.com/2009/12/23/new-in-wordpress-2-9-post-thumbnail- images/ http://codex.wordpress.org/Function_Reference/the_post_thumbnail  If you want to learn more about custom taxonomies: http://www.edesignerz.net/html/14991-introducing-wordpress-3-custom-taxonomies
  • 38. Learn by Deconstruction!  Monochrome Wireframe theme  XAMPP for Mac and Windows  Search Everything plugin
  • 39. Thank you! Gail Villanueva sheeromedia.com | kutitots.com | binaryfeet.com Work Email: gail@sheeromedia.com