not the wordpress way

19
Whoops Not the WordPress Way Ways to get your site back to WordPress standards Dustin Hartzler Happiness Engineer at Automattic WordCamp Ann Arbor 2017

Upload: dustin-hartzler

Post on 23-Jan-2018

84 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Not the WordPress Way

WhoopsNot the WordPress WayWays to get your site back to WordPress standards

Dustin HartzlerHappiness Engineer at AutomatticWordCamp Ann Arbor 2017

Page 2: Not the WordPress Way

YourWebsiteEngineer.com/a2

WordCamp Ann Arbor 2017

Page 3: Not the WordPress Way

Not the WordPress Way:1. Added functions to functions.php file

2. Edited Theme files to make a modification

3. Modified Core or a WordPress Plugin

WordCamp Ann Arbor 2017

Page 4: Not the WordPress Way

Not WordPress Way:Added to functions.php

add_filter('the_content', 'my_slide_title');function my_slide_title($content){ return str_replace('<p>', '<p style="color: orange; font-family:Comic Sans MS, Comic Sans, cursive;" font-size:200%>',$content); }

add_filter('the_title', 'all_character_title_lowercase');

function all_character_title_lowercase($title){ return strtolower($title); }

WordCamp Ann Arbor 2017

Page 5: Not the WordPress Way

Current Theme - TwentySixteen

WordCamp Ann Arbor 2017

Page 6: Not the WordPress Way

New Theme - TwentySeventeen

WordCamp Ann Arbor 2017

Page 7: Not the WordPress Way

:sadbot:WordCamp Ann Arbor 2017

Page 8: Not the WordPress Way

WordPress Way:Add to custom plugin

/*Plugin Name: Custom FunctionalityDescription: Drop in all "functions.php" code hereVersion: 1.0Plugin URI: http://yourwebsiteengineer.comAuthor: Dustin Hartzler*/

WordCamp Ann Arbor 2017

Page 9: Not the WordPress Way

New Theme - TwentySeventeen

WordCamp Ann Arbor 2017

Page 10: Not the WordPress Way

:happybot:WordCamp Ann Arbor 2017

Page 11: Not the WordPress Way

Not WordPress Way:Edited theme files

- Removed unnecessary code from templates- Modified code to work better- Added hardcoded sidebar content

WordCamp Ann Arbor 2017

Page 12: Not the WordPress Way

:sadbot:WordCamp Ann Arbor 2017

Page 13: Not the WordPress Way

WordPress Way:Create a Child Theme

- Duplicate theme files to edit- Your changes will never be overwritten- Themes can easily be updated

WordCamp Ann Arbor 2017

Page 14: Not the WordPress Way

:happybot:WordCamp Ann Arbor 2017

Page 15: Not the WordPress Way

Not WordPress Way:Core or Plugin Modification

- Modified code from the repository- Security plugins will flag your site- WordPress / plugin will be more vulnerable

WordCamp Ann Arbor 2017

Page 16: Not the WordPress Way

:sadbot:WordCamp Ann Arbor 2017

Page 17: Not the WordPress Way

WordPress Way:Core or Plugin Modification

- Do not modify publicly available code- Always keep your software updated- Ask the developer for a hook to be able to make modifications

WordCamp Ann Arbor 2017

Page 18: Not the WordPress Way

:happybot:WordCamp Ann Arbor 2017

Page 19: Not the WordPress Way

?Any questions?WordCamp Ann Arbor 2017