Description
Implement [bw_more] shortcode for a jQuery read more linkNote: This method may hide a lot of other content that's added by other plugins implementing the 'the_content' filter. Note: This version simply hides the read more link. It shouldn't take much to include a read less button which reverts the processing, although there could be a problem with slideToggle logic, which may be needed but didn't appear to work when multiple bw_more shortcodes were implemented in a post.
Usage
oik_rm( $atts, $content, $tag );Parameters
- $atts
- ( array ) optional – shortcode parameters
- $content
- ( string ) optional – not expected
- $tag
- ( string ) optional – not expected
Returns
voidSource
File name: oik-read-more/shortcodes/oik-read-more.phpLines:
1 to 16 of 16
function oik_rm( $atts=null, $content=null, $tag=null ) { $text = bw_array_get_from( $atts, "0,read_more", "read more" ); $class = bw_array_get( $atts, "class", null ); oik_require( "includes/bw_jquery.inc" ); $selector = oik_rm_id(); bw_jquery_af( "div.bw_read_more#$selector", "click" , "span.bw_button#$selector", "hide" ); bw_jquery_af( "div.bw_read_more#$selector", "click" , "div.bw_more#$selector", "slideDown" ); sdiv( "bw_read_more", $selector ); span( "button art-button bw_button $class", $selector ); e( $text ); epan(); stag( 'div', "bw_more", $selector, kv( "style", "display:none;" ) ); add_filter( "the_content", "oik_rm_end", 9999 ); return( bw_ret() ); }View on GitHub View on Trac
Called by
Invoked by
Calls
1 to 8 of 8
- bw_array_get() – Return the array[index] or array->index (for an object) or a default value if not set
- bw_ret() – Use bw_ret() to return the contents of $bwecho, leaving the global value as NULL
- epan() –
- kv() – Create a keyword value pair
- oik_rm_id() – Return the next unique ID for the read_more selector
- sdiv() – Start a div
- span() –
- stag() – Output an HTML opening tag
