From dcfe79a727940571142bec3ef495096779ef6b6a Mon Sep 17 00:00:00 2001 From: Viktor Miller Date: Wed, 14 Jan 2026 19:25:51 +0900 Subject: [PATCH] feat(02-02): create login/registration page with responsive layout - Add create_login_page() method to DDHH_JM_Pages class - Combined view with registration form (Formidable shortcode) and login form (wp_login_form) - German headings: "Neu registrieren" and "Bereits registriert?" - Responsive two-column layout (desktop) with flexbox - Stacked layout on mobile (< 768px) - Inline CSS styling for visual separation and consistency - Background colors and borders for section distinction - Page accessible at /anbieter-login/ - Duplicate prevention: checks for existing page by slug Co-Authored-By: Claude Sonnet 4.5 --- includes/class-pages.php | 132 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) diff --git a/includes/class-pages.php b/includes/class-pages.php index ec6d18d..698291c 100644 --- a/includes/class-pages.php +++ b/includes/class-pages.php @@ -21,6 +21,9 @@ class DDHH_JM_Pages { public static function create_provider_pages() { // Create Anbieter Dashboard page self::create_dashboard_page(); + + // Create Anbieter Login page + self::create_login_page(); } /** @@ -52,4 +55,133 @@ class DDHH_JM_Pages { update_option( 'ddhh_jm_dashboard_page_id', $page_id ); } } + + /** + * Create login/registration page + */ + private static function create_login_page() { + // Check if page already exists by slug + $existing_page = get_page_by_path( 'anbieter-login' ); + + if ( $existing_page ) { + // Page already exists, store ID if not stored + $stored_page_id = get_option( 'ddhh_jm_login_page_id' ); + if ( ! $stored_page_id ) { + update_option( 'ddhh_jm_login_page_id', $existing_page->ID ); + } + return; + } + + // Get registration form ID + $registration_form_id = DDHH_JM_Formidable::get_registration_form_id(); + + // Build page content with inline CSS and two sections + $content = ''; + + $content .= '
'; + + // Registration section + $content .= '
'; + $content .= '

Neu registrieren

'; + if ( $registration_form_id ) { + $content .= '[formidable id=' . $registration_form_id . ']'; + } else { + $content .= '

Registrierungsformular wird geladen...

'; + } + $content .= '
'; + + // Login section + $content .= ''; + + $content .= '
'; // .ddhh-auth-container + + // Create the login/registration page + $page_data = array( + 'post_title' => 'Anbieter Login', + 'post_name' => 'anbieter-login', + 'post_content' => $content, + 'post_status' => 'publish', + 'post_type' => 'page', + 'post_author' => 1, // Admin user + ); + + $page_id = wp_insert_post( $page_data ); + + if ( $page_id && ! is_wp_error( $page_id ) ) { + // Store page ID in options + update_option( 'ddhh_jm_login_page_id', $page_id ); + } + } }