Title: Getting Attributes from Shortcode
Last modified: August 21, 2016

---

# Getting Attributes from Shortcode

 *  [sdowswell](https://wordpress.org/support/users/sdowswell/)
 * (@sdowswell)
 * [13 years ago](https://wordpress.org/support/topic/getting-attributes-from-shortcode/)
 * Hello all
 * I’m developing a plugin for creating form components via shortcode. Creating 
   option sets, listboxes and collections of radioboxes for example, I’d like to
   have a single parent shortcode defining the grouping and list type for the subsequent
   options, a la:
 *     ```
       [form_item id="groupname" type="radio"]
         [form_item_option value="item1"]Item Label 1[/form item]
         [form_item_option value="item2"]Item Label 2[/form item]
         [form_item_option value="item3"]Item Label 3[/form item]
       [/form]
       ```
   
 * Now, in translating this to markup, I’d like this to appear as follows:
 *     ```
       <input type="radio" name="groupname" id="item1" />
       <label for="item1">Item Label 1</label>
   
       <input type="radio" name="groupname" id="item2" />
       <label for="item2">Item Label 2</label>
   
       <input type="radio" name="groupname" id="item3" />
       <label for="item3">Item Label 3</label>
       ```
   
 * Of course, in order for this to work, I need to be able to pull the the parent`
   form_item` node’s attributes from the `.do_shortcode` for each child element (`
   form_item_option`).
 * And herein I am stumped. Can someone show me the light?
 * Thanks in advance!
 * Stacey

The topic ‘Getting Attributes from Shortcode’ is closed to new replies.

## Tags

 * [inheritance](https://wordpress.org/support/topic-tag/inheritance/)
 * [nesting](https://wordpress.org/support/topic-tag/nesting/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 0 replies
 * 1 participant
 * Last reply from: [sdowswell](https://wordpress.org/support/users/sdowswell/)
 * Last activity: [13 years ago](https://wordpress.org/support/topic/getting-attributes-from-shortcode/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
