php - 如何将简码插入现有的 html 元素(wordpress)?
问题描述
我需要在[ajaxdomainchecker]
现有的 html 代码中插入一个简码。
我尝试了以下代码,但它显示错误。请告诉我如何添加短代码?
SyntaxError: Unexpected identifier:
<script>
jQuery(document).ready(function(){
var sessionName = '<?php echo do_shortcode("[ajaxdomainchecker]"); ?>';
jQuery(" .acf-field-60po7a8eu9444 p.description").html(sessionName);
});
</script>
SyntaxError: missing ) after argument list
jQuery(' .acf-field-60po7a8eu9444 p.description').html('<?php echo do_shortcode("[ajaxdomainchecker]"); ?>');
SyntaxError: Invalid or unexpected token
jQuery(" .acf-field-60po7a8eu9444 p.description").html("<?php echo do_shortcode('[ajaxdomainchecker]'); ?>");
SyntaxError: Unexpected token
jQuery('.acf-field-60f5d9a279544 p.description').html(<?php echo do_shortcode('[ajaxdomainchecker]'); ?>);
现有代码(使用创建acf/frontend
):
<div class="acf-field acf-field-textarea acf-field-60po7a8eu9444 elementor-repeater-item-b95d154" data-name="rtype_selection_desc" data-type="textarea" data-key="field_60po7a8eu9444">
<div class="acf-label">
<label for="acf-field_60po7a8eu9444">Enter Info</label>
</div>
<div class="acf-input">
<p class="description">Search and Enter Info</p>
<!-- how to add the short code here? -->
<textarea id="acf-field_60po7a8eu9444" name="acf[field_60po7a8eu9444]" rows="8"></textarea>
</div>
</div>
解决方案
您可以在帖子中添加短代码,在 ACF 输入中输入数据。并将您的简码设置为该字段的默认值。“进行搜索并输入信息”标签作为另一个 ACF 字段,可帮助您随时更改标签的文本。
推荐阅读
- regex - 显示搜索结果中的行 - Google 表格
- c# - 我可以在 .NET/C# 中使用 botbuilder-timeout 吗?
- c# - 是否可以从 JSON 响应中获取参数的值
- python - 我在 Python django 代码中遇到错误,当我 RUN python3 manage.py runserver 它引发异常
- c# - 将更新从数据网格查看器传回 sql server
- android - react native run android有错误。解决错误后无法更改配置“:packagename:androidApis”的依赖项
- swift - 如何刷新 Swift 应用程序中的菜单项?
- sql - SSDT 在没有任何更改时删除并重新创建表
- webpack - 构建到检测到更改的目录
- python - 在稀疏 CSC 矩阵(Python)中索引和替换值