Title: Get attribute name
Last modified: February 2, 2021

---

# Get attribute name

 *  [Sam](https://wordpress.org/support/users/forbiddenchunk/)
 * (@forbiddenchunk)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/get-attribute-name/)
 * I have created a custom sidebar and in the structure I want the title of the 
   widget to appear;
 *     ```
       register_sidebar(array(
           'name' => __('Sidebar', 'html5blank'),
           'description' => __('Main Sidebar', 'html5blank'),
           'id' => 'sidebar',
           'before_widget' => '<div id="%1$s" class="widget %2$s '. $term->name .'">',
           'after_widget' => '</div>',
           'before_title' => '<div class="widget__title"><h3>',
           'after_title' => '</h3> <div class="title_arrow"><img src="'. get_stylesheet_directory_uri() .'/images/arrow.svg" alt="Filter Category" /></div></div>'
       ));
       ```
   
 * As you can see in ‘before_widget’ it says $term->name, I know this isn’t right
   but I’ve tried others but no success.
 * Can anyone help, please?

Viewing 1 replies (of 1 total)

 *  [Joy](https://wordpress.org/support/users/joyously/)
 * (@joyously)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/get-attribute-name/#post-13992425)
 * Your question and the code sound like two different things.
    Do you want the 
   title of the widget? That would be the title parameters. Do you want something
   in the class attribute of the widget? That would be the ‘before_widget’ parameter.
   If the value you want is known and static at the time of calling register_sidebar,
   simply refer to it in the function call. If it’s not known, use a filter like‘
   dynamic_sidebar_params’ to add it in. [https://developer.wordpress.org/reference/hooks/dynamic_sidebar_params/](https://developer.wordpress.org/reference/hooks/dynamic_sidebar_params/)

Viewing 1 replies (of 1 total)

The topic ‘Get attribute name’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 1 reply
 * 2 participants
 * Last reply from: [Joy](https://wordpress.org/support/users/joyously/)
 * Last activity: [5 years, 4 months ago](https://wordpress.org/support/topic/get-attribute-name/#post-13992425)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
