Skip to content

Functions.php is starting to get cluttered #2

@mike-source

Description

@mike-source

I want functions.php itself to still be somewhere junior devs can copy/paste functions from google and have them work the way they're expecting. But I also want to separate out all of the reusable parts into a more logical structure.

So file structure would be: functions.php, in the root, and then a /functions/ directory, with files in that can be included.

e.g. functions.php:

    <?php

    include_once 'functions/theme-config.php';      // setup theme, thumbnail sizes, register nav menus, widgets etc.
    include_once 'functions/stylesheets.php';       // attach CSS
    include_once 'functions/js.php';                // attach JS
    include_once 'functions/shortcodes.php';        // theme specific shortcodes
    include_once 'functions/login.php';             // override login styling
    include_once 'functions/google-analytics.php';

    // Misc theme functions can be added after here:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions