setup.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. define( 'VAMTAM_CUSTOMIZER_LIB_PATH', plugin_dir_path( __FILE__ ) . 'lib/' );
  3. define( 'VAMTAM_CUSTOMIZER_LIB_URL', VAMTAM_URI . 'customizer/lib/' );
  4. $opt_name = apply_filters( 'vamtam_theme/opt_name', 'vamtam_theme' );
  5. include VAMTAM_CUSTOMIZER_LIB_PATH . 'class-vamtam-customizer.php';
  6. $GLOBALS['vamtam_theme_customizer'] = new Vamtam_Customizer( array(
  7. 'opt_name' => $opt_name,
  8. ) );
  9. require_once VAMTAM_DIR . 'customizer/compiler.php';
  10. require_once VAMTAM_DIR . 'customizer/option-filters.php';
  11. // load the option definitions
  12. $sections = array(
  13. 'core',
  14. 'general',
  15. 'top-level',
  16. );
  17. foreach ( $sections as $section ) {
  18. include VAMTAM_OPTIONS . "$section/section.php";
  19. }
  20. function vamtam_custom_css_options() {
  21. // extract compiler options from option definitions
  22. $type_map = array();
  23. $options = $GLOBALS['vamtam_theme_customizer']->get_fields_by_id();
  24. foreach ( $options as $opt ) {
  25. if ( isset( $opt['compiler'] ) && $opt['compiler'] ) {
  26. $type_map[ 'vamtam_theme[' . $opt['id'] . ']' ] = $opt['type'];
  27. }
  28. }
  29. return $type_map;
  30. }
  31. function vamtam_option_types_used() {
  32. $options = $GLOBALS['vamtam_theme_customizer']->get_fields_by_id();
  33. $types = array();
  34. foreach ( $options as $opt ) {
  35. $types[] = $opt['type'];
  36. }
  37. sort( $types );
  38. return array_unique( $types );
  39. }