Skip to content

Commit ce623e7

Browse files
committed
Add $PROJECT_TITLE variable and set it as the value for $WP_SITE_TITLE
1 parent 0e39bce commit ce623e7

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog for `ddev-wp-setup-script`
22

3+
## 1.3.1
4+
5+
_2024-11-24_
6+
7+
- Added the `$PROJECT_TITLE` variable.
8+
- Updated `$WP_SITE_TITLE` to use `$PROJECT_TITLE` variable.
9+
310
## 1.3.0
411

512
_2024-11-24_

config.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
# Your WP site name
4-
WP_SITE_TITLE=$PROJECT_NAME
4+
WP_SITE_TITLE=$PROJECT_TITLE
55

66
# Your WP login details
77
WP_USER_NAME='example-name'

modules/constants.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@ MODULES_DIR="${SCRIPT_DIR}/modules"
44
FILES_DIR="${SCRIPT_DIR}/files"
55
PROJECT_DIR=$(pwd)
66

7-
# Get the project name from the project directory,
8-
# minus the any leading non-alphanumeric characters and trailing `.ddev.site`, if any.
7+
# Get the project name from the project directory, minus any leading
8+
# non-alphanumeric characters and trailing `.ddev.site`.
99
PROJECT_NAME=$(basename "$PROJECT_DIR" | sed 's:^[^a-zA-Z0-9]*::;s:\.ddev\.site$::')
10+
11+
# Replace any $PROJECT_NAME hyphens with spaces and capitalize the first letter of each word.
12+
PROJECT_TITLE=$(echo "$PROJECT_NAME" | sed 's/-/ /g' | sed 's/\b\(.\)/\u\1/g')
13+
14+
# Replace any $PROJECT_NAME spaces with hyphens and convert to lowercase.
1015
PROJECT_NAME_SLUG=$(echo "$PROJECT_NAME" | sed 's/[[:space:]]/-/g' | tr '[:upper:]' '[:lower:]')
1116

1217
# Terminal Base Colors

0 commit comments

Comments
 (0)