Browse Source

browser-sync ♻️

windhamdavid 5 months ago
parent
commit
92b6ed13d1
2 changed files with 36 additions and 5 deletions
  1. 25 0
      functions.php
  2. 11 5
      patterns/procedure-options.php

+ 25 - 0
functions.php

@@ -7,6 +7,31 @@ add_action( 'wp_enqueue_scripts', 'lps24_enqueue_assets' );
 
 remove_theme_support( 'core-block-patterns' );
 
+/***********************************************************
+###################### BrowserSync #########################
+************************************************************/
+
+function add_cors_http_header(){
+	header('Access-Control-Allow-Origin: https://lps.ovid:333');
+	header('Access-Control-Allow-Credentials: true');
+	header('Access-Control-Allow-Headers: X-WP-Nonce', false );
+}
+add_action('init','add_cors_http_header');
+
+function lps24_browsersync_save() {
+  $args = [
+    'blocking' => false,
+    'sslverify' => false
+  ];
+  $request = wp_remote_get('https://gwp.ovid:333/__browser_sync__?method=reload', $args);
+}
+add_action('rest_after_insert_page', 'lps24_browsersync_save', 10, 3);
+add_action('rest_after_insert_post', 'lps24_browsersync_save', 10, 3);
+add_action('save_post', 'lps24_browsersync_save', 10, 3);
+add_action('customize_save_after', 'lps24_browsersync_save', 10, 3);
+add_action('wp_update_nav_menu', 'lps24_browsersync_save', 10, 3);
+add_action('updated_option', 'lps24_browsersync_save', 10, 3);
+
 /***********************************************************
 ######################### Admin ############################
 ************************************************************/

+ 11 - 5
patterns/procedure-options.php

@@ -9,16 +9,22 @@
 
 <!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"var:preset|spacing|30","bottom":"var:preset|spacing|30"}}},"backgroundColor":"contrast-light","layout":{"type":"constrained"}} -->
 <div class="wp-block-group alignfull has-contrast-light-background-color has-background" style="padding-top:var(--wp--preset--spacing--30);padding-bottom:var(--wp--preset--spacing--30)"><!-- wp:columns -->
-  <div class="wp-block-columns"><!-- wp:column -->
-  <div class="wp-block-column"><!-- wp:group {"style":{"spacing":{"padding":{"top":"var:preset|spacing|30","bottom":"var:preset|spacing|30","left":"var:preset|spacing|30","right":"var:preset|spacing|30"}}},"backgroundColor":"base","layout":{"type":"constrained"}} -->
-  <div class="wp-block-group has-base-background-color has-background" style="padding-top:var(--wp--preset--spacing--30);padding-right:var(--wp--preset--spacing--30);padding-bottom:var(--wp--preset--spacing--30);padding-left:var(--wp--preset--spacing--30)"><!-- wp:heading {"level":3} -->
+  <div class="wp-block-columns">
+  
+  <!-- wp:column -->
+  <div class="wp-block-column">
+  <a href="/procedures/body/">
+  <!-- wp:group {"style":{"spacing":{"padding":{"top":"var:preset|spacing|30","bottom":"var:preset|spacing|30","left":"var:preset|spacing|30","right":"var:preset|spacing|30"}}},"backgroundColor":"base","layout":{"type":"constrained"}} -->
+  <div class="wp-block-group has-base-background-color has-background" style="padding-top:var(--wp--preset--spacing--30);padding-right:var(--wp--preset--spacing--30);padding-bottom:var(--wp--preset--spacing--30);padding-left:var(--wp--preset--spacing--30)">
+  <!-- wp:heading {"level":3} -->
   <h3 class="wp-block-heading">Body</h3>
   <!-- /wp:heading -->
-  
   <!-- wp:image {"id":237,"sizeSlug":"full","linkDestination":"none"} -->
   <figure class="wp-block-image size-full"><img src="<?php echo get_template_directory_uri(); ?>/img/cta-img1_0.png" alt="" class="wp-image-237"/></figure>
   <!-- /wp:image --></div>
-  <!-- /wp:group --></div>
+  <!-- /wp:group -->
+  </a>  
+  </div>
   <!-- /wp:column -->
   
   <!-- wp:column -->