После смены темы во многих статьях у меня старый шорткод. Включает в себя <h2>
и <p>
. Я хотел бы создать новый шорткод с тем же именем, чтобы изменить старый. Мне нужны разные классы для <h2>
и <p>
.
У меня есть эта функция:
function factoid_function( $atts, $content = null ) {
return '<div class="vf-box vf-box--normal vf-box-theme--primary | factoid-box">' . '<p class="vf-box__text">' . $content . '</p>' . '</div>';
}
add_shortcode('fact-box', 'factoid_function');
Это вывод HTML.
<div class="vf-box vf-box--normal vf-box-theme--primary | factoid-box">
<p class="vf-box__text"></p>
<h2>What is mesoscopic imaging?</h2>
<p>Mesoscopic imaging involves looking at details of biological systems in the context of an organ, body part, or organism. It’s an approach that recognises that a heart, an arm, or a fish is more than just a set of cells. In any tissue, organ, or body part, cells are packed tightly together or arranged in relation to each other.
</p>
</div>
Почему $ content выбрасывается за пределы абзаца с классом?
Как разделить $ content, чтобы назначить vf-box__text
для абзаца и vf-box__heading
для h2 ?
Заранее спасибо!