最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

How to display specific title on Customizer?

matteradmin9PV0评论

Please find the below image. It will be more clear to understand my question.

I want to display the title that has been shown on above image in the Customizer.

How can I do that?

Please find the below image. It will be more clear to understand my question.

I want to display the title that has been shown on above image in the Customizer.

How can I do that?

Share Improve this question edited Jan 22, 2019 at 18:52 Kashif Rafique 2351 gold badge3 silver badges12 bronze badges asked Jan 22, 2019 at 16:05 EGWorldNPEGWorldNP 295 bronze badges 1
  • Hey hey, what have you tried so far and where exactly are you stuck? Please update your question for clarification. – norman.lol Commented Mar 29, 2019 at 18:14
Add a comment  | 

1 Answer 1

Reset to default 2

You can create a Custom Control for WP Customizer and use it.
For example:

    class Sub_Section_Heading_Custom_Control extends WP_Customize_Control {

        //The type of control being rendered
        public $type = 'sub_section_heading';



        //Render the control in the customizer

        public function render_content() {

        ?>
            <div class="sub-section-heading-control">
                <?php if( !empty( $this->label ) ) { ?>
                    <h4 class="customize-control-title">
                          <?php echo esc_html( $this->label ); ?>
                    </h4>
                <?php } ?>

            </div>
        <?php
        }
    }

Add some CSS

.sub-section-heading-control 
    .customize-control-title{ 

   text-align: center;
   color: white;
   background-color: saddlebrown;
   padding: 10px;

    }

And add it to a section in Customizer:

$wp_customize->add_setting('heading_post_content', array()); // dummy

$wp_customize->add_control( new Sub_Section_Heading_Custom_Control( 
            $wp_customize, 'heading_post_content',
            array(
                'label'   => __( 'Post Content', 'your-text-domain' ), // Set heading text here
                'section' => 'post_single', // set section id here
            )
        ) );

It should look like this:

I hope this helps.

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far