SlideShare a Scribd company logo
JavaScript Templating in
WordPress
Rakesh Lawaju
racase.com.np
Digamber Pradhan
digamberpradhan.com.np
Speakers
Rakesh Lawaju
Co-founder/ CTO
WEN Solutions
iamracaseracase
Digamber Pradhan
Team Lead, Sr. WordPress Developer
Web Experts Nepal
digamberpradhandigamberpradhan
racase.com.np
digamberpradhan.com.np
“JavaScript templating refers to the client side
data binding method implemented with the
JavaScript language.
-Wikipedia
WHAT IS JAVASCRIPT
TEMPLATING?
WHY TO USE
JAVASCRIPT
TEMPLATING?Just think about it.
Wouldn’t it be better and fast if just raw data like in JSON format is sent
from server and display it in HTML on the client side?
And
that pain in appending data in HTML!!
How about reducing this pain?
PROS:
➤ Data generation is separate from presentation code, so good code organization
➤ Web server load is reduced
➤ Output generation is more expressive (template syntax doesn't require a sea of string
concatenation)
➤ Working with Web Designers
CONS:
➤ Users with JavaScript disabled, will very likely not be able to use it.
➤ Search Engines will not be able to index your page.
➤ Not widely used and well documented for WordPress
HOW TO IMPLEMENT JAVASCRIPT
TEMPLATING IN WORDPRESS?
wp.template() is used to load template.
Template system is based on Underscore.js.
WordPress also has done some modification to use Mustache " {{ }} " instea
“wp-util” should be enqueued to use templating.
{{ var }} is used for HTML-escaped data.
{{{ var }}} is used for raw data (not escaped).
<# some_code() #> allows you to evaluate any JavaScript code.
“data” is the name of the object that holds all the data passed to the templat
“tmpl-“ has to be prefixed on each template id
JS Template
https://github.com/codearryaas/wp-js-templating-trial
Demo Code
https://github.com/digamber89/wp-js-templating
** These are just sample code. Do not use for production.**
Thank you!

More Related Content

PDF
NextJS, A JavaScript Framework for building next generation SPA
PDF
Accessibility in the age of the headless CMS
PDF
NextJS - Online Summit for Frontend Developers September 2020
PDF
WeBB MeetUp#1 Web applications caching techniques
PDF
Introduction to Web Development Career
PDF
[FrontInBH 2012] Por uma web mais rápida: técnicas de otimizações de sites - ...
PDF
Sustainable Theming
PDF
Next.js in production by Jasdeep Lalli
NextJS, A JavaScript Framework for building next generation SPA
Accessibility in the age of the headless CMS
NextJS - Online Summit for Frontend Developers September 2020
WeBB MeetUp#1 Web applications caching techniques
Introduction to Web Development Career
[FrontInBH 2012] Por uma web mais rápida: técnicas de otimizações de sites - ...
Sustainable Theming
Next.js in production by Jasdeep Lalli

What's hot (20)

PDF
Tm CMS Tool | TM CMS Tool development company in bangalore.
PDF
The MEAN Stack
PPTX
Introduction to mean stack
PDF
Caching and Optimization By M Asif Rahman @ WordCamp Orlando 2012 Final
PPT
Get MEAN! Node.js and the MEAN stack
PDF
MEAN Stack
PPTX
Web development processes
PDF
Going Global with WordPress Multilingual (WordCamp Denpasar 2016)
PPTX
JavaScript Performance (at SFJS)
PPTX
bootstrap
ODP
Introduction To Django
PPTX
Html5 aavaas gajurel techmela
ZIP
Django 101
PDF
UXPA Norfolk - Working with Developers
PDF
2 myroslava garasym - competence development- cheat sheet for beginners
PDF
Wordpress e commerce solution , wordpress e-commerce solution development com...
PPTX
Themes that perform short: WordCamp Antwerp 2016
PPTX
MEAN Stack
PPTX
MEAN Stack
PDF
Magento 2 Community Project - Moving from LESS to SASS
Tm CMS Tool | TM CMS Tool development company in bangalore.
The MEAN Stack
Introduction to mean stack
Caching and Optimization By M Asif Rahman @ WordCamp Orlando 2012 Final
Get MEAN! Node.js and the MEAN stack
MEAN Stack
Web development processes
Going Global with WordPress Multilingual (WordCamp Denpasar 2016)
JavaScript Performance (at SFJS)
bootstrap
Introduction To Django
Html5 aavaas gajurel techmela
Django 101
UXPA Norfolk - Working with Developers
2 myroslava garasym - competence development- cheat sheet for beginners
Wordpress e commerce solution , wordpress e-commerce solution development com...
Themes that perform short: WordCamp Antwerp 2016
MEAN Stack
MEAN Stack
Magento 2 Community Project - Moving from LESS to SASS
Ad

Viewers also liked (17)

PPTX
WordPress: Doing Simply & Effectively
DOCX
WordPress Plugin development useful links
PDF
WordPress beginners course part 1
PPT
Why Drupal Should Be More Like WordPress
PDF
8 Ways to Hack a WordPress website
PDF
Using WordPress for a Course Website
PDF
WordCamp Ireland - 40 tips for WordPress Optimization
PDF
Building a Website The Easy Way With Wordpress
PDF
Architecting an Highly Available and Scalable WordPress Site in AWS
PDF
WordPress SEO & Optimisation
PDF
Designing WordPress - Heart&Sole2011
PPTX
Introduction to WordPress
PDF
WordPress for the modern PHP developer
PDF
WordPress & User Experience - WordCamp London
PDF
The Future of Education is Digital
PDF
"Past Present and Future of Entrepreneurship Education" presentation at USASB...
PPTX
7 Ways Soft-Skills Power Organizational Performance
WordPress: Doing Simply & Effectively
WordPress Plugin development useful links
WordPress beginners course part 1
Why Drupal Should Be More Like WordPress
8 Ways to Hack a WordPress website
Using WordPress for a Course Website
WordCamp Ireland - 40 tips for WordPress Optimization
Building a Website The Easy Way With Wordpress
Architecting an Highly Available and Scalable WordPress Site in AWS
WordPress SEO & Optimisation
Designing WordPress - Heart&Sole2011
Introduction to WordPress
WordPress for the modern PHP developer
WordPress & User Experience - WordCamp London
The Future of Education is Digital
"Past Present and Future of Entrepreneurship Education" presentation at USASB...
7 Ways Soft-Skills Power Organizational Performance
Ad

Similar to Java script templating in wordpress (20)

PDF
Ajax World West
PDF
Fundamental Progressive Enhancement [Web Design World Boston 2008]
PDF
Tips to improve your website performance
PDF
Client-side Rendering Vs. Server-side Rendering Vs. Pre-Rendering for Web App...
PDF
How To Use Server-Side Rendering with Nuxt.js
PDF
Why Use Server Side Rendering To Boost Performance and User Experience?
PDF
How to Make a PWA Search Engine Friendly.pdf
PDF
How to Make a PWA Search Engine Friendly
PPTX
Top 5 Javascript Frameworks for Web and Mobile App Development
PDF
What is Server-side Rendering? How to Render Your React App on the Server-sid...
PPTX
Web Development Today
PDF
Modern Architectures with Spring and JavaScript
PPTX
txWelcome to Javascript Welcome to Javascript.pp
PPTX
SSR with Quasar Framework - JSNation 2019
PDF
Proven ways to improve your website performance optimizing front end and back...
PPTX
What is a good technology stack today?
PDF
Architectures For Scaling Ajax
PDF
[QCon 2011] Por uma web mais rápida: técnicas de otimização de Sites
PDF
JAX 2012: Moderne Architektur mit Spring und JavaScript
PDF
What is Next js.pdf
Ajax World West
Fundamental Progressive Enhancement [Web Design World Boston 2008]
Tips to improve your website performance
Client-side Rendering Vs. Server-side Rendering Vs. Pre-Rendering for Web App...
How To Use Server-Side Rendering with Nuxt.js
Why Use Server Side Rendering To Boost Performance and User Experience?
How to Make a PWA Search Engine Friendly.pdf
How to Make a PWA Search Engine Friendly
Top 5 Javascript Frameworks for Web and Mobile App Development
What is Server-side Rendering? How to Render Your React App on the Server-sid...
Web Development Today
Modern Architectures with Spring and JavaScript
txWelcome to Javascript Welcome to Javascript.pp
SSR with Quasar Framework - JSNation 2019
Proven ways to improve your website performance optimizing front end and back...
What is a good technology stack today?
Architectures For Scaling Ajax
[QCon 2011] Por uma web mais rápida: técnicas de otimização de Sites
JAX 2012: Moderne Architektur mit Spring und JavaScript
What is Next js.pdf

Recently uploaded (20)

PDF
Electronic commerce courselecture one. Pdf
PPTX
Spectroscopy.pptx food analysis technology
PPTX
Cloud computing and distributed systems.
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
A Presentation on Artificial Intelligence
PDF
A comparative analysis of optical character recognition models for extracting...
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Approach and Philosophy of On baking technology
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
Electronic commerce courselecture one. Pdf
Spectroscopy.pptx food analysis technology
Cloud computing and distributed systems.
Diabetes mellitus diagnosis method based random forest with bat algorithm
A Presentation on Artificial Intelligence
A comparative analysis of optical character recognition models for extracting...
MYSQL Presentation for SQL database connectivity
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Assigned Numbers - 2025 - Bluetooth® Document
Unlocking AI with Model Context Protocol (MCP)
NewMind AI Weekly Chronicles - August'25-Week II
Approach and Philosophy of On baking technology
Chapter 3 Spatial Domain Image Processing.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Reach Out and Touch Someone: Haptics and Empathic Computing
Network Security Unit 5.pdf for BCA BBA.
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Spectral efficient network and resource selection model in 5G networks

Java script templating in wordpress

  • 1. JavaScript Templating in WordPress Rakesh Lawaju racase.com.np Digamber Pradhan digamberpradhan.com.np
  • 2. Speakers Rakesh Lawaju Co-founder/ CTO WEN Solutions iamracaseracase Digamber Pradhan Team Lead, Sr. WordPress Developer Web Experts Nepal digamberpradhandigamberpradhan racase.com.np digamberpradhan.com.np
  • 3. “JavaScript templating refers to the client side data binding method implemented with the JavaScript language. -Wikipedia WHAT IS JAVASCRIPT TEMPLATING?
  • 4. WHY TO USE JAVASCRIPT TEMPLATING?Just think about it. Wouldn’t it be better and fast if just raw data like in JSON format is sent from server and display it in HTML on the client side? And that pain in appending data in HTML!! How about reducing this pain?
  • 5. PROS: ➤ Data generation is separate from presentation code, so good code organization ➤ Web server load is reduced ➤ Output generation is more expressive (template syntax doesn't require a sea of string concatenation) ➤ Working with Web Designers CONS: ➤ Users with JavaScript disabled, will very likely not be able to use it. ➤ Search Engines will not be able to index your page. ➤ Not widely used and well documented for WordPress
  • 6. HOW TO IMPLEMENT JAVASCRIPT TEMPLATING IN WORDPRESS? wp.template() is used to load template. Template system is based on Underscore.js. WordPress also has done some modification to use Mustache " {{ }} " instea “wp-util” should be enqueued to use templating. {{ var }} is used for HTML-escaped data. {{{ var }}} is used for raw data (not escaped). <# some_code() #> allows you to evaluate any JavaScript code. “data” is the name of the object that holds all the data passed to the templat “tmpl-“ has to be prefixed on each template id