Title: Define Shortcode Classes
Last modified: April 23, 2023

---

# Define Shortcode Classes

 *  Resolved [mstrdh](https://wordpress.org/support/users/mstrdh/)
 * (@mstrdh)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/define-shortcode-classes/)
 * Hello!
 * Is there any chance you can show me how to define **[shortcode] **initial css
   classes?
 * For instance, I can insert both plan links and **[shortcode]** into my content,
   but both would have the same **class=””** attributes.
 * I know that after inserting the shortcode there is a way to modify the **class
   =””** but ideally, I’d like to pre-define the different classes for [shortcode]
   VS plain links.
 * Then I can style them differently on the front end.
 * Maybe there is some kind of apply_filters that I can use to modify initial values?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Caseproof LLC](https://wordpress.org/support/users/caseproof/)
 * (@caseproof)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/define-shortcode-classes/#post-16681859)
 * Hi,
   You should be able to do this by using our `ta_link_insert_extend_data_attributes`
   filter hook. Here’s the code snippet you’ll want to use:
 *     ```wp-block-code
       add_filter( 'ta_link_insert_extend_data_attributes', function( $link_atts, $thirstylink, $post_id ) {
         $link_atts['class'] = $link_atts['class'] . ' ta-shortcode-class';
         return $link_atts;
       }, 10, 3 );
       ```
   
 * You can replace `ta-shortcode-class` with the name of the class you’d like applied
   when the link is inserted through the shortcode.
 *  Thread Starter [mstrdh](https://wordpress.org/support/users/mstrdh/)
 * (@mstrdh)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/define-shortcode-classes/#post-16682482)
 * Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Define Shortcode Classes’ is closed to new replies.

 * ![](https://ps.w.org/thirstyaffiliates/assets/icon-256x256.jpg?rev=2686825)
 * [ThirstyAffiliates - Affiliate Links, Link Branding, Link Tracking & Marketing Plugin](https://wordpress.org/plugins/thirstyaffiliates/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/thirstyaffiliates/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/thirstyaffiliates/)
 * [Active Topics](https://wordpress.org/support/plugin/thirstyaffiliates/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/thirstyaffiliates/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/thirstyaffiliates/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [mstrdh](https://wordpress.org/support/users/mstrdh/)
 * Last activity: [3 years, 1 month ago](https://wordpress.org/support/topic/define-shortcode-classes/#post-16682482)
 * Status: resolved