‚07131 8878853‘,
‚phone_href‘ => ‚tel:071318878853‘,
‚emergency_text‘ => ’24/7 erreichbar – bei Verhaftung, Durchsuchung und Notfällen‘,
‚brand‘ => ‚Anwaltskanzlei
Öz‚,
‚brand_url‘ => home_url( ‚/‘ ),
‚menu_json‘ => wp_json_encode( [
[ ‚label‘ => ‚Kompetenzen‘, ‚url‘ => ‚#kompetenzen‘ ],
[ ‚label‘ => ‚Kanzlei‘, ‚url‘ => ‚#anwalt‘ ],
[ ‚label‘ => ‚Journal‘, ‚url‘ => ‚#journal‘ ],
[ ‚label‘ => ‚Honorar‘, ‚url‘ => ‚#honorar‘ ],
[ ‚label‘ => ‚Kontakt‘, ‚url‘ => ‚#kontakt‘ ],
] ),
‚cta_label‘ => ‚Erstgespräch →‘,
‚cta_url‘ => ‚#kontakt‘,
‚hide_theme_header‘ => 0,
‚hide_selectors‘ => ‚header.site-header, .site-header, #masthead, header#header, .main-header‘,
];
}
private function opt( $key ) {
$opts = get_option( self::OPT_KEY, [] );
$def = $this->defaults();
return isset( $opts[ $key ] ) && $opts[ $key ] !== “ ? $opts[ $key ] : $def[ $key ];
}
/* ==============================================================
Assets
============================================================== */
public function enqueue_assets() {
wp_enqueue_style(
‚ra-oz-fonts‘,
‚https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=Inter:wght@400;500;600&display=swap‘,
[],
null
);
}
public function inject_css() {
$hide = (int) $this->opt( ‚hide_theme_header‘ );
$sel = trim( (string) $this->opt( ‚hide_selectors‘ ) );
// Basis-CSS des Headers
echo „\n";
}
/* ==============================================================
Header ausgeben
============================================================== */
public function render_header() {
$phone = esc_attr( $this->opt( 'phone' ) );
$phone_href = esc_attr( $this->opt( 'phone_href' ) );
$emerg = esc_html( $this->opt( 'emergency_text' ) );
$brand = wp_kses( $this->opt( 'brand' ), [ 'em' => [], 'strong' => [] ] );
$brand_url = esc_url( $this->opt( 'brand_url' ) );
$cta_label = esc_html( $this->opt( 'cta_label' ) );
$cta_url = esc_url( $this->opt( 'cta_url' ) );
$menu_raw = $this->opt( 'menu_json' );
$menu = json_decode( $menu_raw, true );
if ( ! is_array( $menu ) ) $menu = [];
?>
setzen.
*/
public function render_header_fallback_js() {
?>
'array',
'sanitize_callback' => [ $this, 'sanitize' ],
] );
}
public function sanitize( $input ) {
$out = [];
$def = $this->defaults();
$out['phone'] = sanitize_text_field( $input['phone'] ?? $def['phone'] );
$out['phone_href'] = esc_url_raw( $input['phone_href'] ?? $def['phone_href'] );
$out['emergency_text'] = sanitize_text_field( $input['emergency_text'] ?? $def['emergency_text'] );
$out['brand'] = wp_kses( $input['brand'] ?? $def['brand'], [ 'em' => [], 'strong' => [] ] );
$out['brand_url'] = esc_url_raw( $input['brand_url'] ?? $def['brand_url'] );
$out['cta_label'] = sanitize_text_field( $input['cta_label'] ?? $def['cta_label'] );
$out['cta_url'] = esc_url_raw( $input['cta_url'] ?? $def['cta_url'] );
$out['hide_theme_header'] = isset( $input['hide_theme_header'] ) ? 1 : 0;
$out['hide_selectors'] = sanitize_text_field( $input['hide_selectors'] ?? $def['hide_selectors'] );
// Menü-JSON: bleibt als String erhalten, wird beim Rendern dekodiert
$menu_json = $input['menu_json'] ?? $def['menu_json'];
$decoded = json_decode( $menu_json, true );
$out['menu_json'] = is_array( $decoded ) ? wp_json_encode( $decoded ) : $def['menu_json'];
return $out;
}
public function render_settings_page() {
if ( ! current_user_can( 'manage_options' ) ) return;
?>
Kanzlei-Header
Konfiguration der Notfall-Leiste und der Sticky-Navigation der Anwaltskanzlei Öz. Änderungen werden nach dem Speichern sofort auf der Website übernommen.