Skip to content

Instantly share code, notes, and snippets.

@MjHead
Created November 9, 2015 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MjHead/1aae0be289a05480cd94 to your computer and use it in GitHub Desktop.
Save MjHead/1aae0be289a05480cd94 to your computer and use it in GitHub Desktop.
<?php
add_filter( 'cherry_shortcodes_output', 'themeXXXX_row_add_tags', 10, 3 );
/**
* Add custom markup inside row shortcode.
*
* @param string $output shortcode content.
* @param array $atts attributes array.
* @param string $shortcode shortcode name.
* @return string
*/
function themeXXXX_row_add_tags( $output, $atts, $shortcode ) {
if ( 'row' !== $shortcode ) {
return $output;
}
if ( ! isset( $atts['style'] ) || 'light' !== $atts['style'] ) {
return $output;
}
$tags = '<div class="test-1"></div><div class="test-2"></div>';
$output = preg_replace( '/(<\/div>)$/', $tags . '$1', $output );
return $output;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment