Description
Implement [bw_blog] shortcode to select the blog to be used in subsequent shortcodesWe might eexpect that if the blog was invalid then switch_to_blog() would fail. But it doesn't, so we need to check.
Usage
$string = bw_blog( $atts, $content, $tag );Parameters
- $atts
- ( array ) optional – expected to either contain "blog" or uses the index 0 values
- $content
- ( string ) optional – not expected
- $tag
- ( string ) optional – the shortcode used
Returns
string nothing is generated directly by this shortcodeSource
File name: oik-ms/shortcodes/oik-blog.phpLines:
1 to 18 of 18
function bw_blog( $atts=null, $content=null, $tag=null ) { if ( is_multisite() ) { $blog = bw_array_get_from( $atts, "blog,0", null ); if ( $blog ) { $details = get_blog_details( $blog, false ); if ( $details ) { switch_to_blog( $blog ); } else { e( "Invalid blog $blog" ); } } else { restore_current_blog(); } } else { bw_trace2( "Shortcode not effective in a non-multisite implementation" ); } return( bw_ret() ); }View on GitHub
Called by
Invoked by
Calls
1 to 2 of 2
Call hooks
API Letters:
