WordPress:每个更多标签后都有自己的内容
WordPress: Own content after every more-tag
每次在编辑器中使用更多标签时,我都想显示内容。
我找到了使用以下代码为第一个 more-tag 执行此操作的解决方案:
<?php if ($pos=strpos($post->post_content, '<!--more-->')): ?>
<?php $more = 0; the_content(''); ?>
<div>CONTENT HERE</div>
<?php $more = 1; the_content('', true); ?>
<?php else : the_content(); endif; ?>
有没有办法对内容中的每个 more-tag 执行此操作?
你怎么看这个?
<?php
$contenido="Lorem ipsum dolor sit amet, his id porro lucilius theophrastus. -mas- Eum labitur voluptaria te, magna veniam civibus -mas- ad mei. An per ornatus officiis quaerendum, sonet timeam ad eam, nec an vidisse discere intellegam. Iusto habemus reprimique an nec.";
$contenidoExploded=explode('-mas-',$contenido);
if(count($contenidoExploded)>1){
foreach($contenidoExploded as $p){
echo $p.'</p>';
}
}else{
echo $contenido;
}
适合你吗?
每次在编辑器中使用更多标签时,我都想显示内容。 我找到了使用以下代码为第一个 more-tag 执行此操作的解决方案:
<?php if ($pos=strpos($post->post_content, '<!--more-->')): ?>
<?php $more = 0; the_content(''); ?>
<div>CONTENT HERE</div>
<?php $more = 1; the_content('', true); ?>
<?php else : the_content(); endif; ?>
有没有办法对内容中的每个 more-tag 执行此操作?
你怎么看这个?
<?php
$contenido="Lorem ipsum dolor sit amet, his id porro lucilius theophrastus. -mas- Eum labitur voluptaria te, magna veniam civibus -mas- ad mei. An per ornatus officiis quaerendum, sonet timeam ad eam, nec an vidisse discere intellegam. Iusto habemus reprimique an nec.";
$contenidoExploded=explode('-mas-',$contenido);
if(count($contenidoExploded)>1){
foreach($contenidoExploded as $p){
echo $p.'</p>';
}
}else{
echo $contenido;
}
适合你吗?