feat(07-01): add frontend display template for job offers

Created DDHH_JM_Template class to display full job details on single job offer pages. Shows logo, organization, location, type, deadline, description, and contact information in a styled layout.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-17 20:13:48 +09:00
parent 90525cd0ea
commit 7f2c5fa6a6
3 changed files with 147 additions and 0 deletions

View File

@@ -41,6 +41,7 @@ require_once DDHH_JM_PLUGIN_DIR . 'includes/class-dashboard.php';
require_once DDHH_JM_PLUGIN_DIR . 'includes/class-access-control.php';
require_once DDHH_JM_PLUGIN_DIR . 'includes/class-notifications.php';
require_once DDHH_JM_PLUGIN_DIR . 'includes/class-archive.php';
require_once DDHH_JM_PLUGIN_DIR . 'includes/class-template.php';
require_once DDHH_JM_PLUGIN_DIR . 'includes/class-admin-ui.php';
require_once DDHH_JM_PLUGIN_DIR . 'includes/class-user-preferences.php';
require_once DDHH_JM_PLUGIN_DIR . 'includes/class-scheduler.php';

View File

@@ -68,6 +68,9 @@ class DDHH_JM_Job_Manager {
// Initialize archive query helper
add_action( 'init', array( 'DDHH_JM_Archive', 'setup_hooks' ) );
// Initialize template display
add_action( 'init', array( 'DDHH_JM_Template', 'setup_hooks' ) );
// Initialize admin UI enhancements (admin-only)
if ( is_admin() ) {
add_action( 'init', array( 'DDHH_JM_Admin_UI', 'setup_hooks' ) );

143
includes/class-template.php Normal file
View File

@@ -0,0 +1,143 @@
<?php
/**
* Template functionality for job offers
*
* @package DDHH_Job_Manager
*/
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
/**
* Handles template display for job offers
*/
class DDHH_JM_Template {
/**
* Setup template hooks
*/
public static function setup_hooks() {
// Filter the content to add job details
add_filter( 'the_content', array( __CLASS__, 'add_job_details_to_content' ) );
}
/**
* Add job details to the content for single job_offer posts
*
* @param string $content Post content.
* @return string Modified content.
*/
public static function add_job_details_to_content( $content ) {
// Only modify content on single job_offer posts
if ( ! is_singular( 'job_offer' ) || ! in_the_loop() || ! is_main_query() ) {
return $content;
}
global $post;
// Get job meta data
$job_location = get_post_meta( $post->ID, 'job_location', true );
$job_type = get_post_meta( $post->ID, 'job_type', true );
$job_deadline = get_post_meta( $post->ID, 'job_deadline', true );
$job_contact_email = get_post_meta( $post->ID, 'job_contact_email', true );
$job_logo = get_the_post_thumbnail( $post->ID, 'job-logo' );
// Get author/organization info
$author = get_userdata( $post->post_author );
$author_name = $author ? $author->display_name : '';
$author_org = get_user_meta( $post->post_author, 'ddhh_org_name', true );
// Build job details HTML
ob_start();
?>
<div class="ddhh-job-offer-details">
<?php if ( $job_logo ) : ?>
<div class="job-logo">
<?php echo $job_logo; ?>
</div>
<?php endif; ?>
<div class="job-meta">
<?php if ( $author_org ) : ?>
<div class="job-meta-item">
<strong>Anbieter:</strong> <?php echo esc_html( $author_org ); ?>
</div>
<?php endif; ?>
<?php if ( $job_location ) : ?>
<div class="job-meta-item">
<strong>Standort:</strong> <?php echo esc_html( $job_location ); ?>
</div>
<?php endif; ?>
<?php if ( $job_type ) : ?>
<div class="job-meta-item">
<strong>Art:</strong> <?php echo esc_html( $job_type ); ?>
</div>
<?php endif; ?>
<?php if ( $job_deadline ) : ?>
<div class="job-meta-item">
<strong>Bewerbungsfrist:</strong> <?php echo esc_html( date( 'd.m.Y', strtotime( $job_deadline ) ) ); ?>
</div>
<?php endif; ?>
</div>
<div class="job-description">
<h3>Stellenbeschreibung</h3>
<?php echo wp_kses_post( $content ); ?>
</div>
<?php if ( $job_contact_email && is_user_logged_in() && current_user_can( 'read' ) ) : ?>
<div class="job-application-section">
<h3>Jetzt bewerben</h3>
<p>Interessiert? Kontaktieren Sie uns unter: <a href="mailto:<?php echo esc_attr( $job_contact_email ); ?>"><?php echo esc_html( $job_contact_email ); ?></a></p>
</div>
<?php endif; ?>
<style>
.ddhh-job-offer-details {
margin: 2em 0;
}
.ddhh-job-offer-details .job-logo {
margin-bottom: 2em;
}
.ddhh-job-offer-details .job-logo img {
max-width: 200px;
height: auto;
}
.ddhh-job-offer-details .job-meta {
background: #f5f5f5;
padding: 1.5em;
margin-bottom: 2em;
border-radius: 4px;
}
.ddhh-job-offer-details .job-meta-item {
margin-bottom: 0.75em;
}
.ddhh-job-offer-details .job-meta-item:last-child {
margin-bottom: 0;
}
.ddhh-job-offer-details .job-meta-item strong {
display: inline-block;
min-width: 150px;
}
.ddhh-job-offer-details .job-description {
margin-bottom: 2em;
}
.ddhh-job-offer-details .job-application-section {
background: #e8f4f8;
padding: 1.5em;
border-left: 4px solid #0073aa;
border-radius: 4px;
}
.ddhh-job-offer-details .job-application-section h3 {
margin-top: 0;
}
</style>
</div>
<?php
return ob_get_clean();
}
}