- VirtualBox - Virtualization software for running local operating systems within your computer. This allows us have a full version of linux within our computers that better match how a live webserver works.
- Vagrant - A tool for provisioning (creating) virtual machines.
- VVV - A pre-built, community-supported Vagrant configuration for WordPress development.
- Git - Version control system for managing code during development. Easily allows for tracking changes, and merging new code into an existing project.
- SourceTree - A GUI available on Windows and Mac for managing Git projects. This makes Git much easier to use, as we won't have to learn the command line interface.
- Github.com - A website that provides free Git repositories for both open source and private projects.
- SASS - (SCSS) A CSS preprocessing implementation that allows us to write much less CSS for a project. This basically makes CSS into a simple programming language.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Class Simple_Json_Api | |
*/ | |
class Simple_Json_Api { | |
/** | |
* The top level argument for the endpoint. | |
* ex http://example.com/myjson/post/1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'wp_kses_allowed_html', array( $this, 'my_kses_allowed_html_hook' ), 20, 2 ); | |
function my_kses_allowed_html_hook( $tags, $context = null ){ | |
if ( 'post' == $context && ! isset( $tags['img'] ) ) { | |
$tags['img'] = array( | |
'src' => 1, | |
'height' => 1, | |
'width' => 1, | |
'alt' => 1, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// pick a hook from the wp-login.php file that best our needs. I chose the filter: wp_login_errors | |
add_filter( 'wp_login_errors', 'my_login_form_lock_down', 90, 2 ); | |
/** | |
* Completely lock down the WordPress login form by hijacking the page | |
* and only executing the the login header, footer, and necessary | |
* closing tags. | |
* | |
* Provide a secret way to show the login form as a url variable in |
This is purely for example and educational purposes.
The resulting contact form you will create with this example is extremely insecure. Do not use it on a live website.
- Create
website
directory on Desktop - Open terminal and test PHP
php --version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Simple PHP Templating function | |
* | |
* @param $names - string|array Template names | |
* @param $args - Associative array of variables to pass to the template file. | |
* @return string - Output of the template file. Likely HTML. | |
*/ | |
function template( $names, $args ){ | |
// allow for single file names |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get a WP_Post object by its slug ( post_name ) | |
* | |
* @param $post_name | |
* | |
* @return WP_Post|null | |
*/ | |
function get_post_by_slug( $post_name ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Class Template - a very simple PHP class for rendering PHP templates | |
*/ | |
class Template { | |
/** | |
* Location of expected template | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule mod_rewrite.c> | |
# enable rewriting | |
RewriteEngine on | |
# don't rewrite files that exist in the file system | |
RewriteCond %{REQUEST_FILENAME} !-f | |
# don't rewrite directories that exist in the file system | |
RewriteCond %{REQUEST_FILENAME} !-d |