【发布时间】:2013-07-31 07:30:48
【问题描述】:
我需要显示自定义帖子模板名称。 实际上我想为每个自定义帖子模板加载不同的 css。 为此,我需要自定义帖子模板名称,但无论如何我都找不到。 这是我的目录结构。
index.php
single.php
header.php
footer.php
fullpage-post.php // This is custom template
two-column-right-menu-post.php
two-column-left-menu-post.php
现在在标题中我想要链接这个
if($custom_template->name == 'two-column-right-menu-post'){
?> <link href = 'style.php'> <?php
}else{
?> <link href = 'style1.php'> <?php
}
我怎样才能做到这一点。 google了一下,没找到解决办法。
【问题讨论】:
-
您想在页面上获取帖子详细信息或想从前端输入帖子
-
调用你可以使用的帖子 query_post('showposts');而(有_posts()):the_post(); the_title() 结束; wp_reset_query();
-
显示帖子不是问题,我将模板附加到特定帖子。如果附加了该模板,则在标题中我想要一个条件,加载属于该模板的特定样式表。
-
以这种方式包含您的样式表并在顶部 当您选择页面模板时,它将显示在管理员中
标签: wordpress wordpress-theming custom-post-type