functions.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /***********************************************************
  3. ###################### BrowserSync #########################
  4. ************************************************************/
  5. function add_cors_http_header(){
  6. header('Access-Control-Allow-Origin: https://fuf.ovid:333');
  7. header('Access-Control-Allow-Credentials: true');
  8. header('Access-Control-Allow-Headers: X-WP-Nonce', false );
  9. }
  10. add_action('init','add_cors_http_header');
  11. function fuf24_browsersync_save() {
  12. $args = [
  13. 'blocking' => false,
  14. 'sslverify' => false
  15. ];
  16. $request = wp_remote_get('https://fuf.ovid:333/__browser_sync__?method=reload', $args);
  17. }
  18. add_action('rest_after_insert_page', 'fuf24_browsersync_save', 10, 3);
  19. add_action('rest_after_insert_post', 'fuf24_browsersync_save', 10, 3);
  20. add_action('save_post', 'fuf24_browsersync_save', 10, 3);
  21. add_action('customize_save_after', 'fuf24_browsersync_save', 10, 3);
  22. add_action('wp_update_nav_menu', 'fuf24_browsersync_save', 10, 3);
  23. add_action('updated_option', 'fuf24_browsersync_save', 10, 3);
  24. /***********************************************************
  25. ######################### Admin ############################
  26. ************************************************************/
  27. add_filter( 'show_admin_bar', '__return_false' );
  28. function fuf24_enqueue_styles() {
  29. wp_enqueue_style( 'fuf', get_stylesheet_uri() );
  30. }
  31. add_action( 'wp_enqueue_scripts', 'fuf24_enqueue_styles' );