Description
Implement a link to a (set of) shortcodes[codes codes=shortcode] [codes func=shortcode] – not yet implemented! alternatively [codes bbboing_sc fiddle] will return the values in $atts[0] and $atts[1] so we can get the API names from there! How about? [codes "bbboing_sc fiddle" ]
Usage
$string = oikai_codeslink( $atts, $content, $tag );Parameters
- $atts
- ( array ) required – shortcode parameters
- $content
- ( string ) required – shortcode content – not expected
- $tag
- ( string ) required – shortcode name
Returns
string generated HTMLSource
File name: oik-shortcodes/shortcodes/oik-codeslink.phpLines:
1 to 26 of 26
function oikai_codeslink( $atts, $content, $tag ) { $shortcode = bw_array_get( $atts, "codes", null ); $shortcodes = bw_as_array( $shortcode ); $unkeyed = bw_array_get_unkeyed( $atts ); $shortcodes = array_merge( $shortcodes, $unkeyed ); bw_trace2( $shortcodes, "shortcodes", true, BW_TRACE_DEBUG ); if ( count( $shortcodes) ) { oik_require( "admin/oik-shortcodes.php", "oik-shortcodes" ); $posts = oiksc_get_shortcodes_bycode( $shortcodes ); if ( $posts ) { $class = bw_array_get( $atts, "class", "bw_codes" ); sul( $class ); foreach ( $posts as $post ) { bw_format_list( $post, $atts ); } eul(); } else { p( "Cannot find shortcode(s):" . implode( ",", $shortcodes) ); } } else { oikai_listcodes( $atts ); } return( bw_ret()); }View on GitHub
Called by
Invoked by
Calls
1 to 9 of 9
- bw_array_get() – Return the array[index] or array->index (for an object) or a default value if not set
- bw_as_array() – Split a string into an array if necessary
- bw_ret() – Use bw_ret() to return the contents of $bwecho, leaving the global value as NULL
- bw_trace2() – Trace $value to the trace log file if tracing is active
- eul() – End an unordered list
- oikai_listcodes() – Automagically determine the shortcode list
- oiksc_get_shortcodes_bycode() – Load the shortcodes listed in the array
- p() – Output a paragraph of translatable text
- sul() – Start an unordered list
