Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- inc/shortcodes.php
- ------------------
- */
- <?php
- /*
- @package journal
- =============================
- SHORTCODE OPTIONS
- =============================
- */
- function myjournal_tooltip( $atts, $content = null ){ // $atts can be $args etc
- // get the attributes
- $atts = shortcode_atts( // this $atts = $args
- array(
- 'placement' => 'top',
- 'title' => ''
- ),
- $atts, // not $args
- 'tooltip'
- );
- $title = ($atts['title'] == '' ? $content : $atts['title']);
- // return HTML
- return '<span class="myjournal-tooltip" data-toggle="tooltip" data-placement="' . $atts['placement'] . '" title="' . $title . '">' . $content . '</span>';
- }
- add_shortcode( 'tooltip', 'myjournal_tooltip' )
- /*
- ~How To Use~
- [tooltip placement="top" title="This is the title"]This is the content[/tooltip]
- */
- /* ===================================================================================== */
- /*
- js/theme-js-file.js
- -------------------
- */
- $(function(){
- $('[data-toggle="tooltip"]').tooltip();
- })
- /* ===================================================================================== */
- /*
- sass/styles.sass
- */
- .myjournal-tooltip
- cursor: pointer
- color: #ff9d1d
- &:hover,
- &:focus
- color: #F56B08
Add Comment
Please, Sign In to add comment