Support » Themes and Templates » [Resolved] Register new widget areas

[Resolved] Register new widget areas

  • Hi. I try to register new widget areas in my quark-child theme. Thats how my functions.php looks:

    function quark-child_widgets_init() {
            register_sidebar( array(
                            'name' => esc_html__( 'startseite', 'quark-child' ),
                            'id' => 'startseite',
                            'description' => esc_html__( 'Auf der Startseite rechts', 'quark-child' ),
                            'before_widget' => '<aside id="%1$s" class="widget %2$s">',
                            'after_widget' => '</aside>',
                            'before_title' => '<span class="schriftgross">',
                            'after_title' => '</span>'
                    ) );
    add_action( 'widgets_init', 'quark-child_widgets_init' );

    It’s not working 🙂

    I am a beginner in php. i checked the wordpress codex an more than one description about how do to that. No success.

    It would be great if someone could help me.

    I put the functions.php file in my quark-child folder

Viewing 1 replies (of 1 total)
  • Theme Author Anthony Hortin


    Remove the ‘-‘ from your function name or change it to an underscore. eg. Change it to quark_child_widgets_init()

    Don’t forget to also change it in the add_action() function as well.

    “Function names follow the same rules as other labels in PHP. A valid function name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. As a regular expression, it would be expressed thus: [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*.”

    You can find out more about valid PHP functions here…

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Register new widget areas’ is closed to new replies.