SlideShare a Scribd company logo
[WordPress Shortcodes] Creating Better Content  w/ Shortcodes Boston WordCamp 2011
What Is The Problem? WordPress users with minimal HTML experience spend too much time trying to create and format content.
Why Are Shortcodes Useful? Easy to manage Easier access to dynamic content Simplify repetitive tasks Make things look  pretty
What Are Shortcodes? Bits of code you use in the WordPress visual editor to generate dynamic content on the front end. HTML: Shortcode: Result:
Built-In WordPress.org Shortcodes [gallery] The [gallery] shortcode is used in a Post or Page to display a thumbnail gallery of images attached to that post.
Built-In WordPress.com Shortcodes Misc Shortcodes: [archives] [contact-form] [digg] [googlemaps] [polldaddy] [sourcecode][/sourcecode] Assortment of Shortcodes for: Images Videos Audio
Using Shortcodes Enclosed/Self-Enclosed [shortcode]Some Content[/shortcode] [shortcode] Attributes [shortcode option1="something" option2="more"] [shortcode option1="more"]Some Content[/shortcode]
Creating Simple Shortcodes function wpb_shortcode() {      return 'Hi Boston WordCamp!'; } add_shortcode('wpb', 'wpb_shortcode'); Now use can use [wpb] in your posts & pages to display the returned content from our wpb_boston function.
Creating Advanced Shortcodes function link_shortcode($atts, $content = null) {     extract(shortcode_atts(          array(               'class' => 'link',              'href' => '#'           ), $atts      ));      return '<a href=&quot;'.$href.'&quot; class=&quot;'.$class.'&quot;>'.$content.'</a>'; } add_shortcode('link', 'link_shortcode'); Now use can use [link] in your posts & pages to display the returned content from our link_shortcode function
Real World Examples Turn This Into This via Striking Theme
Examples cont. Buttons via ElegantThemes Content Boxes via J Shortcodes
Examples cont. Icon Lists via Showtime Theme Columns via Awake Theme
Examples cont. Drop Caps via Striking Theme Quotes via Avisio Theme
Examples cont. Pricing Table via ElegantThemes Author Info via HubSpot for WordPress Plugin
Examples cont. Contact Forms via inFocus Theme Tabs via  DynamiX Theme
Other Cool Uses Advertising Social Media Buttons Calls to Action Posts from RSS Hiding Private Content Displaying Widgets in Content
Potential Pitfalls w/ Shortcodes Themes vs Plugins Nesting Usability
Making Shortcodes Even Easier Using a UI to manage and insert shortcodes via ElegantThemes
Making Shortcodes Even Easier cont. via Striking Theme via HubSpot for WordPress Plugin
Shortcode Tips & Tricks The following will execute all shortcodes in a string of text: do_shortcode('Text with a [shortcode] in it'); Use this to run shortcodes in a text widget: add_filter('widget_text', 'do_shortcode'); Execute a shortcode anywhere in your template files: do_shortcode('[shortcode]');
Thanks! Jon Bishop Web Developer in Boston Area WordPress Plugins: Socialize HubSpot for WordPress Website / JonBishop.com Newsletter / WPBusiness.info Twitter / @JonDBishop

More Related Content

What's hot (20)

PDF
AEM Client Context Customisation
Ankit Gubrani
 
PDF
Common html
Daniel Downs
 
PPTX
Ask the AEM Community Expert Feb 2016 Session: AEM + Brackets
AdobeMarketingCloud
 
PPTX
Html5 semantics
Webtech Learning
 
PPTX
Timothyframework
timoth059
 
PPTX
All about TemplateToaster and its Features
Davis Brown
 
PPT
Web design
mjk194
 
PPT
Spark View Engine
curtismitchell
 
PPT
SEO Recommendations for WordPress
Nick Roshon
 
PDF
How to implement internationalization (i18n) in angular application(multiple ...
Katy Slemon
 
PDF
WordPress and the 3 Bears: Themes, Plugins & Widgets
BobWP.com
 
PPT
Web Designing Bugs - Fixes By Nyros Developer
Nyros Technologies
 
PDF
Polymer - Una bella historia de amor
Israel Blancas
 
PPTX
Tech recommendation
Ashish garg
 
PPTX
Web scraping
rebekacox
 
PPTX
Complete HTML5 Training in Urdu/Hindi
Online IT Video Courses
 
PPT
Flex in portal
Sunil Patil
 
PPT
EECI - EE And Magento Integration
Simplified Safety
 
PPTX
Html5 Introduction For Beginners
Ariful Islam
 
PPT
Skinning in Flex 4
Saurabh Narula
 
AEM Client Context Customisation
Ankit Gubrani
 
Common html
Daniel Downs
 
Ask the AEM Community Expert Feb 2016 Session: AEM + Brackets
AdobeMarketingCloud
 
Html5 semantics
Webtech Learning
 
Timothyframework
timoth059
 
All about TemplateToaster and its Features
Davis Brown
 
Web design
mjk194
 
Spark View Engine
curtismitchell
 
SEO Recommendations for WordPress
Nick Roshon
 
How to implement internationalization (i18n) in angular application(multiple ...
Katy Slemon
 
WordPress and the 3 Bears: Themes, Plugins & Widgets
BobWP.com
 
Web Designing Bugs - Fixes By Nyros Developer
Nyros Technologies
 
Polymer - Una bella historia de amor
Israel Blancas
 
Tech recommendation
Ashish garg
 
Web scraping
rebekacox
 
Complete HTML5 Training in Urdu/Hindi
Online IT Video Courses
 
Flex in portal
Sunil Patil
 
EECI - EE And Magento Integration
Simplified Safety
 
Html5 Introduction For Beginners
Ariful Islam
 
Skinning in Flex 4
Saurabh Narula
 

Similar to Creating Content With Shortcodes (20)

PPT
WordCamp Boston 2012 - Creating Content With Shortcodes
Jon Bishop
 
PDF
Shortcodes In-Depth
Micah Wood
 
PPTX
Wordpress Shortcode
Binh Dang Ngoc
 
PDF
Plugins on word press
Koombea
 
PDF
Shortcodes: WordUp Pompey! Feb-2012
Herb Miller
 
PPTX
Working with Shortcodes in WordPress
chaefele
 
PDF
Mastering the shortcode api
Peter Baylies
 
PPTX
Shortcodes vs Widgets: Which one and how?
Amanda Giles
 
PDF
<Head> Presentation: Plugging Into Wordpress
Matt Harris
 
PPTX
Tamp bay word press meetup – npr feb-11_2015 meetup
Oyster Bay Marauders LLC
 
PPT
Developing Plugins For WordPress
Lester Chan
 
PPTX
Tìm hiểu Wordpress shortcode
Lương Bá Hợp
 
PPTX
Start a Blog: Module 6
Merri Dennis
 
PPTX
Unpack wordpress
swordstudios
 
PPTX
How to create your own WordPress plugin
John Tighe
 
PPT
Wordpress Meetup 2 23 10
boonebgorges
 
PDF
Wordpress as a framework
Aggelos Synadakis
 
PPT
Whipping WordPress into SEO Shape
Ben Cook
 
PPT
Whipping Wordpress Into SEO Shape
Market Saint Louis
 
PDF
Wordpress course-outline-bongomin-daniel
Daniel Bongomin
 
WordCamp Boston 2012 - Creating Content With Shortcodes
Jon Bishop
 
Shortcodes In-Depth
Micah Wood
 
Wordpress Shortcode
Binh Dang Ngoc
 
Plugins on word press
Koombea
 
Shortcodes: WordUp Pompey! Feb-2012
Herb Miller
 
Working with Shortcodes in WordPress
chaefele
 
Mastering the shortcode api
Peter Baylies
 
Shortcodes vs Widgets: Which one and how?
Amanda Giles
 
<Head> Presentation: Plugging Into Wordpress
Matt Harris
 
Tamp bay word press meetup – npr feb-11_2015 meetup
Oyster Bay Marauders LLC
 
Developing Plugins For WordPress
Lester Chan
 
Tìm hiểu Wordpress shortcode
Lương Bá Hợp
 
Start a Blog: Module 6
Merri Dennis
 
Unpack wordpress
swordstudios
 
How to create your own WordPress plugin
John Tighe
 
Wordpress Meetup 2 23 10
boonebgorges
 
Wordpress as a framework
Aggelos Synadakis
 
Whipping WordPress into SEO Shape
Ben Cook
 
Whipping Wordpress Into SEO Shape
Market Saint Louis
 
Wordpress course-outline-bongomin-daniel
Daniel Bongomin
 
Ad

Recently uploaded (8)

PDF
UCSP-Quarter1_M5.pdf POLITICS AND POLITICL
jaredcagampan86
 
PPTX
LESSON 1 IN PHILOSOPHY- INTRODUCTION TO PHILOSOPHY
MaimaiAlleraAcpal
 
PPTX
Presentatiof local anaesthesiaonon1.pptx
harmanjotsingh483731
 
PPTX
UP SDRF History English.pptxdownload it is easy to understand
aanyatiwari1015
 
PPTX
Free Preparation and Survival Apps that can save your life
Bob Mayer
 
PPTX
AAM - NQAS Orientation CHALLANGES & SOLUTION 24 & 25 FEB24.pptx
minikashyap9528
 
PPTX
Impact_of_Power_Outages_Presentation.pptx
mansisingh27077
 
PPTX
Positive Role Modeling for Personal Growth.pptx
StrengthsTheatre
 
UCSP-Quarter1_M5.pdf POLITICS AND POLITICL
jaredcagampan86
 
LESSON 1 IN PHILOSOPHY- INTRODUCTION TO PHILOSOPHY
MaimaiAlleraAcpal
 
Presentatiof local anaesthesiaonon1.pptx
harmanjotsingh483731
 
UP SDRF History English.pptxdownload it is easy to understand
aanyatiwari1015
 
Free Preparation and Survival Apps that can save your life
Bob Mayer
 
AAM - NQAS Orientation CHALLANGES & SOLUTION 24 & 25 FEB24.pptx
minikashyap9528
 
Impact_of_Power_Outages_Presentation.pptx
mansisingh27077
 
Positive Role Modeling for Personal Growth.pptx
StrengthsTheatre
 
Ad

Creating Content With Shortcodes

  • 1. [WordPress Shortcodes] Creating Better Content  w/ Shortcodes Boston WordCamp 2011
  • 2. What Is The Problem? WordPress users with minimal HTML experience spend too much time trying to create and format content.
  • 3. Why Are Shortcodes Useful? Easy to manage Easier access to dynamic content Simplify repetitive tasks Make things look  pretty
  • 4. What Are Shortcodes? Bits of code you use in the WordPress visual editor to generate dynamic content on the front end. HTML: Shortcode: Result:
  • 5. Built-In WordPress.org Shortcodes [gallery] The [gallery] shortcode is used in a Post or Page to display a thumbnail gallery of images attached to that post.
  • 6. Built-In WordPress.com Shortcodes Misc Shortcodes: [archives] [contact-form] [digg] [googlemaps] [polldaddy] [sourcecode][/sourcecode] Assortment of Shortcodes for: Images Videos Audio
  • 7. Using Shortcodes Enclosed/Self-Enclosed [shortcode]Some Content[/shortcode] [shortcode] Attributes [shortcode option1=&quot;something&quot; option2=&quot;more&quot;] [shortcode option1=&quot;more&quot;]Some Content[/shortcode]
  • 8. Creating Simple Shortcodes function wpb_shortcode() {     return 'Hi Boston WordCamp!'; } add_shortcode('wpb', 'wpb_shortcode'); Now use can use [wpb] in your posts & pages to display the returned content from our wpb_boston function.
  • 9. Creating Advanced Shortcodes function link_shortcode($atts, $content = null) {     extract(shortcode_atts(          array(               'class' => 'link',              'href' => '#'           ), $atts      ));      return '<a href=&quot;'.$href.'&quot; class=&quot;'.$class.'&quot;>'.$content.'</a>'; } add_shortcode('link', 'link_shortcode'); Now use can use [link] in your posts & pages to display the returned content from our link_shortcode function
  • 10. Real World Examples Turn This Into This via Striking Theme
  • 11. Examples cont. Buttons via ElegantThemes Content Boxes via J Shortcodes
  • 12. Examples cont. Icon Lists via Showtime Theme Columns via Awake Theme
  • 13. Examples cont. Drop Caps via Striking Theme Quotes via Avisio Theme
  • 14. Examples cont. Pricing Table via ElegantThemes Author Info via HubSpot for WordPress Plugin
  • 15. Examples cont. Contact Forms via inFocus Theme Tabs via  DynamiX Theme
  • 16. Other Cool Uses Advertising Social Media Buttons Calls to Action Posts from RSS Hiding Private Content Displaying Widgets in Content
  • 17. Potential Pitfalls w/ Shortcodes Themes vs Plugins Nesting Usability
  • 18. Making Shortcodes Even Easier Using a UI to manage and insert shortcodes via ElegantThemes
  • 19. Making Shortcodes Even Easier cont. via Striking Theme via HubSpot for WordPress Plugin
  • 20. Shortcode Tips & Tricks The following will execute all shortcodes in a string of text: do_shortcode('Text with a [shortcode] in it'); Use this to run shortcodes in a text widget: add_filter('widget_text', 'do_shortcode'); Execute a shortcode anywhere in your template files: do_shortcode('[shortcode]');
  • 21. Thanks! Jon Bishop Web Developer in Boston Area WordPress Plugins: Socialize HubSpot for WordPress Website / JonBishop.com Newsletter / WPBusiness.info Twitter / @JonDBishop

Editor's Notes

  • #2: Intro: WordPress allows me to enable my customers to take control of content they previously had no control over Shortcodes are one of the ways I give my customers control over their content What do I mean by better content? Mostly I just mean better looking content but you can also have access to content that was previously harder to display on your WordPress site.
  • #4: Easy to use: With only a few keystrokes you can create and test your shortcodes. Easy to create: Shortcodes are easy to create and with a little know-how you can convert previously repetitive tasks into easy to use shortcodes Simplify repetitive tasks: Rather than have my clients copy and paste chunks of code to recreate buttons or text boxes on their sites they can simply reuse the same shortcodes which are a lot easier to remember and involve a lot less code on their end
  • #5: Shortcodes were added in WordPress 2.5 as an easy way to create macros for use in your content.
  • #7: Jetpack Plugin
  • #9: You associate your shortcode with a handler using add_shortcode.
  • #18: If you are using shortcodes provided by a theme you are potentially bound to that theme unless you change your content or find a theme with the same shortcode syntax Your handler needs to call do_shortcode