• 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

    (@caseproof)

    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:

    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 Denis Stetsenko

    (@mstrdh)

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Define Shortcode Classes’ is closed to new replies.