Custom Shortcode for Target URL
-
you have included a few default shortcodes for modifying the output of a given string. I attempted to create my own shortcode for use within this and was not able to get it to work without having modified the do_shortcode functionion within the url-transform.php file. How do you recommend me doing this type of thing. For instance, i need to take a string1_string2 and remove the underscore and ucwords the string then add the underscore back in so the new redirected URL is String1_String2 due to canonical URLs on the landing page.
add_shortcode('ucase_word','ucase_word');function ?ucase_word ( $attrs, $content, $tag ) { $tmp_content = str_replace( [ '_' ], ' ', $content ); $tmp_content = ucwords($tmp_content); $tmp_content = str_replace( [ ' ' ], '_', $tmp_content ); return $tmp_content; }
?I wrote this but when I try to use this ucase_word shortcode it just outputs it into the URL. Any direction you can give would be greatly appreciated.
- The topic ‘Custom Shortcode for Target URL’ is closed to new replies.