Handbook Examples: Documentation


Any good theme has some documentation. A video tutorial on how to setup some basic options, a specific page on how to use hooks inside of the theme. How to make child theme or even a simple how to install the theme. These are examples of documentation. Let’s keep this going by leaving a comment below on some documentation examples.

I’ll start it off:

Action hook

/*
 * Fires before the opening #page tag
 */
function theme_before_page(){
    do_action( 'theme_before_page' );
}

Filter hook

/*
 * Returns a specified width for the slider
 * 
 * Usage:
 * add_filter( 'theme_slider_width', 'my_callback' );
 * function my_callback(){
 *     return 755;
 * }
 */
$width = intval( apply_filters( 'theme_slider_width', 600 ) );