N
N
Nikita2016-03-01 06:07:23
PHP
Nikita, 2016-03-01 06:07:23

Why doesn't the image load through Theme customize?

Good day to all!
You need to do it through theme customize so that you can change the logo and some other pictures that are inserted through .
Wrote such setting and control

$wp_customize->add_setting('starcity_logo_header', array(
      'type' => 'theme_mod',
      ));
    $wp_customize->add_control(
      new WP_Customize_Media_Control (
        $wp_customize,
        'starcity_logo_header',
        array(
          'label' => 'Загрузить новый логотип',
          'section' => 'logo',
          'settings' => 'starcity_logo_header',
          'mime-type' => 'image',
          )
        )
      );

Insert into index like this:
<a href="#"><?php echo get_theme_mod('starcity_logo_header'); ?></a>

When I upload an image, it just shows me the number "12" and that's it.
What can be wrong?
UPD
Found an error - gave the same ID for control and settings

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question