2009-08-28-WordPress-Widget-Development

10
WordPress Widget Development By Warwick Booth

description

 

Transcript of 2009-08-28-WordPress-Widget-Development

Page 1: 2009-08-28-WordPress-Widget-Development

WordPress Widget Development

By Warwick Booth

Page 2: 2009-08-28-WordPress-Widget-Development

Agenda

• Introduction• Background• Before you start• Basic Widgets• Widget Control• Functions.php  • Wrap + Q&A

Page 3: 2009-08-28-WordPress-Widget-Development

• Who am I• What we will be chatting

about• What are we trying to

achieve.

Introduction

Page 4: 2009-08-28-WordPress-Widget-Development

Background

• Where to find info• Where I find help

Page 5: 2009-08-28-WordPress-Widget-Development

Before you start

• Create your files• Set up frame work• Set up empty functions• Version Check

/*Plugin Name: WP-PageNaviPlugin URI: http://lesterchan.net/portfolio/programming/php/Description: Adds a more advanced paging navigation to your WordPress blog.Version: 2.40Author: Lester 'GaMerZ' ChanAuthor URI: http://lesterchan.net*/

Page 6: 2009-08-28-WordPress-Widget-Development

Basic Widgets• Create a widget• Register a widget• Call the Widget

Page 7: 2009-08-28-WordPress-Widget-Development

Widget Control

• HTML Formso $_Post Vars

• Saving Options• Displaying options

Page 8: 2009-08-28-WordPress-Widget-Development

Functions.php

• Why functions.php• What to move• $Args • Global widgets for

BuddyPress

function list_authors_widget($args) {$targs = array(    'optioncount'   => false,     'exclude_admin' => false,     'show_fullname' => false,    'hide_empty'    => true,    'echo'          => true,    'style'         => 'list'    ); ?><h2 class="widgettitle"><span class="" rel="29">Author List</span></h2><?php    echo '<ul>';wp_list_authors( $targs ); echo '</ul>';}

Page 9: 2009-08-28-WordPress-Widget-Development

Wrap up Q + A

• Basics of creating a widget• Global widgets for

BuddyPress

Page 10: 2009-08-28-WordPress-Widget-Development