Hi!
I slightly modified your excellent plugin for the needs. And I thought: maybe it’s like the author and she will add it?
To Display a previously created tooltip, you use a shortcode:
[act_tooltip id="XX"/]
Where id – is id of tooltip.
But suppose that we have a website recipes. Each recipe has a list of products. It is selected by the editor when editing a recipe. We want to show the user a tooltip for each ingredient.
In order not to overload the tooltips on the page, we use the shortcode specified above.
But to register compliance for each ingredient the ID of the tooltip is ineffective. So I did the following:
Changed the value of the “title” parameter in the function to replace the ID.
In file advanced-custom-tooltips/public/class-advanced-custom-tooltips-public.php
I changed the “tooltip_shortcode” function:
/**
* Tooltip shortcode.
*
* @since 1.0.0
*/
public function tooltip_shortcode( $atts, $code_content ) {
if( !isset( $atts['title'] ) && !isset( $atts['content'] ) && !isset( $atts['id'] ) ) { //No tooltip ID or content provided, do nothing
return;
}
if( isset( $atts['title'] ) && isset( $atts['id'] ) ) { //Both ID and Title tooltip, do nothing
return;
}
$defaults = extract( shortcode_atts(array(
'id' => '',
'title' => '',
'content' => '',
), $atts, 'act-tooltip-shortcode-atts' ) );
if( !isset( $atts['id'] ) && isset( $atts['title'] ) ) { //Plain text tooltip
query_posts( 'post_type=act_tooltip&title=' . $title );
if ( have_posts()) : while (have_posts()) : the_post();
if( $code_content ) {
$tooltip_text = $code_content;
} else {
$tooltip_text = get_the_title();
}
$tooltip_content = $this->format_tooltip_content( get_the_content() );
endwhile; endif; wp_reset_query();
return '<span class="act-tooltip" title="' . $tooltip_content . '">' . $tooltip_text . '</span>';
}
if( isset( $atts['id'] ) && !isset( $atts['title'] ) ) {
//ID provided, get this tooltip from db
query_posts( 'post_type=act_tooltip&p=' . $id );
if ( have_posts()) : while (have_posts()) : the_post();
if( $code_content ) {
$tooltip_text = $code_content;
} else {
$tooltip_text = get_the_title();
}
$tooltip_content = $this->format_tooltip_content( get_the_content() );
endwhile; endif; wp_reset_query();
return '<span class="act-tooltip" title="' . $tooltip_content . '">' . $tooltip_text . '</span>';
}
}
Now in the recipe page template code I write the following
echo do_shortcode('[act_tooltip title="'.$ingredient.'" /]');
Where $ingredient is the name of the ingredient. But here the name of the tooltip must be identical to the name of the ingredient.
For me it is very much reduced the time to fill the site. I hope I can help someone.
P.S.: I am from Russia and write through a translator. I apologize for the mistakes in the text.
Hello!
I really hope that you still have not forgotten about your wonderful plugin and agree to its further improvement.
It would be fantastic to add groups for tooltips. Because when the site has many categories of posts, it is very difficult to put things in order in the tooltips for each category.
And of course these groups should not go beyond the administrative panel. That is, it is necessary only for the administrator, not for the visitor.
Hi There!
First of all, thank you for share your work!
I just started to use your plugin and it’s very near to what i’m looking for. To become the tooltips plugin of my dreams I’d like to have some other functions and this is the first of the list, a switch to select if the tooltip must appear with uppercase, lowercase or both.
Have a nice day ??
A.R.
]]>If the picture in a post has a word in its URL or in its description, it will break the image. Not a good thing….
]]>Hi,
Your plugin is great and easy to use. But there is 1 problem for me…. the “posts” I make for the tooltips are actually shown in search results, and if a visitor clicks on it, they get a 404 page.
Is there any way you can make sure that the page does not show up in search results?
]]>If I put multiple paragraphs in a tooltip in Visual view, the paragraphs are stripped and the text is combined into one large paragraph. However, if I go to Text view and explicitly add <p></p>
in HTML, the tags are preserved.
Would you be able to add an option in the plugin settings to allow for preservation of paragraphs in the Visual view?
]]>Hi again,
I have got another issue, the extension “row highlighting” of the plugin “Tablepress” is not working anymore when I have Advanced Custom Tooltips activated.
How can I find what is causing this to fix it?
Thanks!
Hi
Thank you for this plugin, it was exactly what I needed!
The only issue I have is that my theme (Advertica lite (free)) is in conflict with this plugin, when creating tooltip I can’t add medias, can’t switch language (using qtranslate-x) nor use the visual editor.
So each time I want to create a tooltip I have to switch to the default WP theme.
Is there anything I can do to fix that?
Thank you very much!
]]>Hi again.
Upon activation of this plugin I got a PHP Warning: array_merge() [function.array-merge]: Argument #2 is not an array in .../public/class-advanced-custom-tooltips-public.php on line 74
. It didn’t happen again, only when I activated the plugin. Probably the constructor was called before the options have been generated.
Hello. Great plugin! There is still space for improvements though.
1. Due to the default setting of get_posts() function, it shows only the last 5 tooltips created. This can be fixed either by adding 'posts_per_page' => -1
in public/class-advanced-custom-tooltips-public.php on line 146, or making it an option for the user that can be changed through the admin panel.
2. I use bootstrap in my theme, and it has already set styles for the css class .tooltip . To avoid this, I suggest changing the name of this class to .act_tooltip or something else.
Keep up the good work!
]]>Free support
Please check the plugin FAQ, this support forum and my knowledgebase for existing answers before posting a new thread.
You can read my full support policy here.
Feature requests
Feature requests are very welcome, please start a new thread for each suggestion (no multiple requests in one thread) and again, search the forum before posting. If someone else has already suggested your idea, please add your comments to their thread instead.
Please note that feature requests from plugin supporters are given priority. If your request is urgent and you’d like me to spend time on it, please consider becoming a supporter.
]]>