Hi @nvkc,
Excellent, thanks for that. Ok if you add the below code to your theme’s functions.php file or include it in someway it should correctly transform the shortcode for IA. Please do test it thoroughly and let me know if you have any issues!
All the best
if ( ! function_exists( 'wpna_custom_fullscreen_override_shortcodes' ) ) :
/**
* Override the <code>wp_caption</code> shortcode in IA.
*
* @param array $override_tags Shortocde tags to override.
* @param string $content Current post content.
* @return array $override_tags
*/
function wpna_custom_fullscreen_override_shortcodes( $override_tags, $content ) {
$override_tags['fullscreen'] = 'wpna_custom_fullscreen_shortcode_override';
return $override_tags;
}
endif;
add_filter( 'wpna_facebook_article_setup_wrap_shortcodes_override_tags', 'wpna_custom_fullscreen_override_shortcodes', 10, 2 );
if ( ! function_exists( 'wpna_custom_fullscreen_shortcode_override' ) ) :
/**
* Wraps [fullscreen] shortcodes.
*
* Ensures they're always properly formatted and don't get caught up
* in the other parts of the content parser.
*
* @param array $attr Shortcode attributes.
* @param array $content The content of the shortcode..
* @return string
*/
function wpna_custom_fullscreen_shortcode_override( $attr, $content ) {
$atts = shortcode_atts( array(
'src' => '',
'cite' => '',
), $attr, 'fullscreen' );
// Start of output.
$html = '<figure data-mode="fullscreen">';
// The image element. Run do_shortcode over it just incase.
$html .= sprintf( '<img src="%s" />', esc_url( $atts['src'] ) );
if ( ! empty( $content ) ) {
// Set the caption settings, position, size etc.
$html .= '<figcaption class="op-extra-large">';
// Add in the caption.
$html .= $content;
if ( ! empty( $atts['cite'] ) ) {
$html .= sprintf( "<cite>%s</cite>", $atts['cite'] );
}
// Close the tag.
$html .= '</figcaption>';
}
// Closing figure tag.
$html .= '</figure>';
// Grab a placement for this code.
$placement_id = wpna_content_parser_get_placeholder( $html );
return '<pre>' . $placement_id . '</pre>';
}
endif;
-
This reply was modified 7 years, 5 months ago by
OzTheGreat. Reason: Formatting