Upload
dustin-hartzler
View
83
Download
1
Embed Size (px)
Citation preview
WhoopsNot the WordPress WayWays to get your site back to WordPress standards
Dustin HartzlerHappiness Engineer at AutomatticWordCamp Ann Arbor 2017
YourWebsiteEngineer.com/a2
WordCamp Ann Arbor 2017
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
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
Current Theme - TwentySixteen
WordCamp Ann Arbor 2017
New Theme - TwentySeventeen
WordCamp Ann Arbor 2017
:sadbot:WordCamp Ann Arbor 2017
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
New Theme - TwentySeventeen
WordCamp Ann Arbor 2017
:happybot:WordCamp Ann Arbor 2017
Not WordPress Way:Edited theme files
- Removed unnecessary code from templates- Modified code to work better- Added hardcoded sidebar content
WordCamp Ann Arbor 2017
:sadbot:WordCamp Ann Arbor 2017
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
:happybot:WordCamp Ann Arbor 2017
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
:sadbot:WordCamp Ann Arbor 2017
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
:happybot:WordCamp Ann Arbor 2017
?Any questions?WordCamp Ann Arbor 2017