Browse Source

theme init

windhamdavid 5 months ago
parent
commit
129bcf3558
5 changed files with 499 additions and 0 deletions
  1. 2 0
      README.md
  2. 99 0
      functions.php
  3. 24 0
      package.json
  4. 0 0
      style-editor.css
  5. 374 0
      theme.json

+ 2 - 0
README.md

@@ -28,3 +28,5 @@ Thanks:
 - 24/06/27 - Init
 - 24/06/27 - Init
 
 
 ### Notes
 ### Notes
+
+- Migrate old content from Drupal site

+ 99 - 0
functions.php

@@ -0,0 +1,99 @@
+<?php
+
+/***********************************************************
+######################### Admin ############################
+************************************************************/
+
+add_filter( 'show_admin_bar', '__return_false' );
+
+add_action( 'admin_head-profile.php', 'lps24_remove_admin_color' );
+function lps24_remove_admin_color() {
+    remove_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );
+}
+
+add_action( 'admin_bar_menu', 'lps24_remove_adminbar', 999 );
+function lps24_remove_adminbar( $wp_admin_bar ) {
+	$wp_admin_bar->remove_node('wp-logo');
+  $wp_admin_bar->remove_node('updates');
+  $wp_admin_bar->remove_menu('comments');
+  $wp_admin_bar->remove_menu('customize');
+  $wp_admin_bar->remove_menu('new-content');
+	$wp_admin_bar->remove_menu('edit');
+	$wp_admin_bar->remove_menu('new-user');
+	$wp_admin_bar->remove_menu('new-post');
+	$wp_admin_bar->remove_menu('new-page');
+	$wp_admin_bar->remove_node('new-media');
+  $wp_admin_bar->remove_node('view-site');
+}
+
+add_action( 'wp_dashboard_setup', 'lps24_disable_dashboard_items' );
+function lps24_disable_dashboard_items() {
+  remove_action('admin_notices', 'update_nag');
+	remove_action('welcome_panel', 'wp_welcome_panel');
+	remove_meta_box('dashboard_primary', 'dashboard', 'side');
+	remove_meta_box('dashboard_secondary', 'dashboard', 'side');
+	remove_meta_box('dashboard_quick_press', 'dashboard', 'side');
+	remove_meta_box('dashboard_site_health', 'dashboard', 'normal');
+	
+}
+
+/***********************************************************
+####################### Comments ###########################
+************************************************************/
+
+add_action('admin_menu', function () {
+	remove_menu_page('edit-comments.php');
+});
+
+add_filter('comments_open', '__return_false', 20, 2);
+add_filter('pings_open', '__return_false', 20, 2);
+
+add_action('admin_init','lps24_disable_comments');
+function lps24_disable_comments() {
+	$post_types = get_post_types();
+	foreach ($post_types as $post_type) {
+			if(post_type_supports($post_type,'comments')) {
+					remove_post_type_support($post_type,'comments');
+					remove_post_type_support($post_type,'trackbacks');
+			}
+	}
+}
+
+/***********************************************************
+###################### Last Login ##########################
+************************************************************/
+
+add_action( 'wp_login', 'lps24_login_timestamp', 20, 2 );
+function lps24_login_timestamp( $user_login, $user ) {
+  update_user_meta( $user->ID, 'last_login', time() );
+}
+add_filter( 'manage_users_columns', 'lps24_user_last_login_column' );
+function lps24_user_last_login_column( $columns ) {
+  $columns['last_login'] = 'Last Login'; // column ID / column Title
+  return $columns;
+}
+add_filter( 'manage_users_custom_column', 'lps24_last_login_column', 10, 3 );
+function lps24_last_login_column( $output, $column_id, $user_id ){
+	if( $column_id == 'last_login' ) {
+    $last_login = get_user_meta( $user_id, 'last_login', true );
+    $date_format = 'j M, Y';
+    $output = $last_login ? date( $date_format, $last_login ) : '-';
+	}
+	return $output;
+}
+add_filter( 'manage_users_sortable_columns', 'lps24_sortable_columns' );
+function lps24_sortable_columns( $columns ) {
+	return wp_parse_args( array(
+	 	'last_login' => 'last_login'
+	), $columns );
+}
+add_action( 'pre_get_users', 'lps24_sort_last_login_column' );
+function lps24_sort_last_login_column( $query ) {
+	if( !is_admin() ) { return; }
+  $orderby = $query->get('orderby');
+	if( 'last_login' == $orderby ) {
+    $query->set('meta_key','last_login');
+    $query->set('orderby','meta_value');
+	}
+	return $query;
+}

+ 24 - 0
package.json

@@ -0,0 +1,24 @@
+{
+  "name": "lps",
+  "private": true,
+  "version": "0.0.1",
+  "description": "lps",
+  "main": "index.js",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1"
+  },
+  "repository": {
+    "type": "git",
+    "url": "git+https://github.com/windhamdavid/lps.git"
+  },
+  "author": "windhamdavid",
+  "license": "MIT",
+  "bugs": {
+    "url": "https://github.com/windhamdavid/lps/issues"
+  },
+  "homepage": "https://github.com/windhamdavid/lps#readme",
+  "devDependencies": {
+    "browser-sync": "^3.0.2",
+    "gulp": "^5.0.0"
+  }
+}

+ 0 - 0
style-editor.css


+ 374 - 0
theme.json

@@ -0,0 +1,374 @@
+{
+	"version": 2,
+	"$schema": "https://schemas.wp.org/trunk/theme.json",
+	"settings": {
+		"appearanceTools": true,
+		"useRootPaddingAwareAlignments": true,
+		"layout": {
+			"contentSize": "960px",
+			"wideSize": "1140px"
+		},
+		"spacing": {
+			"units": [ "px", "em", "rem", "vh", "vw", "%" ]
+		},
+		"color": {
+			"custom": false,
+			"defaultPalette": false,
+			"palette": [
+				{
+					"slug": "base",
+					"color": "#FFFFFF",
+					"name": "Base"
+				},
+        {
+					"slug": "black",
+					"color": "#000000",
+					"name": "Base"
+				},
+				{
+					"slug": "contrast",
+					"color": "#5D6168",
+					"name": "Contrast"
+				},
+				{
+					"slug": "contrast-light",
+					"color": "#F0F0F0",
+					"name": "Contrast Light"
+				},
+				{
+					"slug": "primary",
+					"color": "#009C9F",
+					"name": "Primary"
+				},
+				{
+					"slug": "primary-light",
+					"color": "#e5f6f7",
+					"name": "Primary Light"
+				},
+				{
+					"slug": "secondary",
+					"color": "#19458C",
+					"name": "Secondary"
+				},
+				{
+					"slug": "secondary-dark",
+					"color": "#0F1B44",
+					"name": "Secondary Dark"
+				},
+				{
+					"slug": "highlight",
+					"color": "#faa819",
+					"name": "Highlight"
+				},
+				{
+					"slug": "transparent",
+					"color": "transparent",
+					"name": "Transparent"
+				}
+			],
+			"customGradient": false,
+			"defaultGradients": false,
+			"gradients": [
+        {
+					"slug": "primary-secondary",
+					"gradient": "linear-gradient(to right, #009C9F 0%, #19458C 100%)",
+					"name": "Primary Secondary"
+				}
+			],
+			"customDuotone": false,
+			"defaultDuotone": false,
+			"duotone": [
+				{
+					"colors": [ "#19458C", "#FFFFFF"],
+					"slug": "secondary-light",
+					"name": "Secondary"
+				},
+				{
+					"colors": ["#009C9F", "#FFFFFF"],
+					"slug": "primary-light",
+					"name": "Primary Light"
+				},
+				{
+					"colors": ["#009C9F", "#19458C"],
+					"slug": "primary-secondary",
+					"name": "Primary Secondary"
+				},
+				{
+					"colors": ["#e5f6f7", "#FFFFFF"],
+					"slug": "primary-light-light",
+					"name": "Primary Light Light"
+				}
+			]
+		},
+		"typography": {
+			"dropCap": true,
+			"fluid": true,
+			"fontFamilies": [
+				{
+					"name": "System",
+					"slug": "system",
+					"fontFamily": "-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Oxygen-Sans,Ubuntu,Cantarell,\"Helvetica Neue\",sans-serif"
+				},
+				{
+					"name": "Serif",
+					"slug": "serif",
+					"fontFamily": "\"Times New Roman\",\"New York\",Times,\"Noto Serif\",serif"
+				},
+				{
+					"name": "Monospace",
+					"slug": "monospace",
+					"fontFamily": "Consolas,Menlo,Monaco,\"SF Mono\",\"DejaVu Sans Mono\",\"Roboto Mono\",\"Courier New\",Courier,monospace"
+				}
+			],
+			"fontSizes": [
+				{
+					"slug": "small",
+					"size": "0.9rem",
+					"name": "Small",
+					"fluid": false
+				},
+				{
+					"slug": "medium",
+					"size": "1.2rem",
+					"name": "Medium",
+					"fluid": false
+				},
+				{
+					"slug": "large",
+					"size": "1.6rem",
+					"name": "Large",
+					"fluid": {
+						"min": "1.75rem",
+						"max": "2rem"
+					}
+				},
+				{
+					"slug": "x-large",
+					"size": "2.5rem",
+					"name": "XL",
+					"fluid": {
+						"min": "2rem",
+						"max": "2.75rem"
+					}
+				},
+				{
+					"slug": "xx-large",
+					"size": "3rem",
+					"name": "XXL",
+					"fluid": {
+						"min": "3rem",
+						"max": "3.75rem"
+					}
+				}
+			]
+		}
+	},
+	"styles": {
+		"blocks": {
+			"core/code": {
+				"color": {
+					"text": "var(--wp--preset--color--contrast)"
+				}
+			},
+			"core/navigation": {
+				"css": "& .wp-block-site-title{ margin:0; font-weight:400;}",
+				"elements": {
+					"link": {
+						"color": {
+							"text": "var(--wp--preset--color--contrast)"
+						},
+						"typography": {
+							"textDecoration": "none",
+							"fontWeight": "500"
+						},
+						":hover": {
+							"color": {
+								"text": "var(--wp--preset--color--contrast)"
+							},
+							"typography": {
+								"textDecoration": "none"
+							}
+						},
+						":focus": {
+							"color": {
+								"text": "var(--wp--preset--color--contrast)"
+							}
+						},
+						":active": {
+							"color": {
+								"text": "var(--wp--preset--color--contrast)"
+							}
+						}
+					}
+				}
+			},
+			"core/post-author-name": {
+				"typography": {
+					"fontSize": "var(--wp--preset--font-size--small)"
+				}
+			},
+			"core/post-content": {
+				"spacing": {
+					"margin": {
+						"top": "var(--wp--preset--spacing--60)",
+						"bottom": "var(--wp--preset--spacing--60)"
+					}
+				}
+			},
+			"core/post-date": {
+				"typography": {
+					"fontSize": "var(--wp--preset--font-size--small)"
+				}
+			},
+			"core/post-excerpt": {
+				"elements": {
+					"link": {
+						"typography": {
+							"fontSize": "var(--wp--preset--font-size--small)"
+						}
+					}
+				}
+			},
+			"core/post-featured-image": {
+				"spacing": {
+					"margin": {
+						"bottom": "var(--wp--preset--spacing--40)"
+					}
+				}
+			},
+			"core/post-template": {
+				"spacing": {
+					"padding": {
+						"top": "var(--wp--preset--spacing--50)",
+						"bottom": "var(--wp--preset--spacing--50)"
+					}
+				}
+			},
+			"core/post-terms": {
+				"typography": {
+					"fontSize": "var(--wp--preset--font-size--small)"
+				}
+			},
+			"core/query-pagination": {
+				"spacing": {
+					"padding": {
+						"top": "var(--wp--preset--spacing--50)"
+					}
+				}
+			},
+			"core/search": {
+				"css": ".wp-block-search__button-inside .wp-block-search__inside-wrapper{border: none;}",
+				"typography": {
+					"lineHeight": "1"
+				}
+			}
+		},
+		"color": {
+			"background": "var(--wp--preset--color--base)",
+			"text": "var(--wp--preset--color--contrast)"
+		},
+		"elements": {
+			"button": {
+				"spacing": {
+					"padding": {
+						"top": "var(--wp--preset--spacing--20)",
+						"right": "var(--wp--preset--spacing--20)",
+						"bottom": "var(--wp--preset--spacing--20)",
+						"left": "var(--wp--preset--spacing--20)"
+					}
+				},
+				"border": {
+					"color": "var(--wp--preset--color--transparent)",
+					"width": "4px",
+					"style": "solid",
+					"radius": "4px"
+				},
+				"color": {
+					"background": "var(--wp--preset--color--primary)",
+					"text": "var(--wp--preset--color--base)"
+				},
+				"typography": {
+					"fontSize": "var(--wp--preset--font-size--small)",
+					"fontWeight": "700"
+				},
+				"shadow": "var(--wp--preset--shadow--natural)",
+				":hover": {
+					"border": {
+						"color": "var(--wp--preset--color--secondary)"
+					}
+				}
+			},
+			"caption": {
+				"color": {
+					"text": "var(--wp--preset--color--secondary)"
+				}
+			},
+			"cite": {
+				"color": {
+					"text": "var(--wp--preset--color--secondary)"
+				}
+			},
+			"link": {
+				"color": {
+					"text": "var(--wp--preset--color--secondary)"
+				},
+				"typography": {
+					"textDecoration": "none"
+				},
+				":hover": {
+					"color": {
+						"text": "var(--wp--preset--color--primary)"
+					},
+					"typography": {
+						"textDecoration": "none"
+					}
+				},
+				":focus": {
+					"color": {
+						"text": "var(--wp--preset--color--secondary)"
+					}
+				},
+				":active": {
+					"color": {
+						"text": "var(--wp--preset--color--contrast)"
+					}
+				}
+			}
+		},
+		"spacing": {
+			"padding": {
+				"right": "var(--wp--preset--spacing--50)",
+				"left": "var(--wp--preset--spacing--50)"
+			}
+		},
+		"typography": {
+			"fontSize": "var(--wp--preset--font-size--medium)",
+			"fontFamily": "var(--wp--preset--font-family--system)",
+			"lineHeight": "1.7"
+		}
+	},
+	"templateParts": [
+		{
+			"name": "header",
+			"title": "Header",
+			"area": "header"
+		},
+		{
+			"name": "footer",
+			"title": "Footer",
+			"area": "footer"
+		}
+	],
+	"customTemplates": [
+		{
+			"name": "no-title",
+			"title": "No title",
+			"postTypes": [ "post","page" ]
+		},
+		{
+			"name": "no-title-no-padding",
+			"title": "No title No Padding",
+			"postTypes": [ "post","page" ]
+		}
+	]
+}