admin管理员组文章数量:1122826
I created a plugin setting a $var to true if the post belongs to category 'a', and set the same $var to false if the post belongs to category 'b', it works and I can get the correct value depends on the category
what I need is to find a filter helps me to add an extra text to the entry-title
post class so I can change post title align or color if if the post category is a
without editing content.php file.
Here is the code:
function change_my_entry-title(){
if ($var === true){
return 'entry-title_cat_a';
}else{
return 'entry-title';
}
}
add_filter(' ..... ','change_my_entry-title');
So which filter_name
I should put instead of .....
I created a plugin setting a $var to true if the post belongs to category 'a', and set the same $var to false if the post belongs to category 'b', it works and I can get the correct value depends on the category
what I need is to find a filter helps me to add an extra text to the entry-title
post class so I can change post title align or color if if the post category is a
without editing content.php file.
Here is the code:
function change_my_entry-title(){
if ($var === true){
return 'entry-title_cat_a';
}else{
return 'entry-title';
}
}
add_filter(' ..... ','change_my_entry-title');
So which filter_name
I should put instead of .....
1 Answer
Reset to default 0The filter that allows you to tweak the title value is [wp_title][1]
. As mentioned by the commenters, the entry-title is a class pertaining to your theme.
If you need to set a class according to a certain value, try something like this in your template file:
<h1 class="<?php echo ($in_category_a) ? 'align-left': ''; ?>"><?php the_title();?></h1>
本文标签: pluginsWhich filter affects the 39entrytitle39 post class
版权声明:本文标题:plugins - Which filter affects the 'entry-title' post class 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736297755a1930079.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
entry-title
class added by WordPress core, it is likely part of theme markup. – Rarst Commented Sep 13, 2013 at 15:04grep
ed my dev install and the only place thatentry-title
appears is in Twenty Thirteen's markup. It is theme markup and it is hard coded. There is no filter. Perhaps your theme uses the same class name and there is a filter, but that is impossible to say without more information. – s_ha_dum Commented Sep 13, 2013 at 15:09