top of page

Shortcodes Inside Text Area and Text Field

  • Writer: سُلَيْمَان بْن دَاوُوْد
    سُلَيْمَان بْن دَاوُوْد
  • Apr 11, 2022
  • 1 min read

Requirement


Solution


Code



// Allow shortcodes in ACF fields
add_filter('acf/format_value/type=textarea', 'do_shortcode');
add_filter('acf/format_value/type=text', 'do_shortcode');

/**
 * Add shortcode [turquoise]
 */
add_shortcode( 'turquoise' , 'accent_shortcode' );
function accent_shortcode($atts, $content) {
    return '<span class="text-turquoise">'.esc_html($content).'</span>';
}

FOR CSS You can use 
span.text-turquoise {   color: #37C3D0!important;}

View Source




 
 
 

Recent Posts

See All
Duplicate Category in Wordpress

The following code helps to duplicate the default wordpress category by help of code. // Add Duplicate option for categories in WordPress...

 
 
 
C#.NET and Its Associated Codes

1- Creating an Desktop Application in C#.NET C# ADO.NET & MySQL MAIN C# and MySQL ADO.NET with Crystals Reports Ready Code 2- Handling...

 
 
 

Comments


© 2020 by syednazrulhassan

bottom of page