fix: resolve form submission issues and add CPT detail view
- Rename day/month/year form fields to umzug_day/umzug_month/umzug_year to avoid conflict with WordPress reserved public query variables that caused a 404 on form POST - Move form handler instantiation to init_hooks() so handle_submission registers on the init action before it fires - Add standalone template fallback: detect [umzugsliste] shortcode in page content when form_page_id option is not set - Add submission details meta box to CPT entries showing addresses, furniture, additional work, and status - Add German translations for all new admin meta box strings Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -93,6 +93,9 @@ class Umzugsliste {
|
||||
private function init_hooks() {
|
||||
add_action( 'init', array( $this, 'init' ) );
|
||||
add_filter( 'template_include', array( $this, 'maybe_load_form_template' ) );
|
||||
|
||||
// Form handler must register its init hook before init fires
|
||||
Umzugsliste_Form_Handler::get_instance();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,9 +109,23 @@ class Umzugsliste {
|
||||
return $template;
|
||||
}
|
||||
|
||||
$form_page_id = (int) get_option( 'umzugsliste_form_page_id', 0 );
|
||||
$use_standalone = false;
|
||||
|
||||
// Check configured form page ID
|
||||
$form_page_id = (int) get_option( 'umzugsliste_form_page_id', 0 );
|
||||
if ( $form_page_id > 0 && is_page( $form_page_id ) ) {
|
||||
$use_standalone = true;
|
||||
}
|
||||
|
||||
// Fallback: check if current page contains the [umzugsliste] shortcode
|
||||
if ( ! $use_standalone ) {
|
||||
$post = get_queried_object();
|
||||
if ( $post && isset( $post->post_content ) && has_shortcode( $post->post_content, 'umzugsliste' ) ) {
|
||||
$use_standalone = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $use_standalone ) {
|
||||
$custom_template = UMZUGSLISTE_PLUGIN_DIR . 'templates/form-page.php';
|
||||
if ( file_exists( $custom_template ) ) {
|
||||
return $custom_template;
|
||||
@@ -136,9 +153,6 @@ class Umzugsliste {
|
||||
|
||||
// Initialize shortcode
|
||||
Umzugsliste_Shortcode::get_instance();
|
||||
|
||||
// Initialize form handler
|
||||
Umzugsliste_Form_Handler::get_instance();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user