是否可以向内容元素添加类?

问题描述:

我正在开发一个Wordpress主题。要显示的内容我用是否可以向内容元素添加类?

while (have_posts()) : the_post(); 
    the_content(); 
endwhile; 

这一点,因为你知道,显示的内容类似HTML的

<h1>Title<h1> 
<p>Lorem Ipsum</p> 

等是否有可能使WordPress的添加类这些内容元素,甚至这些包裹像

<h1 class="col-sm-12">Title<h1> 
<p class="col-sm-8">Lorem Ipsum</p> 

<div class="col-sm-12"> 
    <h1>Title<h1> 
</div> 
<div class="col-sm-8"> 
    <p>Lorem Ipsum</p> 
</div> 
元件分别是

+0

我见过一些基于bootstrap的插件,它可以帮助您在添加内容时添加类或在后端的列中包装内容。 它可能会帮助你: https://wordpress.org/plugins/galau-ui-visual-editor/ –

// you can do this like this 
<?php while (have_posts()) : the_post(); ?> 
    <div class="col-sm-12"> 
     <h1><?php the_title() ?><h1> 
    </div> 
    <div class="col-sm-8"> 
     <?php the_content() ?> 
    </div> 
    <?php endwhile; ?> 
+0

对不起,我的意思是包装由'the_content'返回的元素 – Lukas

你可以使用“TinyMCE的先进”创造条件,在包装一个div文本你想要的类自定义按钮。 这tutorial可能会有所帮助。