PSEC: Code File Organization

PSEC: Code File Organization

SUMMARY: Setting up a file structure for the code project for different main files and their included subfiles.

So how do I load jQuery and jQueryUI? It’s as easy as just using the wp_enqueue_script() call. In fact, WordPress already has quite a bundle of scripts already included.

I started to structure the code to look something like this in the theme file:

theme folder/
    functions.php
    code/
        admin/
            admin.php
        classes/
            app.php
        main.php

I’m using functions.php to either include admin.php or main.php, depending on whether we’re in the admin page or not. That’s all it does, other than declare a global $dsApp variable that will hold my Application class instance.

In main.php, I have a dseah_main() to serve as my entry point, which loads necessary files at the top. In my test case, it’s loading a skeleton application class.

I may implement a number of shortcodes for various test cases.

0 Comments