2017-04-09 35 views
0

我正在開發一個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/ –

回答

0
// 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

0

你可以使用「TinyMCE的先進」創造條件,在包裝一個div文本你想要的類自定義按鈕。 這tutorial可能會有所幫助。

相關問題