SlideShare ist ein Scribd-Unternehmen logo
1 von 40
Downloaden Sie, um offline zu lesen
WordPress
         Build a WordPress theme from HTML5 template
Mario Peshev
http://devwp.eu
DevriX
http://devrix.com
Mario Peshev
1.   WordPress engineer @ Placester
2.   DevirX CTO
3.   @no_fear_inc
Contents
1.   What is WordPress and WP Themes?
2.   Few words about WordPress theme
     development process
3.   Useful plugins and tactics
4.   Actual work
5.   Wrapping up
WordPress
1.   Super mega powerful!
     • (surprise, surprise) 
2.   More than 70 000 000 websites online
3.   Tens of thousands of themes and
     plugins (both free and premium)
4.   Ready for eCommerce, Groupon, Q&A,
     forum, social network, ticketing system
     and many more
Theme Development
1.       WordPress Themes:
     •    files that work together to create the
          design and functionality of a WordPress
          site
     •    each Theme may be different and offering
          many choices for site owners
2.       http://codex.wordpress.org/Theme_Develop
         ment
Template Hierarchy




http://codex.wordpress.org/images/1/18/Templa
   te_Hierarchy.png
Theme Unit Test
1.   http://codex.wordpress.org/Theme_Unit_
     Test
2.   Why they are important?
3.   Why we have to use them?
What’s the best way of building
                                 my theme?
1.       Follow the flow from Theme Development
         page:
     •    DEBUG TRUE
     •    Template File Checklist
     •    Theme Unit Test
     •    Validating a Website
     •    Theme Review
Cheats
1.   error_reporting(E_ALL);
2.   ini_set('display_errors', 'yes');
Plugins
1.   Theme Check
2.   Debug Bar
3.   Log Deprecated Notices
4.   Debogger
5.   Theme Mentor
6.   Monster Widget
7.   Developer
8.   Regenerate Thumbnails
9.   WordPress Beta Tester
Theme Check
1.   “A simple and easy way to test your
     theme for all the latest WordPress
     standards and practices. A great theme
     development tool!”
2.   http://wordpress.org/extend/plugins/theme-
     check/
Theme Mentor
1.   Cousin of the Theme Check
2.   http://wordpress.org/extend/plugins/theme-
     mentor/
3.   Open to contributions
Start




Integrating HTML5 template into a WP theme

                                 credits: designyoutrust.com
Warning
Important notices
1.       A PSD is not:
     •    a brochure
     •    a calendar
     •    a wallpaper / magazine cover / whatever
2.       Site design should work with:
     •    different content (thousands of pages)
     •    different resolutions / browsers / operating
          systems / platforms
CMS Integrations
1.   Every CMS has it’s own specifics and
     expectations in terms of markup
2.   It’s best to know the system in depth in
     order to draw the appropriate design and
     slice it properly
WordPress
C'mon, let’s integrate!
The Target
Step 0
1.       Make sure that:
     •    Code is valid and understandable
     •    Code is reusable
     •    Template markup seems WP-compatible
2.       Note: some PHP knowledge is required
Step 1
1.       Setup development environment –
         XAMPP, LAMP/WAMP/MAMP
2.       Create a database for the new install
3.       Install WordPress
     •    http://codex.wordpress.org/Installing_Wor
          dPress
4.       Create theme folder in WP-
         installation/wp-content/themes/name-of-
         our-theme
Step 2
1.   Create style.css, index.php, header.php,
     sidebar.php and footer.php files
2.   Activate our theme and our website
     should be empty white page. For now...
Step 3
1.   Copy-paste the content from original
     template to these files
2.   Still our website will be white (empty)
3.   Paste what was left in our original
     template to the index.php and we should
     see the content. Still rough, but he is
     there
Step 4 - style.css
   /*
   Theme Name: Students Telerik Demo
   Theme URI: http://example.com
   Author: DevriX
   Author URI: http://devrix.com/
   Description:
   Version: 0.1.0
   License: GNU General Public License v2 or later
   License URI: http://www.gnu.org/licenses/gpl-2.0.html
   */
Step 5
 Fix all   static image paths in the style.css file




 Organize     images in images/ folder
                                                        24
Step 6
1.   Fix styles path
2.   Something like this:



3.   Add other styles/js if there are any
So far, so good
1.       Now, we have all images, text, styles, etc,
         but all these elements are static. We have to
         write some code and make theme editable
         and dynamic
2.       Change all static information in header.php
         <head> tag:
     •     site title
     •     description
     •     others
Step 7
1.   Move content from index.php to
     home.php or front-page.php if you want
     to create a landing page
2.   Edit index.php
3.   Get content from other page(not index
     page) and place the code in index.php
4.   Now we have landing page with content
     from "Home" and if we go to some inner
     page, we will see the content from inner
     pages
Step 8
1.       Delete static content
2.       Edit index.php:
     •     remove all content and add




3.       Create a Blog.php file, which will be used for
         Blog Templates and use WP_Query to display
         all posts
Step 9
 Use predefined   tags, such as:
  the_title()
  the_content()
  the_permalink()
  They work in a loop
  A single post view is like an array with 1
   element



                                                         29
Step 10
 Define sidebar




                             30
Step 11
 Add sidebar   to a page




                                      31
Step 12
 Define menu




 Call ita few times or use register_nav_menus
  for several menus


                                                 32
Step 13
 Add the   menu to a block in the markup




 theme_location   is sufficient                  33
Step 14
 Call comment_form()
                   or
 comments_template(…):




                                   34
Step 15
 Enjoy! 




                       35
What’s next?
 Once you’re   ready with the theme, you could:
  Add some complex plugins for more
   functionality
  Integrate some APIs to social networks or
   remote services
  Work on the next theme of yours




                                                   36
Recommended Plugins
 Types and Views

 WPML

 WooCommerce

 BuddyPress

 S2Member

 Contact Form      7 / Gravity Forms
 Free and   Paid


                                              37
Want to be a WP theme ninja?
 Check out Theme    Reviewers Team guides:
  Theme Review
  Theme Unit Test
  WPTRT page
  Theme-Check plugin
 Become a Pro   and submit on ThemeForest and
 WPORG
 Get popularand we’ll provide a free WPML
 author license for you.
                                                 38
WordPress




    курсове и уроци по програмиране , уеб дизайн – безплатно    BG Coder - онлайн състезателна система - online judge
          курсове и уроци по програмиране – Телерик академия    форум програмиране, форум уеб дизайн
               уроци по програмиране и уеб дизайн за ученици    ASP.NET курс - уеб програмиране, бази данни, C#, .NET, ASP.NET




                                                                                                                                 http://academy.telerik.com
           програмиране за деца – безплатни курсове и уроци     ASP.NET MVC курс – HTML, SQL, C#, .NET, ASP.NET MVC
                безплатен SEO курс - оптимизация за търсачки     алго академия – състезателно програмиране, състезания
курсове и уроци по програмиране , книги – безплатно от Наков    курс мобилни приложения с iPhone, Android, WP7, PhoneGap
        уроци по уеб дизайн, HTML, CSS, JavaScript, Photoshop   Дончо Минков - сайт за програмиране
       free C# book, безплатна книга C#, книга Java, книга C#   Николай Костов - блог за програмиране
                    безплатен курс "Качествен програмен код"
       безплатен курс "Разработка на софтуер в cloud среда"     C# курс, програмиране, безплатно
Free Trainings @ Telerik Academy
   Telerik Software Academy
       academy.telerik.com
   Telerik Academy @ Facebook
       facebook.com/TelerikAcademy
   Telerik Software Academy Forums
       forums.academy.telerik.com

Weitere ähnliche Inhalte

Mehr von Mario Peshev

oDesk - running virtual companies
oDesk - running virtual companiesoDesk - running virtual companies
oDesk - running virtual companies
Mario Peshev
 

Mehr von Mario Peshev (20)

The Future Of WordPress In 2020
The Future Of WordPress In 2020The Future Of WordPress In 2020
The Future Of WordPress In 2020
 
What Makes PHP An Awesome Language
What Makes PHP An Awesome LanguageWhat Makes PHP An Awesome Language
What Makes PHP An Awesome Language
 
Top 6 Business Tips for October 2019
Top 6 Business Tips for October 2019Top 6 Business Tips for October 2019
Top 6 Business Tips for October 2019
 
The Future of WordPress And WooCommerce
The Future of WordPress And WooCommerceThe Future of WordPress And WooCommerce
The Future of WordPress And WooCommerce
 
Tips for Successful WordPress Enterprise Projects
Tips for Successful WordPress Enterprise ProjectsTips for Successful WordPress Enterprise Projects
Tips for Successful WordPress Enterprise Projects
 
WordPress Architecture for Tech-Savvy Managers
WordPress Architecture for Tech-Savvy ManagersWordPress Architecture for Tech-Savvy Managers
WordPress Architecture for Tech-Savvy Managers
 
Business and Monetization Opportunities for Developers
Business and Monetization Opportunities for DevelopersBusiness and Monetization Opportunities for Developers
Business and Monetization Opportunities for Developers
 
Building SaaS with WordPress - WordCamp Netherlands 2016
Building SaaS with WordPress - WordCamp Netherlands 2016Building SaaS with WordPress - WordCamp Netherlands 2016
Building SaaS with WordPress - WordCamp Netherlands 2016
 
WordPress Code Architecture
WordPress Code ArchitectureWordPress Code Architecture
WordPress Code Architecture
 
Virtual Company - Go Limitless
Virtual Company - Go LimitlessVirtual Company - Go Limitless
Virtual Company - Go Limitless
 
Debugging WordPress
Debugging WordPressDebugging WordPress
Debugging WordPress
 
Platforms based on WordPress
Platforms based on WordPressPlatforms based on WordPress
Platforms based on WordPress
 
WordPress Theme Reviewers Team
WordPress Theme Reviewers TeamWordPress Theme Reviewers Team
WordPress Theme Reviewers Team
 
Get Involved with WordPress
Get Involved with WordPressGet Involved with WordPress
Get Involved with WordPress
 
Contributing to WordPress
Contributing to WordPressContributing to WordPress
Contributing to WordPress
 
Start Your Website for Free!
Start Your Website for Free!Start Your Website for Free!
Start Your Website for Free!
 
Choosing a WordPress Theme
Choosing a WordPress ThemeChoosing a WordPress Theme
Choosing a WordPress Theme
 
Sass in 5
Sass in 5Sass in 5
Sass in 5
 
Custom Post Types in the wild (WordCamp Sofia 2012)
Custom Post Types in the wild (WordCamp Sofia 2012)Custom Post Types in the wild (WordCamp Sofia 2012)
Custom Post Types in the wild (WordCamp Sofia 2012)
 
oDesk - running virtual companies
oDesk - running virtual companiesoDesk - running virtual companies
oDesk - running virtual companies
 

Kürzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Kürzlich hochgeladen (20)

Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 

WordPress Theme from HTML Template

  • 1. WordPress Build a WordPress theme from HTML5 template Mario Peshev http://devwp.eu DevriX http://devrix.com
  • 2. Mario Peshev 1. WordPress engineer @ Placester 2. DevirX CTO 3. @no_fear_inc
  • 3. Contents 1. What is WordPress and WP Themes? 2. Few words about WordPress theme development process 3. Useful plugins and tactics 4. Actual work 5. Wrapping up
  • 4. WordPress 1. Super mega powerful! • (surprise, surprise)  2. More than 70 000 000 websites online 3. Tens of thousands of themes and plugins (both free and premium) 4. Ready for eCommerce, Groupon, Q&A, forum, social network, ticketing system and many more
  • 5. Theme Development 1. WordPress Themes: • files that work together to create the design and functionality of a WordPress site • each Theme may be different and offering many choices for site owners 2. http://codex.wordpress.org/Theme_Develop ment
  • 7. Theme Unit Test 1. http://codex.wordpress.org/Theme_Unit_ Test 2. Why they are important? 3. Why we have to use them?
  • 8. What’s the best way of building my theme? 1. Follow the flow from Theme Development page: • DEBUG TRUE • Template File Checklist • Theme Unit Test • Validating a Website • Theme Review
  • 9. Cheats 1. error_reporting(E_ALL); 2. ini_set('display_errors', 'yes');
  • 10. Plugins 1. Theme Check 2. Debug Bar 3. Log Deprecated Notices 4. Debogger 5. Theme Mentor 6. Monster Widget 7. Developer 8. Regenerate Thumbnails 9. WordPress Beta Tester
  • 11. Theme Check 1. “A simple and easy way to test your theme for all the latest WordPress standards and practices. A great theme development tool!” 2. http://wordpress.org/extend/plugins/theme- check/
  • 12. Theme Mentor 1. Cousin of the Theme Check 2. http://wordpress.org/extend/plugins/theme- mentor/ 3. Open to contributions
  • 13. Start Integrating HTML5 template into a WP theme credits: designyoutrust.com
  • 15. Important notices 1. A PSD is not: • a brochure • a calendar • a wallpaper / magazine cover / whatever 2. Site design should work with: • different content (thousands of pages) • different resolutions / browsers / operating systems / platforms
  • 16. CMS Integrations 1. Every CMS has it’s own specifics and expectations in terms of markup 2. It’s best to know the system in depth in order to draw the appropriate design and slice it properly
  • 19. Step 0 1. Make sure that: • Code is valid and understandable • Code is reusable • Template markup seems WP-compatible 2. Note: some PHP knowledge is required
  • 20. Step 1 1. Setup development environment – XAMPP, LAMP/WAMP/MAMP 2. Create a database for the new install 3. Install WordPress • http://codex.wordpress.org/Installing_Wor dPress 4. Create theme folder in WP- installation/wp-content/themes/name-of- our-theme
  • 21. Step 2 1. Create style.css, index.php, header.php, sidebar.php and footer.php files 2. Activate our theme and our website should be empty white page. For now...
  • 22. Step 3 1. Copy-paste the content from original template to these files 2. Still our website will be white (empty) 3. Paste what was left in our original template to the index.php and we should see the content. Still rough, but he is there
  • 23. Step 4 - style.css  /*  Theme Name: Students Telerik Demo  Theme URI: http://example.com  Author: DevriX  Author URI: http://devrix.com/  Description:  Version: 0.1.0  License: GNU General Public License v2 or later  License URI: http://www.gnu.org/licenses/gpl-2.0.html  */
  • 24. Step 5  Fix all static image paths in the style.css file  Organize images in images/ folder 24
  • 25. Step 6 1. Fix styles path 2. Something like this: 3. Add other styles/js if there are any
  • 26. So far, so good 1. Now, we have all images, text, styles, etc, but all these elements are static. We have to write some code and make theme editable and dynamic 2. Change all static information in header.php <head> tag: • site title • description • others
  • 27. Step 7 1. Move content from index.php to home.php or front-page.php if you want to create a landing page 2. Edit index.php 3. Get content from other page(not index page) and place the code in index.php 4. Now we have landing page with content from "Home" and if we go to some inner page, we will see the content from inner pages
  • 28. Step 8 1. Delete static content 2. Edit index.php: • remove all content and add 3. Create a Blog.php file, which will be used for Blog Templates and use WP_Query to display all posts
  • 29. Step 9  Use predefined tags, such as:  the_title()  the_content()  the_permalink()  They work in a loop  A single post view is like an array with 1 element 29
  • 30. Step 10  Define sidebar 30
  • 31. Step 11  Add sidebar to a page 31
  • 32. Step 12  Define menu  Call ita few times or use register_nav_menus for several menus 32
  • 33. Step 13  Add the menu to a block in the markup  theme_location is sufficient 33
  • 34. Step 14  Call comment_form() or comments_template(…): 34
  • 36. What’s next?  Once you’re ready with the theme, you could:  Add some complex plugins for more functionality  Integrate some APIs to social networks or remote services  Work on the next theme of yours 36
  • 37. Recommended Plugins  Types and Views  WPML  WooCommerce  BuddyPress  S2Member  Contact Form 7 / Gravity Forms  Free and Paid 37
  • 38. Want to be a WP theme ninja?  Check out Theme Reviewers Team guides:  Theme Review  Theme Unit Test  WPTRT page  Theme-Check plugin  Become a Pro and submit on ThemeForest and WPORG  Get popularand we’ll provide a free WPML author license for you. 38
  • 39. WordPress курсове и уроци по програмиране , уеб дизайн – безплатно BG Coder - онлайн състезателна система - online judge курсове и уроци по програмиране – Телерик академия форум програмиране, форум уеб дизайн уроци по програмиране и уеб дизайн за ученици ASP.NET курс - уеб програмиране, бази данни, C#, .NET, ASP.NET http://academy.telerik.com програмиране за деца – безплатни курсове и уроци ASP.NET MVC курс – HTML, SQL, C#, .NET, ASP.NET MVC безплатен SEO курс - оптимизация за търсачки алго академия – състезателно програмиране, състезания курсове и уроци по програмиране , книги – безплатно от Наков курс мобилни приложения с iPhone, Android, WP7, PhoneGap уроци по уеб дизайн, HTML, CSS, JavaScript, Photoshop Дончо Минков - сайт за програмиране free C# book, безплатна книга C#, книга Java, книга C# Николай Костов - блог за програмиране безплатен курс "Качествен програмен код" безплатен курс "Разработка на софтуер в cloud среда" C# курс, програмиране, безплатно
  • 40. Free Trainings @ Telerik Academy  Telerik Software Academy  academy.telerik.com  Telerik Academy @ Facebook  facebook.com/TelerikAcademy  Telerik Software Academy Forums  forums.academy.telerik.com