2013-01-25 25 views
0

我想知道如何定义一个职位模板,并在我们创建一个职位时自动添加HTML布局?WordPress的,建立一个职位的模板

我必须使用自定义字段吗?

例如:

帖子内容:

Title 
    Description 1 
    Description 2 
    With links and social media 

HTML布局的结果:

<h1 class="work-title">Title</h1> 
     <div class="description">Description 1</div> 
     <div class="description">Description 2</div> 
     <div class="details">With links and social media</div> 
    </div> 

感谢

+0

它总是在上面的格式?第一行是标题,第二和第三个是描述,最后是细节? –

+0

当我加入一个简单的帖子,这是HTML结果:

标题

说明1

说明2

社会

看,我想它是什么在这里

但要知道是否必须使用Jquerry函数来替换这些标签,或者如果有更好的方法/一个功能/插件允许我在wordpress仪表板中执行此操作? – Romain

回答

0

你可以通过改变功能the_content()的输出(以functions.php)类似于:

function alter_content($content) { 
    // Alter the $content variable here 
    return $content; 
} 

add_filter('the_content', 'alter_content', 6); 

这将在添加段落之前更改内容。如果你完全不想要使用段落:

remove_filter('the_content', 'wpautop'); 

退房the codex page on apply_filters()有关功能的更多信息。

相关问题