making static sites dynamic (with wordpress yo!)

52
Making static sites dynamic (with WordPress yo!) Anthony Montalbano • 05.31.2017

Upload: anthony-montalbano

Post on 21-Jan-2018

87 views

Category:

Technology


6 download

TRANSCRIPT

Page 1: Making static sites dynamic (with WordPress yo!)

Making static sites dynamic (with WordPress yo!)

Anthony Montalbano • 05.31.2017

Page 2: Making static sites dynamic (with WordPress yo!)

Anthony Montalbano

Stuff I did

● Cofounded AMBR Detroit

● WordPress dev for 10 years

● Sold millions of pizza on the internet

Stuff to contact me

● @italianst4

[email protected]

Page 3: Making static sites dynamic (with WordPress yo!)
Page 4: Making static sites dynamic (with WordPress yo!)

How WordPress does template files

Headers, footers & menus (oh my!)

Scripts and styles (the right way)

The Loop

Template Parts

Overview

Page 5: Making static sites dynamic (with WordPress yo!)

How WordPress does template files

Page 6: Making static sites dynamic (with WordPress yo!)

(some folder where WordPress is installed)

● /wp-content/

○ /themes/

■ /some_theme_name/

Contents of a WordPress theme

Page 7: Making static sites dynamic (with WordPress yo!)

/wp-content/themes/some_theme_name/

● style.css

Contents of a WordPress theme

Page 8: Making static sites dynamic (with WordPress yo!)

/*

Theme Name: Custom Theme Name

Theme URI: https://ambrdetroit.com

Description: A custom theme for AMBR

Version: 1.0.0

Author: AMBR Detroit

Author URI: http://ambrdetroit.com

License: GNU General Public License v2 or later

License URI: http://www.gnu.org/licenses/gpl-2.0.html

Text Domain: ambrdetroit

*/

Inside the style.css

Page 9: Making static sites dynamic (with WordPress yo!)

Oh hey, you got a new theme!

Page 10: Making static sites dynamic (with WordPress yo!)

Oh hey, you got a new theme!

Include a screenshot.png in your theme folder.(1200 x 900)

Page 11: Making static sites dynamic (with WordPress yo!)

/wp-content/themes/some_theme_name/

● style.css

● screenshot.png

Contents of a WordPress theme

Page 12: Making static sites dynamic (with WordPress yo!)

WordPress Template Hierarchy

Page 13: Making static sites dynamic (with WordPress yo!)

/wp-content/themes/some_theme_name/

● style.css *

● screenshot.png

● index.php *

Contents of a WordPress theme

Page 14: Making static sites dynamic (with WordPress yo!)

Inside the index.php

Page 15: Making static sites dynamic (with WordPress yo!)

Headers, footers and menus (oh my!)

Page 16: Making static sites dynamic (with WordPress yo!)

/wp-content/themes/some_theme_name/

● style.css *

● screenshot.png

● index.php *

● header.php

Contents of a WordPress theme

Page 17: Making static sites dynamic (with WordPress yo!)

Inside the index.php

Page 18: Making static sites dynamic (with WordPress yo!)

Inside the header.php

Page 19: Making static sites dynamic (with WordPress yo!)

Inside the index.php (with header)

Page 20: Making static sites dynamic (with WordPress yo!)

/wp-content/themes/some_theme_name/

● style.css *

● screenshot.png

● index.php *

● header.php

● footer.php

Contents of a WordPress theme

Page 21: Making static sites dynamic (with WordPress yo!)

Inside the index.php

Page 22: Making static sites dynamic (with WordPress yo!)

Inside the footer.php

Page 23: Making static sites dynamic (with WordPress yo!)

Inside the index.php (with header and footer)

Page 24: Making static sites dynamic (with WordPress yo!)

Loads: header-homepage.php

Loads: footer-about.php

Protip: Headers and Footers

Page 25: Making static sites dynamic (with WordPress yo!)

/wp-content/themes/some_theme_name/

● style.css *

● screenshot.png

● index.php *

● header.php

● footer.php

● functions.php

Contents of a WordPress theme

Page 26: Making static sites dynamic (with WordPress yo!)

Inside the functions.php

Page 27: Making static sites dynamic (with WordPress yo!)

Inside the header.php

Page 28: Making static sites dynamic (with WordPress yo!)

Inside the header.php (with menu)

Page 29: Making static sites dynamic (with WordPress yo!)

Inside the footer.php

Page 30: Making static sites dynamic (with WordPress yo!)

Inside the footer.php (with menu)

Page 31: Making static sites dynamic (with WordPress yo!)

Managing your menus from wp-admin

Page 32: Making static sites dynamic (with WordPress yo!)

Scripts and styles (the right way)

Page 33: Making static sites dynamic (with WordPress yo!)

Inside the index.php

Page 34: Making static sites dynamic (with WordPress yo!)

Inside the index.php (assets)

Page 35: Making static sites dynamic (with WordPress yo!)

Inside the functions.php

Page 36: Making static sites dynamic (with WordPress yo!)

Inside the functions.php

More included scripts with WordPress: https://developer.wordpress.org/reference/functions/wp_enqueue_script/

Page 37: Making static sites dynamic (with WordPress yo!)

Inside the functions.php (load in footer)

Page 38: Making static sites dynamic (with WordPress yo!)

Inside the functions.php (localized vars)

Page 39: Making static sites dynamic (with WordPress yo!)

Inside the functions.php (template conditionals)

Page 40: Making static sites dynamic (with WordPress yo!)

The Loop

Page 41: Making static sites dynamic (with WordPress yo!)

Inside the index.php

Page 42: Making static sites dynamic (with WordPress yo!)

Inside the index.php (with the loop)

Page 43: Making static sites dynamic (with WordPress yo!)

Inside the index.php (with the loop)

Page 44: Making static sites dynamic (with WordPress yo!)
Page 45: Making static sites dynamic (with WordPress yo!)

Template Parts

Page 46: Making static sites dynamic (with WordPress yo!)

Inside the index.php (with the loop)

Page 47: Making static sites dynamic (with WordPress yo!)

/wp-content/themes/some_theme_name/

● style.css *

● screenshot.png

● index.php *

● header.php

● footer.php

● functions.php

● /template-parts

○ callout-primary.php

Contents of a WordPress theme

Page 48: Making static sites dynamic (with WordPress yo!)

Inside the callout-primary.php

Page 49: Making static sites dynamic (with WordPress yo!)

Inside the index.php

Page 50: Making static sites dynamic (with WordPress yo!)
Page 51: Making static sites dynamic (with WordPress yo!)

/wp-content/themes/some_theme_name/

● style.css *

● screenshot.png

● index.php *

● header.php

● footer.php

● functions.php

● /template-parts

○ callout-primary.php

Contents of a WordPress theme

Page 52: Making static sites dynamic (with WordPress yo!)

Merci!

Questions?

Me again:

@italianst4

ambrdetroit.com