【发布时间】:2015-11-23 20:24:37
【问题描述】:
我在 ACF 中使用 Tag it Field add on,只想做最简单的事情,即使用 jQuery 添加标签。由于没有这方面的文档,我正在尝试使用 original jQuery plugin documentation 以及其中解释的方法以及 wordpress ACF acf.add_action('load') hook。
我正在 wordpress 主题的 functions.php 中尝试这样的事情(其中押韵是 tagit 字段的包装器 id):
function my_acf_input_admin_footer()
{
?>
<script type="text/javascript">
(function($){
acf.add_action( 'load', function( $el ){
$( '#rhymes ul.tagit' ).tagit( 'createTag', 'example tag' );
});
})(jQuery);
</script>
<?php
}
add_action( 'acf/input/admin_footer', 'my_acf_input_admin_footer' );
它什么也没做,有没有人有使用 tagit jQuery UI 插件和/或 wordpress ACF add on implementation 的经验?
【问题讨论】:
标签: jquery wordpress advanced-custom-fields tag-it