su_shortcode_tab

The shortcodes-ultimate su shortcode tab function.

Published Date - February 15, 2021

Description

su_shortcode_tab( $atts, $content );

Parameters

  1. $atts

  2. $content


Usage

The following example is for adding a hook callback.

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

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

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

Defined

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

shortcodes-ultimate/includes/shortcodes/tabs.php

function su_shortcode_tab( $atts = null, $content = null ) {

	global $shortcodes_ultimate_global_tabs, $shortcodes_ultimate_global_tabs_count;

	$atts = shortcode_atts(
		array(
			'title'    => __( 'Tab title', 'shortcodes-ultimate' ),
			'disabled' => 'no',
			'anchor'   => '',
			'url'      => '',
			'target'   => 'blank',
			'class'    => '',
		),
		$atts,
		'tab'
	);

	$x = $shortcodes_ultimate_global_tabs_count;

	$shortcodes_ultimate_global_tabs[ $x ] = array(
		'title'    => $atts['title'],
		'content'  => do_shortcode( $content ),
		'disabled' => 'yes' === $atts['disabled'] ? ' su-tabs-disabled' : '',
		'anchor'   => $atts['anchor'] ? ' data-anchor="' . str_replace( array( ' ', '#' ), '', sanitize_text_field( $atts['anchor'] ) ) . '"' : '',
		'url'      => ' data-url="' . $atts['url'] . '"',
		'target'   => ' data-target="' . $atts['target'] . '"',
		'class'    => $atts['class'],
	);

	$shortcodes_ultimate_global_tabs_count++;

}