Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Theme Includes

A way to organize theme files.

Directory Structure

theme/
└─inc/
  ├─static.php     # wp_enqueue_style() and wp_enqueue_script()
  ├─menus.php      # register_nav_menus()
  ├─hooks.php      # add_filter() and add_action()
  ├─helpers.php    # Helper functions and classes
  ├─widgets/       # Theme widgets
  │ ├─{widget-name}/
  │ │ ├─class-widget-{widget-name}.php # class Widget_{Widget_Name} extends WP_Widget { ... }
  │ │ ├─some-file.php
  │ │ └─some-dir/
  │ │   └─...
  │ └─...
  └─includes/      # All .php files are auto included (no need to require_once)
    ├─some-file.php
    └─...

File Descriptions

  • helpers.php, hooks.php, includes/*.php are included right away
  • static.php is included on wp_enqueue_scripts action
  • widgets/{hello-world}/class-widget-{Hello_World}.php are included on widgets_init action

Install

  1. Download the archive
  • Extract it to your theme root directory

  • Include the init.php file from your theme functions.php

     include_once get_template_directory() .'/inc/init.php';

About

A way to organize theme files and include them on right actions

Resources

Releases

No releases published

Packages

No packages published

Languages