-
Notifications
You must be signed in to change notification settings - Fork 0
Add Discover phase page scaffold: hero, journey nav, delivery numbers, introduction (LSA-132) #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
a38dfda
ceea72b
7ab7283
865a06e
dc966b9
7895622
faf1c1d
c344d5b
ef0adba
aec6831
1c64928
c241107
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| <?php | ||
| /** | ||
| * Redirects bare phase-page slugs (e.g. /discover/) to their real nested URL | ||
| * under /services/ (e.g. /services/discover/). | ||
| * | ||
| * The six lifecycle phase pages live as children of the "services" page, but | ||
| * their slugs (discover, create, build, launch, grow, evolve) are similar | ||
| * enough to other existing page slugs (e.g. "discovery") that WordPress's | ||
| * built-in wp_guess_404_permalink() fuzzy match can send a bare-slug request | ||
| * to the wrong page. Redirecting explicitly, before that guesser runs, avoids | ||
| * the ambiguity entirely. | ||
| * | ||
| * @package ls-theme | ||
| */ | ||
|
|
||
| if ( ! defined( 'ABSPATH' ) ) { | ||
| exit; | ||
| } | ||
|
|
||
| /** | ||
| * Redirects a bare phase slug request straight to its real nested page. | ||
| */ | ||
| function ls_theme_redirect_bare_phase_slugs() { | ||
| if ( is_admin() || ! is_404() ) { | ||
| return; | ||
| } | ||
|
|
||
| $ls_phase_slugs = array( 'discover', 'create', 'build', 'launch', 'grow', 'evolve' ); | ||
| $ls_request_path = trim( wp_parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ), '/' ); | ||
|
|
||
| if ( ! in_array( $ls_request_path, $ls_phase_slugs, true ) ) { | ||
| return; | ||
| } | ||
|
|
||
| $ls_target = get_page_by_path( 'services/' . $ls_request_path ); | ||
|
|
||
| if ( $ls_target instanceof WP_Post && 'publish' === $ls_target->post_status ) { | ||
| wp_safe_redirect( get_permalink( $ls_target ), 301 ); | ||
| exit; | ||
| } | ||
| } | ||
| add_action( 'template_redirect', 'ls_theme_redirect_bare_phase_slugs', 0 ); |
Uh oh!
There was an error while loading. Please reload this page.