su_do_nested_shortcodes

The shortcodes-ultimate su do nested shortcodes function.

Published Date - February 15, 2021

Description

Remove underscores from nested shortcodes.

su_do_nested_shortcodes( $content, $shortcode );

Parameters

  1. $content

  2. $shortcode


Usage

The following example is for adding a hook callback.

if ( !function_exists( 'su_do_nested_shortcodes' ) ) {
    require_once ABSPATH . PLUGINDIR . 'shortcodes-ultimateshortcodes-ultimate/includes/functions-shortcodes.php';
}

// The input(s). 
$content = null;
$shortcode = null;

// NOTICE! Understand what this does before running.
$result = su_do_nested_shortcodes( $content, $shortcode );
            

Defined

The function is defined in the following location(s).

shortcodes-ultimate/includes/functions-shortcodes.php

function su_do_nested_shortcodes( $content, $shortcode ) {

	if ( get_option( 'su_option_do_nested_shortcodes_alt' ) ) {
		return su_do_nested_shortcodes_alt( $content, substr( $shortcode, 0, 1 ) );
	}

	$prefix = su_get_shortcode_prefix();

	if ( strpos( $content, '[_' . $prefix . $shortcode ) !== false ) {

		$content = str_replace(
			array( '[_' . $prefix . $shortcode, '[_/' . $prefix . $shortcode ),
			array( '[' . $prefix . $shortcode, '[/' . $prefix . $shortcode ),
			$content
		);

		return do_shortcode( $content );

	}

	return do_shortcode( wptexturize( $content ) );

}