- Rachel McCollin. The Ultimate Guide to the WordPress functions.php File. wpmudev, 2016.
- David Hayes. Adding Functionality with fucntions.php, a Heart of WordPress Theme Development. wpshout, 2018.
- David Hayes. WordPress Basics: Understanding and Making the Best Use of Your functions.php File. wpshout, 2014.
- WordPress: 20 Indispensable Code Snippets for Your functions.php. noupe, 2016.
- Dee Teal. Customising WordPress Functionality with functions.php. envatotuts, 2013.
- Essentially operates like a plugin.
- Applies only to the theme it is included in.
- Is not single purpose like most plugins.
- If a child theme has a functions.php it is loaded before the parent theme’s functions.php. The latter’s functions are still utilized where functions have not been defined in the former.
- For functions use a namespace preface, e.g., my_theme_function.
- add_theme_support( ‘automatic-feed-links’ ); – Adds post and comment RSS feeds automatically.
- add_theme_support( ‘post-thumbnails’ );
- add_theme_support( ‘post-formats’, array( ‘aside’, ‘gallery’, ‘quote’, ‘image’, ‘video’ ) );
- register_nav_menus( array (
‘primary’ => __( ‘Primary Menu’, ‘myfirsttheme’ ),
‘secondary’ => __( ‘Secondary Menu’, ‘myfirsttheme’ )
- Allows for custom menus, array only necessary if theme is to support multiple menus.
- Need to add this function as an action so it actually loads:
add_action( ‘after_setup_theme’, ‘myfirsttheme_setup’ );
- load_theme_text_domain() – Used to load additional languages.
- $content_width – Determines the maximum width of any page/post.
- Functions for which WordPress includes a default that is only utilized if a function has not otherwise been created.
- See wp-includes/pluggable.php