Advertisement
Guest User

Untitled

a guest
Sep 24th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.38 KB | None | 0 0
  1. <?php
  2.  
  3. spl_autoload_register(function ($class) {
  4.  
  5.     // project-specific namespace prefix
  6.     $prefix = 'cf47\\theme\\realtyspace\\child';
  7.  
  8.     // base directory for the namespace prefix
  9.     $base_dir = __DIR__ . '/lib';
  10.  
  11.     // does the class use the namespace prefix?
  12.     $len = strlen($prefix);
  13.     if (strncmp($prefix, $class, $len) !== 0) {
  14.         // no, move to the next registered autoloader
  15.         return;
  16.     }
  17.  
  18.     // get the relative class name
  19.     $relative_class = substr($class, $len);
  20.  
  21.     // replace the namespace prefix with the base directory, replace namespace
  22.     // separators with directory separators in the relative class name, append
  23.     // with .php
  24.     $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
  25.  
  26.     // if the file exists, require it
  27.     if (file_exists($file)) {
  28.         require $file;
  29.     }
  30. });
  31.  
  32. add_action('cf47_app_callback', function (\cf47\themecore\Application $app) {
  33.     $app->register_module(new cf47\theme\realtyspace\child\Init());
  34. });
  35.  
  36. // Override secondary styles and scripts
  37. add_action('wp_enqueue_scripts', function () {
  38.     $version = filemtime(get_stylesheet_directory() . '/' . 'script.js');
  39.     wp_enqueue_script('cf47rs-script', get_stylesheet_directory_uri() . '/script.js', ['jquery'], $version);
  40. });
  41.  
  42. // Load child theme translation files
  43. add_action('after_setup_theme', function () {
  44.     load_child_theme_textdomain('realtyspace', get_stylesheet_directory() . '/languages');
  45. });
  46.  
  47. // Override main theme style
  48. add_action('wp_enqueue_scripts', function () {
  49. //     Please uncomment which you need
  50. //    wp_deregister_style('cf47rs-theme');
  51. //    wp_enqueue_style(
  52. //        'cf47rs-theme', get_stylesheet_directory_uri() . '/theme-default.css',
  53. //        [
  54. //            'cf47rs-vendors',
  55. //            'cf47rs-standartwp',
  56. //        ],
  57. //        filemtime(get_stylesheet_directory() . '/theme-default.css')
  58. //    );
  59. }, 20);
  60.  
  61. // Override secondary styles and scripts
  62. add_action('wp_enqueue_scripts', function () {
  63. //    wp_enqueue_style( 'cf47rs-standartwp', get_stylesheet_directory_uri() . '/wordpress.css' );
  64. //    wp_enqueue_style( 'cf47rs-vendors', get_stylesheet_directory_uri() . '/vendors.css' );
  65. //    wp_enqueue_script( 'cf47rs-vendors', get_stylesheet_directory_uri() . '/vendor.js' );
  66. //    wp_enqueue_script( 'cf47rs-app', get_stylesheet_directory_uri() . '/app.js' );
  67. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement