Modular theme settings

If a user can not change them then they are not options, they are constants. Declare them using const in your maim theme file (probably functions.php but any other files that is being always loaded will do), and use them wherever you have use the “options” array now.

If you want to control it without editing you theme files, you can use a conditional define instead (check if value is not defined yet and if not define it). That way you will be able to override the default values by defining them at the wp-config.php file per site.

… But this all question sounds wrong. The DB is there, so just use it, and a basic UI to control the options is easy to come up with. There is no real reason to resort to code changes every time you want to active/deactivate a module.

Leave a Comment