Input ordering in wordpress theme customizer

I’m trying to add custom fields to the wordpress theme customizer for the theme that I’m creating.

$wp_customize->add_section(
      'sometheme_theme_customization_section',
      array(
          'title' => __('Settings', 'sometheme'),
          'description' => 'Custom settings for the sometheme theme',
          'priority' => 35,
      )
  );

  $wp_customize->add_setting(
    'sometheme_headline',
    array(
        'default' => '',
        'sanitize_callback' => 'sometheme_sanitize_text'
    )
  );

  $wp_customize->add_control(
    'sometheme_headline',
    array(
        'label' => __('Headline', 'sometheme'),
        'section' => 'sometheme_theme_customization_section',
        'type' => 'text',
    )
  );

  $wp_customize->add_setting(
    'sometheme_tagline',
    array(
      'default' => '',
      'sanitize_callback' => 'sometheme_sanitize_text'
    )
  );

  $wp_customize->add_control(
    'sometheme_tagline',
    array(
      'label' => __('Tagline', 'sometheme'),
      'section' => 'sometheme_theme_customization_section',
      'type' => 'text'
    )
  );

As you can see from the above code the headline is declared before the tagline. But for some reason the output always ends up like this:

Read More

enter image description here

Is this weird or have I miss something? Thanks in advance!

Related posts

Leave a Reply

1 comment

  1. If you need a specific ordering of the input fields, then add “priority” values to the controls in the add_control calls, same as you already have for the sections.

    If you don’t have a priority, then no particular order is guaranteed and you get whatever PHP happens to order your arrays as.