![](/img/trans.png)
[英]Using same tooltipster-tooltip on dynamic elements for dynamic contents
[英]Tooltipster tooltip contents empty when using WordPress
在我們的WordPress網站上實施Tooltipster,但遇到了障礙。 工具提示正確打開,但是工具提示中的內容為空。 此代碼在WordPress之外有效。 請幫忙?
這是所有設置的方式。
1)在functions.php中:
wp_enqueue_style( 'ttcss', '/ours/tt/dist/css/tooltipster.bundle.min.css' );
wp_enqueue_style( 'ttcss-noir', '/ours/tt/dist/css/plugins/tooltipster/sideTip/themes/tooltipster-sideTip-noir.min.css' );
wp_enqueue_script( 'ttjs', '/ours/tt/dist/js/tooltipster.bundle.min.js', array('jquery'), null, true );
2)在關閉</head>
前,在header.php中:
<script> jQuery(document).ready(function() {
jQuery('.ourtip').tooltipster({
theme: 'tooltipster-noir',
contentCloing: true,
contentAsHTML: true
});
});
</script>
3)在主題內,需要工具提示的位置:
<span class="ourtip" data-tooltip-content="#ourtip_content">Tool</span>
4)在主題下方,應顯示(但不應該顯示):
<?php
function ours_publisher_popup()
{
?>
<style>.ourtip_templates {display: none;} </style>
<div class="ourtip_templates">
<div id="ourtip_content">
<strong>This text should display but is missing.<br></strong>
</div>
</div>
<?php
}
ours_publisher_popup(); ?>
最終成為一個有沖突的插件。 一次禁用WP插件,直到它開始工作,然后才發現一個也在嘗試使用Tooltipster的插件。 停用該功能並返回功能。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.