SlideShare a Scribd company logo
1 of 31
Download to read offline
Making WordPress
Bend To Your Will
Before we dive in a little info about myself
That is the extent of my photoshop skills; hence the reason I’m a developer and not a
designer.
Tom Jenkins
Tom Jenkins


       #bendwordpresstoyourwillbecauseyoucananditisfuntodoso




Hear is the hashtag - if nothing else comes out of this talk I’d like to see this trending in KC
on twitter
Whats the level of WordPress knowledge in the room?
How many PHP devs are here?
Designers wanting to do more?
Content creators who want to know whats running under the hood?
Making WordPress
                 Bend To Your Will

          WTF Does That Mean?


I wasn’t sure at first what this meant either.
This lady came up with the title so it was my job to come up with the content.
So I spent some time thinking about it and we’re not bending WordPress to do anything.
We’re extending it.
API
                           WORDPRESS


WordPress has grown leaps and bounds over the last several versions so we’re going to take
a closer look at what the WordPress API exposes for us to help us create our own
implementations. We’ll start with the basic small stuff and work our way up the ladder. Feel
free to ask questions along the way if you have any.
Review some site demos to show what can be done
Themes




The easiest and code free way is to use a Theme that has the built in functionality that you
want. There are 1,411 free themes to choose from at WordPress.org and hundreds, if not
thousands more at Premium theme shops around the web
Plugins




Another way is the through loading plugins already created by the many developers out there
that work in WordPress
Template Tags




The most basic way to extend a theme while putting forth a minimal amount of effort is
Template Tags.
Template Tags
     A template tag is code that instructs WordPress to "do" or "get" something.


            http://codex.wordpress.org/Template_Tags




read quote - example - template tag page
But you don’t want to do things the lazy way, you want to get your hands a little dirty and do
things that allow for a little more power.
API
                                     Hooks




So lets start getting into some of the API known as Hooks
API
                                    Hooks
                                   Actions
   Actions are the hooks that the WordPress core launches at
   specific points during execution, or when specific events
   occur.

   ex. Actions are triggered by specific events that take place
   in WordPress, such as publishing a post, changing themes,
   or displaying a page of the admin panel.



Hooks are broken down into two types, The first is Actions
API
                           Hooks
                           Filters
   Filters are the hooks that WordPress launches to modify
   text of various types before adding it to the database or
   sending it to the browser screen.

   Filters sit between the database and the browser (when
   WordPress is generating pages), and between the browser
   and the database (when WordPress is adding new posts and
   comments to the database); most input and output in
   WordPress passes through at least one filter.

Next up we have Filters
How Do I Use Them?
                  http://adambrown.info/p/wp_hooks




How Do I Use Them?
I’m glad you asked.
To get a better understanding of what you can even hook into within wordpress I recommend
visiting this website.
show them and step through an example
How Do I Use Them?
                                   http://adambrown.info/p/wp_hooks

     add_action ( 'hook_name', 'your_function_name', [priority], [accepted_args] );


     add_filter ( 'hook_name', 'your_filter', [priority], [accepted_args] );




For actions and filters the syntax for calling them is nearly identical
hook_name 
The name of an action hook provided by WordPress, that tells what event your function should be associated with.
your_function_name 
The name of the function that you want to be executed following the event specified by hook_name. This can be a standard php function, a function present in the
WordPress core, or a function defined by you in the plugin file (such as 'email_friends'defined above).
priority 
An optional integer argument that can be used to specify the order in which the functions associated with a particular action are executed (default: 10). Lower numbers
correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action.
accepted_args 
An optional integer argument defining how many arguments your function can accept (default 1), useful because some hooks can pass more than one argument to your
function. This parameter is new in release 1.5.1.

We looked at what actions are available, the syntax around an action call, but how you know
when an action if fired if you don’t want to read through Core everytime?
I can assure you that actions and filters are not an evil duo...
But in fact co-exist to bring give us access to all that Core has to offer. But we don’t have to
settle for that.
Create Your Own!!
                        do_action( $tag, $arg );


                        $myvar = apply_filters( $tag, $value );




To further extend the concept of actions and filters we aren’t limited to just using what is
given to us by core, we can also create our own actions and filter in the same way by adding
do_action and apply_filters. There are also ways to remove existing actions and filters from
firing but I’ll let you explore that on your own.
Now lets start to run and look at some other API’s WordPress has to offer.
Widgets API
                       class My_Widget extends WP_Widget {
                       	 function My_Widget() {
                       	 	 // widget actual processes
                       	 }

                       	   function form($instance) {
                       	   	 // outputs the options form on admin
                       	   }

                       	   function update($new_instance, $old_instance) {
                       	   	 // processes widget options to be saved
                       	   }

                       	   function widget($args, $instance) {
                       	   	 // outputs the content of the widget
                       	   }

                       }
                       register_widget('My_Widget');




review the structure
example
Plugin API
                <?php
                /*
                Plugin Name: Name Of The Plugin
                Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
                Description: A brief description of the Plugin.
                Version: The Plugin's Version Number, e.g.: 1.0
                Author: Name Of The Plugin Author
                Author URI: http://URI_Of_The_Plugin_Author
                License: A "Slug" license name e.g. GPL2
                */
                ?>




Here is the way that WordPress knows that it should look for a plugin
example
Options API
 The Options API is a simple and standardized way of storing data in the database.


            // Create an option to the database
            add_option( $option, $value = , $deprecated = , $autoload = 'yes' );

            // Removes option by name.
            delete_option( $option );

            // Fetch a saved option
            get_option( $option, $default = false );

            // Update the value of an option that was already added.
            update_option( $option, $newvalue );




Options API is for storing generic or universal data that relates to the theme or plugin.
Drawbacks to using the API for themes is once the theme is changed, the customization is
gone.
Data Validation


http://codex.wordpress.org/Data_Validation
Custom Post Type
       register_post_type( $post_type, $args )




Custom Post Types have gotten a lot of press and for good reason, This functionality is part
of what many consider the reason why WordPress can now be used as a content management
system.

The arguments are extensive though, but not all are needed.
example
Still Skeptical or...
Logical Awesome
Questions?


Tom Jenkins
http://techguytom.com
tom@techguytom.com
@techguytom

More Related Content

What's hot

WordPress Developers Israel Meetup #1
WordPress Developers Israel Meetup #1WordPress Developers Israel Meetup #1
WordPress Developers Israel Meetup #1Yoav Farhi
 
Shortcodes vs Widgets: Which one and how?
Shortcodes vs Widgets: Which one and how?Shortcodes vs Widgets: Which one and how?
Shortcodes vs Widgets: Which one and how?Amanda Giles
 
The Way to Theme Enlightenment
The Way to Theme EnlightenmentThe Way to Theme Enlightenment
The Way to Theme EnlightenmentAmanda Giles
 
So, you want to be a plugin developer?
So, you want to be a plugin developer?So, you want to be a plugin developer?
So, you want to be a plugin developer?ylefebvre
 
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...LinnAlexandra
 
WordPress Bootcamp Part 2 - Extending WordPress
WordPress Bootcamp Part 2 - Extending WordPressWordPress Bootcamp Part 2 - Extending WordPress
WordPress Bootcamp Part 2 - Extending WordPressMetronet
 
WordPress Plugin Basics
WordPress Plugin BasicsWordPress Plugin Basics
WordPress Plugin BasicsAmanda Giles
 
Creating Your First WordPress Plugin
Creating Your First WordPress PluginCreating Your First WordPress Plugin
Creating Your First WordPress PluginBrad Williams
 
WordPress Realtime - WordCamp São Paulo 2015
WordPress Realtime - WordCamp São Paulo 2015WordPress Realtime - WordCamp São Paulo 2015
WordPress Realtime - WordCamp São Paulo 2015Fernando Daciuk
 
Writing your Third Plugin
Writing your Third PluginWriting your Third Plugin
Writing your Third PluginJustin Ryan
 
WordPress Plugin development
WordPress Plugin developmentWordPress Plugin development
WordPress Plugin developmentMostafa Soufi
 
Understanding Technologies - Presentation for College Students
Understanding Technologies - Presentation for College StudentsUnderstanding Technologies - Presentation for College Students
Understanding Technologies - Presentation for College StudentsKetan Raval
 
<Head> Presentation: Plugging Into Wordpress
<Head> Presentation: Plugging Into Wordpress<Head> Presentation: Plugging Into Wordpress
<Head> Presentation: Plugging Into WordpressMatt Harris
 
Object Oriented Programming for WordPress Plugin Development
Object Oriented Programming for WordPress Plugin DevelopmentObject Oriented Programming for WordPress Plugin Development
Object Oriented Programming for WordPress Plugin Developmentmtoppa
 
The Open-source Eclipse Plugin for Force.com Development, Summer ‘14
The Open-source Eclipse Plugin for Force.com Development, Summer ‘14The Open-source Eclipse Plugin for Force.com Development, Summer ‘14
The Open-source Eclipse Plugin for Force.com Development, Summer ‘14Salesforce Developers
 
WordPress Custom Post Types
WordPress Custom Post TypesWordPress Custom Post Types
WordPress Custom Post TypesNile Flores
 

What's hot (19)

WordPress Developers Israel Meetup #1
WordPress Developers Israel Meetup #1WordPress Developers Israel Meetup #1
WordPress Developers Israel Meetup #1
 
Shortcodes vs Widgets: Which one and how?
Shortcodes vs Widgets: Which one and how?Shortcodes vs Widgets: Which one and how?
Shortcodes vs Widgets: Which one and how?
 
The Way to Theme Enlightenment
The Way to Theme EnlightenmentThe Way to Theme Enlightenment
The Way to Theme Enlightenment
 
So, you want to be a plugin developer?
So, you want to be a plugin developer?So, you want to be a plugin developer?
So, you want to be a plugin developer?
 
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
 
WordPress Bootcamp Part 2 - Extending WordPress
WordPress Bootcamp Part 2 - Extending WordPressWordPress Bootcamp Part 2 - Extending WordPress
WordPress Bootcamp Part 2 - Extending WordPress
 
WordPress Plugin Basics
WordPress Plugin BasicsWordPress Plugin Basics
WordPress Plugin Basics
 
Creating Your First WordPress Plugin
Creating Your First WordPress PluginCreating Your First WordPress Plugin
Creating Your First WordPress Plugin
 
WordPress Realtime - WordCamp São Paulo 2015
WordPress Realtime - WordCamp São Paulo 2015WordPress Realtime - WordCamp São Paulo 2015
WordPress Realtime - WordCamp São Paulo 2015
 
Writing your Third Plugin
Writing your Third PluginWriting your Third Plugin
Writing your Third Plugin
 
WordPress Plugin development
WordPress Plugin developmentWordPress Plugin development
WordPress Plugin development
 
Writing Pluggable Software
Writing Pluggable SoftwareWriting Pluggable Software
Writing Pluggable Software
 
Ant User Guide
Ant User GuideAnt User Guide
Ant User Guide
 
Understanding Technologies - Presentation for College Students
Understanding Technologies - Presentation for College StudentsUnderstanding Technologies - Presentation for College Students
Understanding Technologies - Presentation for College Students
 
<Head> Presentation: Plugging Into Wordpress
<Head> Presentation: Plugging Into Wordpress<Head> Presentation: Plugging Into Wordpress
<Head> Presentation: Plugging Into Wordpress
 
Object Oriented Programming for WordPress Plugin Development
Object Oriented Programming for WordPress Plugin DevelopmentObject Oriented Programming for WordPress Plugin Development
Object Oriented Programming for WordPress Plugin Development
 
Oop's in php
Oop's in php Oop's in php
Oop's in php
 
The Open-source Eclipse Plugin for Force.com Development, Summer ‘14
The Open-source Eclipse Plugin for Force.com Development, Summer ‘14The Open-source Eclipse Plugin for Force.com Development, Summer ‘14
The Open-source Eclipse Plugin for Force.com Development, Summer ‘14
 
WordPress Custom Post Types
WordPress Custom Post TypesWordPress Custom Post Types
WordPress Custom Post Types
 

Similar to Bending word press to your will

Write your first WordPress plugin
Write your first WordPress pluginWrite your first WordPress plugin
Write your first WordPress pluginAnthony Montalbano
 
How to Create a Custom WordPress Plugin
How to Create a Custom WordPress PluginHow to Create a Custom WordPress Plugin
How to Create a Custom WordPress PluginAndolasoft Inc
 
How To Write a WordPress Plugin
How To Write a WordPress PluginHow To Write a WordPress Plugin
How To Write a WordPress PluginAndy Stratton
 
Getting started with WordPress development
Getting started with WordPress developmentGetting started with WordPress development
Getting started with WordPress developmentSteve Mortiboy
 
Plug in development
Plug in developmentPlug in development
Plug in developmentLucky Ali
 
How to create your own WordPress plugin
How to create your own WordPress pluginHow to create your own WordPress plugin
How to create your own WordPress pluginJohn Tighe
 
Best practices in WordPress Development
Best practices in WordPress DevelopmentBest practices in WordPress Development
Best practices in WordPress DevelopmentMindfire Solutions
 
Introduction to Plugin Programming, WordCamp Miami 2011
Introduction to Plugin Programming, WordCamp Miami 2011Introduction to Plugin Programming, WordCamp Miami 2011
Introduction to Plugin Programming, WordCamp Miami 2011David Carr
 
Intro to WordPress Plugin Development
Intro to WordPress Plugin DevelopmentIntro to WordPress Plugin Development
Intro to WordPress Plugin DevelopmentBrad Williams
 
WordPress Plugin Development For Beginners
WordPress Plugin Development For BeginnersWordPress Plugin Development For Beginners
WordPress Plugin Development For Beginnersjohnpbloch
 
WordCamp Greenville 2018 - Beware the Dark Side, or an Intro to Development
WordCamp Greenville 2018 - Beware the Dark Side, or an Intro to DevelopmentWordCamp Greenville 2018 - Beware the Dark Side, or an Intro to Development
WordCamp Greenville 2018 - Beware the Dark Side, or an Intro to DevelopmentEvan Mullins
 
Plugin development demystified 2017
Plugin development demystified 2017Plugin development demystified 2017
Plugin development demystified 2017ylefebvre
 
Step by step guide for creating wordpress plugin
Step by step guide for creating wordpress pluginStep by step guide for creating wordpress plugin
Step by step guide for creating wordpress pluginMainak Goswami
 
So, You Wanna Dev? Join the Team! - WordCamp Raleigh 2017
So, You Wanna Dev? Join the Team! - WordCamp Raleigh 2017 So, You Wanna Dev? Join the Team! - WordCamp Raleigh 2017
So, You Wanna Dev? Join the Team! - WordCamp Raleigh 2017 Evan Mullins
 
WordPress Plugin Development- Rich Media Institute Workshop
WordPress Plugin Development- Rich Media Institute WorkshopWordPress Plugin Development- Rich Media Institute Workshop
WordPress Plugin Development- Rich Media Institute WorkshopBrendan Sera-Shriar
 
Wordpress plugin creation_overview
Wordpress plugin creation_overviewWordpress plugin creation_overview
Wordpress plugin creation_overviewDaniel Kline
 
Plugin Development Practices
Plugin Development PracticesPlugin Development Practices
Plugin Development Practicesdanpastori
 
Writing your own WordPress themes and plugins
Writing your own WordPress themes and pluginsWriting your own WordPress themes and plugins
Writing your own WordPress themes and pluginsStephanie Wells
 

Similar to Bending word press to your will (20)

Write your first WordPress plugin
Write your first WordPress pluginWrite your first WordPress plugin
Write your first WordPress plugin
 
How to Create a Custom WordPress Plugin
How to Create a Custom WordPress PluginHow to Create a Custom WordPress Plugin
How to Create a Custom WordPress Plugin
 
How To Write a WordPress Plugin
How To Write a WordPress PluginHow To Write a WordPress Plugin
How To Write a WordPress Plugin
 
Getting started with WordPress development
Getting started with WordPress developmentGetting started with WordPress development
Getting started with WordPress development
 
Plug in development
Plug in developmentPlug in development
Plug in development
 
How to create your own WordPress plugin
How to create your own WordPress pluginHow to create your own WordPress plugin
How to create your own WordPress plugin
 
Best practices in WordPress Development
Best practices in WordPress DevelopmentBest practices in WordPress Development
Best practices in WordPress Development
 
Introduction to Plugin Programming, WordCamp Miami 2011
Introduction to Plugin Programming, WordCamp Miami 2011Introduction to Plugin Programming, WordCamp Miami 2011
Introduction to Plugin Programming, WordCamp Miami 2011
 
Intro to WordPress Plugin Development
Intro to WordPress Plugin DevelopmentIntro to WordPress Plugin Development
Intro to WordPress Plugin Development
 
WordPress Plugin Development For Beginners
WordPress Plugin Development For BeginnersWordPress Plugin Development For Beginners
WordPress Plugin Development For Beginners
 
WordCamp Greenville 2018 - Beware the Dark Side, or an Intro to Development
WordCamp Greenville 2018 - Beware the Dark Side, or an Intro to DevelopmentWordCamp Greenville 2018 - Beware the Dark Side, or an Intro to Development
WordCamp Greenville 2018 - Beware the Dark Side, or an Intro to Development
 
Plugin development demystified 2017
Plugin development demystified 2017Plugin development demystified 2017
Plugin development demystified 2017
 
Wordpress as a framework
Wordpress as a frameworkWordpress as a framework
Wordpress as a framework
 
Wordcamp2012 build your plugin
Wordcamp2012 build your pluginWordcamp2012 build your plugin
Wordcamp2012 build your plugin
 
Step by step guide for creating wordpress plugin
Step by step guide for creating wordpress pluginStep by step guide for creating wordpress plugin
Step by step guide for creating wordpress plugin
 
So, You Wanna Dev? Join the Team! - WordCamp Raleigh 2017
So, You Wanna Dev? Join the Team! - WordCamp Raleigh 2017 So, You Wanna Dev? Join the Team! - WordCamp Raleigh 2017
So, You Wanna Dev? Join the Team! - WordCamp Raleigh 2017
 
WordPress Plugin Development- Rich Media Institute Workshop
WordPress Plugin Development- Rich Media Institute WorkshopWordPress Plugin Development- Rich Media Institute Workshop
WordPress Plugin Development- Rich Media Institute Workshop
 
Wordpress plugin creation_overview
Wordpress plugin creation_overviewWordpress plugin creation_overview
Wordpress plugin creation_overview
 
Plugin Development Practices
Plugin Development PracticesPlugin Development Practices
Plugin Development Practices
 
Writing your own WordPress themes and plugins
Writing your own WordPress themes and pluginsWriting your own WordPress themes and plugins
Writing your own WordPress themes and plugins
 

Bending word press to your will

  • 2. Before we dive in a little info about myself That is the extent of my photoshop skills; hence the reason I’m a developer and not a designer.
  • 4. Tom Jenkins #bendwordpresstoyourwillbecauseyoucananditisfuntodoso Hear is the hashtag - if nothing else comes out of this talk I’d like to see this trending in KC on twitter Whats the level of WordPress knowledge in the room? How many PHP devs are here? Designers wanting to do more? Content creators who want to know whats running under the hood?
  • 5. Making WordPress Bend To Your Will WTF Does That Mean? I wasn’t sure at first what this meant either.
  • 6. This lady came up with the title so it was my job to come up with the content. So I spent some time thinking about it and we’re not bending WordPress to do anything. We’re extending it.
  • 7. API WORDPRESS WordPress has grown leaps and bounds over the last several versions so we’re going to take a closer look at what the WordPress API exposes for us to help us create our own implementations. We’ll start with the basic small stuff and work our way up the ladder. Feel free to ask questions along the way if you have any. Review some site demos to show what can be done
  • 8.
  • 9. Themes The easiest and code free way is to use a Theme that has the built in functionality that you want. There are 1,411 free themes to choose from at WordPress.org and hundreds, if not thousands more at Premium theme shops around the web
  • 10. Plugins Another way is the through loading plugins already created by the many developers out there that work in WordPress
  • 11. Template Tags The most basic way to extend a theme while putting forth a minimal amount of effort is Template Tags.
  • 12. Template Tags A template tag is code that instructs WordPress to "do" or "get" something. http://codex.wordpress.org/Template_Tags read quote - example - template tag page
  • 13. But you don’t want to do things the lazy way, you want to get your hands a little dirty and do things that allow for a little more power.
  • 14. API Hooks So lets start getting into some of the API known as Hooks
  • 15. API Hooks Actions Actions are the hooks that the WordPress core launches at specific points during execution, or when specific events occur. ex. Actions are triggered by specific events that take place in WordPress, such as publishing a post, changing themes, or displaying a page of the admin panel. Hooks are broken down into two types, The first is Actions
  • 16. API Hooks Filters Filters are the hooks that WordPress launches to modify text of various types before adding it to the database or sending it to the browser screen. Filters sit between the database and the browser (when WordPress is generating pages), and between the browser and the database (when WordPress is adding new posts and comments to the database); most input and output in WordPress passes through at least one filter. Next up we have Filters
  • 17. How Do I Use Them? http://adambrown.info/p/wp_hooks How Do I Use Them? I’m glad you asked. To get a better understanding of what you can even hook into within wordpress I recommend visiting this website. show them and step through an example
  • 18. How Do I Use Them? http://adambrown.info/p/wp_hooks add_action ( 'hook_name', 'your_function_name', [priority], [accepted_args] ); add_filter ( 'hook_name', 'your_filter', [priority], [accepted_args] ); For actions and filters the syntax for calling them is nearly identical hook_name  The name of an action hook provided by WordPress, that tells what event your function should be associated with. your_function_name  The name of the function that you want to be executed following the event specified by hook_name. This can be a standard php function, a function present in the WordPress core, or a function defined by you in the plugin file (such as 'email_friends'defined above). priority  An optional integer argument that can be used to specify the order in which the functions associated with a particular action are executed (default: 10). Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action. accepted_args  An optional integer argument defining how many arguments your function can accept (default 1), useful because some hooks can pass more than one argument to your function. This parameter is new in release 1.5.1. We looked at what actions are available, the syntax around an action call, but how you know when an action if fired if you don’t want to read through Core everytime?
  • 19. I can assure you that actions and filters are not an evil duo...
  • 20. But in fact co-exist to bring give us access to all that Core has to offer. But we don’t have to settle for that.
  • 21. Create Your Own!! do_action( $tag, $arg ); $myvar = apply_filters( $tag, $value ); To further extend the concept of actions and filters we aren’t limited to just using what is given to us by core, we can also create our own actions and filter in the same way by adding do_action and apply_filters. There are also ways to remove existing actions and filters from firing but I’ll let you explore that on your own.
  • 22. Now lets start to run and look at some other API’s WordPress has to offer.
  • 23. Widgets API class My_Widget extends WP_Widget { function My_Widget() { // widget actual processes } function form($instance) { // outputs the options form on admin } function update($new_instance, $old_instance) { // processes widget options to be saved } function widget($args, $instance) { // outputs the content of the widget } } register_widget('My_Widget'); review the structure example
  • 24. Plugin API <?php /* Plugin Name: Name Of The Plugin Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates Description: A brief description of the Plugin. Version: The Plugin's Version Number, e.g.: 1.0 Author: Name Of The Plugin Author Author URI: http://URI_Of_The_Plugin_Author License: A "Slug" license name e.g. GPL2 */ ?> Here is the way that WordPress knows that it should look for a plugin example
  • 25. Options API The Options API is a simple and standardized way of storing data in the database. // Create an option to the database add_option( $option, $value = , $deprecated = , $autoload = 'yes' ); // Removes option by name. delete_option( $option ); // Fetch a saved option get_option( $option, $default = false ); // Update the value of an option that was already added. update_option( $option, $newvalue ); Options API is for storing generic or universal data that relates to the theme or plugin. Drawbacks to using the API for themes is once the theme is changed, the customization is gone.
  • 27.
  • 28. Custom Post Type register_post_type( $post_type, $args ) Custom Post Types have gotten a lot of press and for good reason, This functionality is part of what many consider the reason why WordPress can now be used as a content management system. The arguments are extensive though, but not all are needed. example