Common Code in Functions File
This common code should be the first items in a themes functions file (master theme or custom theme, child themes do not need this code)
- All themes function files should have a line adding theme support for dc-theme; this will enable them customization features such as themes, fonts, logos, etc.
add_theme_support( ‘dc-theme’ );
- Any global variables needs for theme functionality should be included before the next line. This includes the variables:
- $GLOBALS[‘fonts’] – an array that contains font options and font label -> css value pairs
- $GLOBALS[‘palettes’] – an array that contains color palettes and in the individual colors of each palette
- All theme functions file have a call to the global functions file in /themes/dc-global/
include (get_theme_root() . ‘/dc-global/dc-functions.php’);
- Set content width of main content; this is useful mainly for determining the base size for images uploaded to interior pages.
$content_width = 600;
Using add_action to insert functionality
Use add_action wp function in order to insert in template, example: add_action(‘insert_social’);
- insert_copyright: inserts HTML with copyright info, wp login, and dc logo
- insert_mpform: functionality for including mp form iframe into main content
- insert_social: ul.social list that checks for social link fields and displays accordingly