You appear to be a bot. Output may be restricted
Description
Display external link warning as a tooltip on the chosen fields, if requiredThere are times when the link is not an external link but clicking on it will take the user to an external page There are other times when the link includes onclick= JavaScript which is run before the jQuery click() function gets to do its stuff. This code now caters for both of these cases. Uses jquery-ui-tooltip which was first delivered in WordPress 3.5 v0.05: Updated to pass the items: parameter so we can target elements which don't include the title="" attribute.
Usage
oikelw_hover_selectors( $safe_alert_text, $hover_selectors );
Parameters
- $safe_alert_text
- ( string ) required – the text to be displayed in the tooltip
- $hover_selectors
- ( string ) optional default: hover_selectors – name of the hover selectors field
Returns
voidSource
File name: oik-external-link-warning/oik-external-link-warning.phpLines:
1 to 13 of 13
function oikelw_hover_selectors( $safe_alert_text, $hover_selectors="hover_selectors" ) { $hover_selectors = bw_get_option( $hover_selectors, "oik_elw_options" ); if ( $hover_selectors ) { oik_require( "shortcodes/oik-jquery.php" ); bw_jquery_enqueue_script( "jquery-ui-tooltip" ); bw_jquery_enqueue_style( "jquery-ui-tooltip" ); $hover_selectors = trim( $hover_selectors, "," ); bw_jquery( $hover_selectors , "tooltip" , "{ content: \"$safe_alert_text\", items: \"$hover_selectors\" } " ); } }View on GitHub