在另一个标签之后插入标签
Insert tag after another tag
我试图通过将代码插入到主题的 function.php 文件中,在具有特定 class 的 H3 标签后插入自定义标签。以下是我正在做但无法实现的。
如果我有这个,当前显示在页面上:
<h3 class="title">TITLE HERE</h3>
<div class="desc">
我想在 h3 标签后插入一个标签。下面是我试图插入 intp 我的主题 functions.php 文件:
echo '<h3 class="title">TITLE HERE</h3>
<a tooltip="This is a test">TEST</a>
<div class="desc">'
因此,我只是 'TEST' 在页面顶部,而不是在 h3 标记之后显示它。
你能先试试这个吗
Add **<div style="clear:both;"></div>** after your closing </h3> tag
或
我认为您正在 function.php 文件中创建简码。如果你直接在你的函数中回显那么这个问题就会出现。首先,您将值分配给要回显的变量,然后 return 这个变量。
例如:
function my_fun(){
$text='<h3 class="cuzd-title"> TITLE HERE</h3> <div style="clear:both;">
</div> <a data-tooltip="THIS IS TEST">TEST</a>';
return $text;
}
add_shortcode( 'shortcode_name', 'my_fun' );
现在您想要显示这些内容的地方只需使用
echo do_shortcode('[shortcode_name]');
我试图通过将代码插入到主题的 function.php 文件中,在具有特定 class 的 H3 标签后插入自定义标签。以下是我正在做但无法实现的。
如果我有这个,当前显示在页面上:
<h3 class="title">TITLE HERE</h3>
<div class="desc">
我想在 h3 标签后插入一个标签。下面是我试图插入 intp 我的主题 functions.php 文件:
echo '<h3 class="title">TITLE HERE</h3>
<a tooltip="This is a test">TEST</a>
<div class="desc">'
因此,我只是 'TEST' 在页面顶部,而不是在 h3 标记之后显示它。
你能先试试这个吗
Add **<div style="clear:both;"></div>** after your closing </h3> tag
或
我认为您正在 function.php 文件中创建简码。如果你直接在你的函数中回显那么这个问题就会出现。首先,您将值分配给要回显的变量,然后 return 这个变量。
例如:
function my_fun(){
$text='<h3 class="cuzd-title"> TITLE HERE</h3> <div style="clear:both;">
</div> <a data-tooltip="THIS IS TEST">TEST</a>';
return $text;
}
add_shortcode( 'shortcode_name', 'my_fun' );
现在您想要显示这些内容的地方只需使用
echo do_shortcode('[shortcode_name]');