Skip to content
- 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