2 Commits 23c7cfef74 ... cf5bc1458b

Author SHA1 Message Date
  windhamdavid cf5bc1458b functions admin 5 months ago
  windhamdavid 92b6ed13d1 browser-sync ♻️ 5 months ago
2 changed files with 113 additions and 8 deletions
  1. 102 2
      functions.php
  2. 11 6
      patterns/procedure-options.php

+ 102 - 2
functions.php

@@ -5,7 +5,32 @@ function lps24_enqueue_assets() {
 }
 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 ############################
@@ -33,6 +58,51 @@ function lps24_remove_adminbar( $wp_admin_bar ) {
   $wp_admin_bar->remove_node('view-site');
 }
 
+add_filter( 'custom_menu_order', 'lps24_menu_order' );
+add_filter( 'menu_order', 'lps24_menu_order' );
+function lps24_menu_order( $menu_order ) {
+  if (!$menu_order) return true;
+  return array(
+    'index.php',
+    'separator1',
+    'edit.php?post_type=page',
+    'edit.php',
+    'edit-comments.php',
+    'separator2',
+    'upload.php',
+    'theme-settings',
+    'themes.php',
+    'plugins.php',
+    'tools.php',
+		'users.php',
+    'separator-last'
+  );
+}
+
+add_action( 'admin_menu', 'lps24_remove_admin_pages', 99 );
+function lps24_remove_admin_pages() {
+  global $current_user;
+  $user_id = get_current_user_id();
+  if($user_id != '0') {
+  	remove_menu_page('plugins.php');
+    remove_menu_page('tools.php');
+    remove_menu_page('options-general.php');
+    remove_menu_page('gutenberg');
+    remove_menu_page('users.php');
+    remove_submenu_page('themes.php', 'themes-editor.php');
+    remove_submenu_page( 'themes.php', 'customize.php?return=' . urlencode($_SERVER['SCRIPT_NAME']));
+    remove_submenu_page( 'themes.php', 'themes.php' );
+    remove_submenu_page( 'themes.php', 'theme-editor.php' );
+    remove_submenu_page( 'themes.php', 'theme_options' );
+    remove_submenu_page('gf_edit_forms', 'gf_new_form');
+    remove_submenu_page('gf_edit_forms', 'gf_export');
+    remove_submenu_page('gf_edit_forms', 'gf_addons');
+    remove_submenu_page('gf_edit_forms', 'gf_settings');
+    remove_submenu_page('gf_edit_forms', 'gf_help');
+    remove_submenu_page('gf_edit_forms', 'gf_system_status');
+  }
+}
+
 add_action( 'wp_dashboard_setup', 'lps24_disable_dashboard_items' );
 function lps24_disable_dashboard_items() {
   remove_action('admin_notices', 'update_nag');
@@ -43,6 +113,11 @@ function lps24_disable_dashboard_items() {
 	remove_meta_box('dashboard_site_health', 'dashboard', 'normal');
 }
 
+add_filter('admin_title', 'lps24_admin_title', 10, 2);
+function lps24_admin_title($admin_title, $title) {
+  return $title .' - '. get_bloginfo('name');
+}
+
 add_filter ('admin_footer_text', 'lps24_footer_filter');
 function lps24_footer_filter ($default) {
   return '';
@@ -124,4 +199,29 @@ function lps24_sort_last_login_column( $query ) {
     $query->set('orderby','meta_value');
 	}
 	return $query;
-}
+}
+
+/***********************************************************
+######################## Blocks ############################
+************************************************************/
+
+function lps24_restrict_locking_ui( $settings, $context ) {
+  $settings[ 'canLockBlocks' ] = current_user_can( 'activate_plugins' );
+return $settings;
+}
+add_filter( 'block_editor_settings_all', 'lps24_restrict_locking_ui', 10, 2 );
+
+remove_theme_support( 'core-block-patterns' );
+add_filter( 'should_load_remote_block_patterns', 'lps24_disable_remote_patterns' );
+function lps24_disable_remote_patterns() {
+	return false;
+}
+
+add_filter(
+  'block_editor_settings_all',
+  function( $settings ) {
+    $settings['enableOpenverseMediaCategory'] = false;
+    return $settings;
+  },
+  10
+);

+ 11 - 6
patterns/procedure-options.php

@@ -3,22 +3,27 @@
  * Title: Procedures
  * Slug: lps/procudure-options
  * Categories: banner, featured
- * Viewport width: 1400
  */
 ?>
 
 <!-- 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 -->