Skip to content

ThemeFuse/Theme-Includes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages