Skip to content

Commit

Permalink
Add $PROJECT_TITLE variable and set it as the value for `$WP_SITE_T…
Browse files Browse the repository at this point in the history
…ITLE`
  • Loading branch information
jacobcassidy committed Nov 24, 2024
1 parent 0e39bce commit ce623e7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog for `ddev-wp-setup-script`

## 1.3.1

_2024-11-24_

- Added the `$PROJECT_TITLE` variable.
- Updated `$WP_SITE_TITLE` to use `$PROJECT_TITLE` variable.

## 1.3.0

_2024-11-24_
Expand Down
2 changes: 1 addition & 1 deletion config.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# Your WP site name
WP_SITE_TITLE=$PROJECT_NAME
WP_SITE_TITLE=$PROJECT_TITLE

# Your WP login details
WP_USER_NAME='example-name'
Expand Down
9 changes: 7 additions & 2 deletions modules/constants.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ MODULES_DIR="${SCRIPT_DIR}/modules"
FILES_DIR="${SCRIPT_DIR}/files"
PROJECT_DIR=$(pwd)

# Get the project name from the project directory,
# minus the any leading non-alphanumeric characters and trailing `.ddev.site`, if any.
# Get the project name from the project directory, minus any leading
# non-alphanumeric characters and trailing `.ddev.site`.
PROJECT_NAME=$(basename "$PROJECT_DIR" | sed 's:^[^a-zA-Z0-9]*::;s:\.ddev\.site$::')

# Replace any $PROJECT_NAME hyphens with spaces and capitalize the first letter of each word.
PROJECT_TITLE=$(echo "$PROJECT_NAME" | sed 's/-/ /g' | sed 's/\b\(.\)/\u\1/g')

# Replace any $PROJECT_NAME spaces with hyphens and convert to lowercase.
PROJECT_NAME_SLUG=$(echo "$PROJECT_NAME" | sed 's/[[:space:]]/-/g' | tr '[:upper:]' '[:lower:]')

# Terminal Base Colors
Expand Down

0 comments on commit ce623e7

Please sign in to comment.