su_shortcode_display_posts_store

The shortcodes-ultimate su shortcode display posts store function.

Published Date - February 15, 2021

Description

su_shortcode_display_posts_store( $action, $key, $value );

Parameters

  1. $action

  2. $key

  3. $value


Usage

The following example is for adding a hook callback.

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

// The input(s). 
$action = 'get';
$key = '';
$value = '';

// NOTICE! Understand what this does before running.
$result = su_shortcode_display_posts_store( $action, $key, $value );
            

Defined

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

shortcodes-ultimate/includes/shortcodes/display-posts.php

function su_shortcode_display_posts_store( $action = 'get', $key = '', $value = '' ) {

	static $store;

	if ( ! is_array( $store ) ) {
		$store = array();
	}

	if ( 'get' === $action && ! empty( $key ) && isset( $store[ $key ] ) ) {
		return $store[ $key ];
	}

	if ( 'set' === $action ) {
		$store[ $key ] = $value;
	}

}