Code

Support for WordPress Tooltips Ultimate & Image Hotspot

Support for WordPress Tooltips Ultimate & Image Hotspot

Cart 719 sales

codemine supports this item

Supported

This author's response time can be up to 1 business day.

Popular questions for this item

I get the error “The package could not be installed. No valid plugins were found. Plugin install failed.” when I try to install the plugin.

Make sure that you are uploading the correct zip file to your WordPress site. Which is wordpress-tooltips-ultimate.zip. And not the whole zip file that you have downloaded from envato.

How can I disable the Live Tooltip button and the Highlight Tooltips button from the admin menu bar?

To disable these buttons for all users, just include this code in your functions.php:

add_action('admin_bar_menu', 'live_tooltip_button', 1000);

function live_tooltip_button($wp_admin_bar) {
    $wp_admin_bar->remove_node('live-tooltip-button');
    $wp_admin_bar->remove_node('live-tooltip-highlight-button');
}

I have a lot of hotspots for one image and they are not saved.

If you have a large number of hotspots (eg. 50) for one image, then you may be unable to save them all if you have a low max_input_vars defined number on your hosting server.

In many servers, the default value for max_input_vars directive is 1000, which means that if your form has more than 1000 inputs, any additional values will be lost.

There are 2 possible solutions with which you can override this problem:

Solution 1: Increase your max_input_vars directive

Contact your hosting provider and ask them to increase your max_input_vars directive. If your servers allows it, you can do so yourself. For more info, check this article.

Solution 2: Use filters and remove customization options that you may not need

If you see that all your hotspots have the same icon, then you can remove the ability to customize each hotspot icon, since you don’t need it. This way, the custom fields that you will have to save, will be reduced dramatically.

To do so, just add this piece of code in your functions.php:

add_filter('wpcmtt_hotspot_type_force_default', 'hotspot_type_force_default', 10);

function hotspot_type_force_default($force_default) {
    return true;
}

Futhermore, if you see that all your hotspots are text only, you can remove the abitily to customize each hotspot type.

To do so, just add this piece of code in your functions.php:

add_filter('wpcmtt_hotspot_supported_tooltip_types', 'hotspot_supported_tooltip_types', 10);

function hotspot_supported_tooltip_types($supported_tooltip_types) {
    return array('text');
}

The supported args for the array above are ‘text’, ‘image’, ‘text_image’, ‘modal’, ‘video’, ‘map’ and ‘html’.

Warning

If you use the solution 2, create a lot of hotspots, and then later, remove the filters, go back to your hotspot, and press save, you may lose the extra hotspots that were added with this method, due to low max_input_vars.

Can I create a tooltip using PHP?

Yes you can by using the wpcmtt_do_tooltip function.

function wpcmtt_do_tooltip($id, $style_id, $selector, $content, $tooltip_type = 'text')

Bear in mind, you must have already the element on your page on which you want to attach the tooltip.

You can use this function inside a page template.

Parameters

  • $id string: A unique ID for the tooltip
  • $style_id string: The tooltip style ID you want to use for the tooltip
  • $selector string: The element’s tag on your page on which you want to attach the tooltip
  • $content string: The tooltip’s content.
  • $tooltip_type string: The tooltip type. It can take one of these values: text, html

Usage Example

<?php
// First create the element on which you want to attach the tooltip. 
// If you already have the element on your page, you can skip this step
echo '<div id="tooltip_selector">This is my PHP tooltip</div>';

// Then attach the tooltip on it
echo wpcmtt_do_tooltip('unique-tooltip-id', '37', '#tooltip_selector', 'Lorem ipsum', 'html');
?>

I use Layer Slider plugin and some of my slider animations are not working

If you use Layer Slider plugin, then in order for our plugin to be compatible:

  1. Go to LayerSlider WP > Options
  2. Click the Advanced tab
  3. Enable the Use GreenSock (GSAP) sandboxing option

Can I use the Thrive Architect builder and create tooltips?

Yes, but you have to use the shortcode for the tooltip itself.

  1. First, create a dummy post at your WordPress site. You will just need this post, just to generate the tooltip shortcode. You can delete it afterwards.
  2. Create your WordPress tooltip as explained here.
  3. When you are finished with the tooltip, press the Text tab on the upper right corner of the WordPress editor.
  4. Copy the tooltip shortcode.
  5. Open your thrive architect page and paste the shortcode inside a WordPress Content Element.

Notice: the shortcode will be something like this:

[wpcmtt id="130"]My tooltip[/wpcmtt]

How can I add tooltips on CF7 checkboxes?

You can do so by adding you own CSS selectors as explained here.

Let’s say that you have a CF7 with a checkbox list with 2 options. Here are the CSS selectors:

.wpcf7-checkbox .wpcf7-list-item:nth-child(1) .wpcf7-list-item-label
.wpcf7-checkbox .wpcf7-list-item:nth-child(2) .wpcf7-list-item-label

Can I deactivate tooltips for logged in users?

Yes you can. Just add the code below in functions.php:

add_action('wp_enqueue_scripts', 'wpcmtt_remove_tooltips', 9999999999);

function wpcmtt_remove_tooltips() {
    if (is_user_logged_in()) {
        wp_dequeue_script('tooltip-style-js');
    }
}

Can I add a questionmark indicator right next to each tooltip anchor?

Just add this CSS code in your theme:

[data-hasqtip]:after {
    font-family: "FontAwesome" !important;
    content: "\f059" !important;
    color: black;
    font-size: 12px;
    display: inline-block;
    padding: 0px 10px;
    vertical-align: middle;
}

To underline your anchor:

[data-hasqtip] {
    text-decoration: underline;
}

Can I run my custom javascript on showing or hiding tooltips?

Yes you can. Insert the code below in your functions.php and customize it to your needs:

add_action('wp_enqueue_scripts', 'wpcmtt_custom_script', 9999999999);

function wpcmtt_custom_script() {
    $output = '
jQuery(document).ready(function () {
    jQuery(".wpcmtt").each(function () {
        var outer_tooltip_selector = jQuery(this).attr("data-wpcmtt-selector");
        jQuery(outer_tooltip_selector).qtip("option", 
        {
            "events.visible": function () { 
               console.log("TOOLTIP VISIBLE: " + jQuery(this).attr("id"));
            },
            "events.hidden": function () { 
               console.log("TOOLTIP HIDDEN: " + jQuery(this).attr("id"));
            },
        });
    });
});';

    wp_add_inline_script('tooltip-style-js', $output, 'after');
}

Fix incompatibility with other plugins that use qtip library

For example, if you use WooCommerce Frontent Manager, you will not be able to click a link in your tooltip. To fix this, add this code in functions.php:

add_action('wp_enqueue_scripts',  'wpcmtt_register_scripts_fix', 10);

function wpcmtt_register_scripts_fix() {
    wp_enqueue_script('jquery-qtip-min-js', plugins_url('assets/qtip/jquery.qtip.js', Codemine_Tooltip_PLUGIN_FILE), array('jquery'), '3.0.3', true);
}

How can I add an audio file in a tooltip?

In order to do so, you must create first the shortcode below inside your functions.php:

add_shortcode('htmlAudio', 'htmlAudio_shortcode');

function htmlAudio_shortcode($atts) {
    if(isset($atts["src"])){
        return '<audio controls controlsList="nodownload"><source src="'.$atts["src"].'" type="audio/mpeg"></audio>';
    }
   return '';
}

And then add this shortcode in your tooltip:

[htmlAudio src="https://mysite/wp-content/uploads/file.mp3"]

How can I remove google fonts and font awesome library that are added with the plugin?

To do so, add this code inside your functions.php:

add_action('wp_enqueue_scripts', 'wpcmtt_remove_tooltip_scripts', 9999999999);

function wpcmtt_remove_tooltip_scripts() {
    wp_dequeue_style('wpcmtt-hotspot-fontawesome');
    $terms = get_terms(array(
            'taxonomy' => 'tooltip_selector_style',
            'hide_empty' => false,
            'fields' => "ids",
        ));
    foreach ($terms as $key) {
        $googlefonts_url = WPCMTT()->dal->get_googlefonts_urls($key);
            if (!empty($googlefonts_url)) {
                $googlefonts_style = 'wpcmtt-googlefonts-css-' . $key;
                wp_dequeue_style($googlefonts_style, $googlefonts_url, array());
            }
    }
}

How can I add a video file that I host in my server in a tooltip?

In order to do so, you must create first the shortcode below inside your functions.php:

add_shortcode('htmlVideo', 'htmlVideo_shortcode');

function htmlVideo_shortcode($atts) {
    if(isset($atts["src"])){
        return ' <video width="100%" height="auto" controls controlsList="nodownload" disablePictureInPicture >
        <source src="'.$atts["src"].'" type="video/mp4">
      </video> ';
    }
   return '';
}

And then add this shortcode in your tooltip:

[htmlVideo  src="https://mysite/wp-content/uploads/file.mp4"]

What if you have YouTube videos?

You can do the same for YouTube videos. You must create first the shortcode below inside your functions.php:

add_shortcode('youtubeVideo', 'youtubeVideo_shortcode');

function youtubeVideo_shortcode($atts) {
    if(isset($atts["src"])){
        return ' <iframe width="420" height="315" src="'.$atts["src"].'"></iframe>';
    }
   return '';
}

And then add this shortcode in your tooltip:

[youtubeVideo src="https://www.youtube.com/embed/tgbNymZ7vqY"]

How can I export hotspots using WP All Export and import them in another site using WP All Import?

Steps to export the hotspots

1. Install and activate WP All Export.
2. Go to All Export > New Export.
3. In Specific Post Type, select Image Hotspot.
4. Click Customize Export File.
5. Click Add All to enter all available fields.
6. Click the

wpcmtt_hotspot_points_meta_hotspot_tooltip 

field and use the PHP function below:

function hotspots_export($value) {
    $value_unserialized = unserialize($value);
    $value_json = json_encode($value_unserialized, JSON_HEX_QUOT | JSON_HEX_TAG);
    return $value_json;
}

Please see the relevant image below

4. Download your CSV.

Steps to import the hotspots to the new site

1. Install and activate WP All Import.
2. Create a new tooltip style. Make sure that you copy the tooltip style ID. You will need it later.
3. In the Images section of your import, make sure that you add the

{wpcmtt_hotspots_meta_basic_image[1]}

Please see the relevant screenshot below

4. Make sure that you add the custom field

wpcmtt_hotspot_points_meta_hotspot_tooltip

and pass it through this function

[hotspots_import({wpcmtt_hotspot_points_meta_hotspot_tooltip[1]})]

5. Also make sure that you add the custom field

wpcmtt_hotspots_meta_basic_image

and pass it through this function

[hotspot_basic_image_import({wpcmtt_hotspots_meta_basic_image[1]})]

6. Also add these PHP functions:

function hotspots_import( $value ){
    $value = json_decode($value, true);
    foreach ($value as $key => $field) {

        // Mapping: 
        $old_wpcmtt_hotspot_points_meta_style = $value[$key]['wpcmtt_hotspot_points_meta_style'];
        $new_wpcmtt_hotspot_points_meta_style = "0"; // Insert your new style ID here
        // Use the if statements below if you want to map old styles to new ones
        if ($old_wpcmtt_hotspot_points_meta_style == "12") {
            $new_wpcmtt_hotspot_points_meta_style = "111";
        } elseif ($old_wpcmtt_hotspot_points_meta_style == "34") {
            $new_wpcmtt_hotspot_points_meta_style = "222";
        } elseif ($old_wpcmtt_hotspot_points_meta_style == "56") {
            $new_wpcmtt_hotspot_points_meta_style = "333";
        }

        $value[$key]['wpcmtt_hotspot_points_meta_style'] = $new_wpcmtt_hotspot_points_meta_style;

        // Compatibility fix for hotspots created with version < 3.0
        if(!isset($value[$key]['wpcmtt_hotspot_points_meta_hotspot_link'] )){
            $value[$key]['wpcmtt_hotspot_points_meta_hotspot_link'] = "";
        }
    }
    return serialize( $value );
}

function hotspot_basic_image_import( $value ){    
    $pieces = explode("/", $value);
    $upload_dir = wp_upload_dir();
    return $upload_dir["url"] ."/" . end($pieces);
}

For steps 4,5 & 6, please see the relevant image below

How can I remove vimeo and youtube scripts?

If you do not plan to use youtube or vimeo tooltips, you can remove the relevant code. Just add the following code inside functions.php:

add_filter('wpcmtt_enqueue_youtube', '__return_false');
add_filter('wpcmtt_enqueue_vimeo', '__return_false');

I can’t put an iframe in a tooltip.

Sometimes wordpress is not allowing to add iframes inside editors. Just include this code in your functions.php:

add_filter( 'wp_kses_allowed_html', 'custom_wpkses_post_tags', 10, 2 );

function custom_wpkses_post_tags( $tags, $context ) {

    global $post;
    $post_types = array('tooltip_selectors', 'wpcmtt_hotspots');
    if ( 'post' === $context && $post && $post->post_type && in_array($post->post_type, $post_types) ){
        $tags['iframe'] = array(
            'src'             => true,
            'height'          => true,
            'width'           => true,
            'frameborder'     => true,
            'allowfullscreen' => true,
        );
    }

    return $tags;
}

Can i show all tooltips of a hotspot image on page load instantly?

Yes you can. Insert the code below in your functions.php. Make sure you replace the variable hotspot_id with your Image Hotspot id.


add_action('wp_enqueue_scripts', 'wpcmtt_custom_script', 9999999999);

function wpcmtt_custom_script() {
    $output = '
jQuery(document).ready(function () {

    // Apply code only for tooltips of a certain hotspot image 
    var hotspot_id = 1817;

    jQuery(".wpcmtt[data-wpcmtt-id^=\'" + hotspot_id + "_\']").each(function () {
        var outer_tooltip_selector = jQuery(this).attr("data-wpcmtt-selector");

        //Show all tooltips
        jQuery(outer_tooltip_selector).qtip("toggle", true);

        //Tooltips always visible (stop hidding tooltips)
        //Remove this code if you want to show/hide the tooltips
        jQuery(outer_tooltip_selector).qtip("option", 
        {
            "events.hide": function (e) { 
                e.preventDefault();
            },
        });

    });
});';

    wp_add_inline_script('tooltip-style-js', $output, 'after');
}

Can i add extra attributes to hotspot links?

Yes you can. Insert the code below in your functions.php and customize it to your needs. In this example we add target=”_blank” rel=”noopener noreferrer nofollow” to all links attached to tooltip style 133.

add_filter('wpcmtt_hotspot_link_atts', 'wpcmtt_hotspot_link_atts_custom', 10, 2);

function wpcmtt_hotspot_link_atts_custom($atts, $hotspot_tooltip) {
    // Apply this only for links attached to a certain tooltip style 
    if($hotspot_tooltip["wpcmtt_hotspot_points_meta_style"] == "133"){
            return 'target="_blank" rel="noopener noreferrer nofollow"';
    }
    return $atts;
}

Show more

Contact the author

This author provides limited support for this item through this item's comments.

Item support includes:

  • Availability of the author to answer questions
  • Answering technical questions about item’s features
  • Assistance with reported bugs and issues
  • Help with included 3rd party assets

However, item support does not include:

  • Customization services
  • Installation services

View the item support policy

by
by
by
by
by
by

Tell us what you think!

We'd like to ask you a few questions to help improve CodeCanyon.

Sure, take me to the survey