I am using custom shortcodes for my post editor and i now have multiple shortcodes i would like to make a shortode be stylized differently if another shortcode is enabled. Is开发者_高级运维 there a filter or conditional function like is_shortcode('slideshow') if not has anyone written a workaround for this?
There is no API for checking existing shortcodes, but its easy enough to check the global for what has been registered:
<?php
function my_shortcode($atts) {
global $shortcode_tags;
if (in_array('other-shortcode', $shortcode_tags)) {
// ... do conditional logic
}
}
add_shortcode('my-shortcode', 'my_shortcode');
?>
精彩评论