Studio-Lemon / wp-lemon-docs

MIT License
0 stars 1 forks source link

documenteren van customizer fields #10

Open Levdbas opened 3 months ago

Levdbas commented 3 months ago
<?php

/**
 *Customizer
 *
 * @package WordPress
 * @subpackage WP_Lemon\Child
 */

namespace WP_Lemon\Child\Models;

/**
 * Register customizer fields via native api.
 *
 * @param object $wp_customize  The cutomizer object we are going to extend.
 * @return void
 */
function customize_register($wp_customize)
{
   $wp_customize->add_section(
      'uibt',
      [
         'title'       => esc_attr_x('United', 'Backend - Customizer section title', 'wp-lemon'),
         'priority'    => 50,
         'description' => esc_attr_x('Uited custom features.', 'Backend - Customizer section description', 'wp-lemon'),
      ]
   );

   $wp_customize->add_setting(
      'address',
      [
         'validate_callback' => '',
         'sanitize_callback' => 'wp_kses_post',
      ]
   );

   $wp_customize->add_control(
      'address',
      [
         'label'       => _x('Address', 'Backend - Customizer field label', 'wp-lemon-child'),
         'section'     => 'uibt',
         'type'        => 'textarea',
      ]
   );

   // add url customizer field
   $wp_customize->add_setting(
      'banking_url',
      [
         'validate_callback' => '',
         'sanitize_callback' => 'esc_url_raw',
      ]
   );

   $wp_customize->add_control(
      'banking_url',
      [
         'label'       => _x('Banking URL', 'Backend - Customizer field label', 'wp-lemon-child'),
         'section'     => 'uibt',
         'type'        => 'url',
      ]
   );

   $wp_customize->add_setting(
      'disclaimer',
      [
         'validate_callback' => '',
         'sanitize_callback' => 'wp_kses_post',
      ]
   );

   $wp_customize->add_control(
      'disclaimer',
      [
         'label'       => _x('Disclaimer footer text', 'Backend - Customizer field label', 'wp-lemon-child'),
         'section'     => 'uibt',
         'type'        => 'textarea',
      ]
   );

   $wp_customize->add_setting(
      'cookiebar_text',
      [
         'validate_callback' => '',
         'sanitize_callback' => 'wp_kses_post',
      ]
   );

   $wp_customize->add_control(
      'cookiebar_text',
      [
         'label'       => _x('Cookiebar text', 'Backend - Customizer field label', 'wp-lemon-child'),
         'section'     => 'uibt',
         'type'        => 'textarea',
      ]
   );
}
add_action('customize_register', __NAMESPACE__ . '\\customize_register');
MeesMoons commented 1 month ago

https://developer.wordpress.org/themes/customize-api/customizer-objects/#controls