admin管理员组文章数量:1023263
I am using this syntax to remove excerpts on Custom Taxonomy archive listings and it works great:
add_filter( 'excerpt_length','remove_excerpt', 1000 );
function remove_excerpt( $length )
{
if ( is_tax('country') ) {
return 0;
}
return $length;
}
However, I also have two other Custom Taxomoies....
Is this correct to add the other two like this?
add_filter( 'excerpt_length','remove_excerpt', 1000 );
function remove_excerpt( $length )
{
if ( is_tax('country') ) {
return 0;
}
elseif ( is_tax('us_state') ) {
return 0;
}
elseif ( is_tax('cities') ) {
return 0;
}
return $length;
}
I want the same result for all three...
Just want to make sure I am doing it correctly.
Thanks
I am using this syntax to remove excerpts on Custom Taxonomy archive listings and it works great:
add_filter( 'excerpt_length','remove_excerpt', 1000 );
function remove_excerpt( $length )
{
if ( is_tax('country') ) {
return 0;
}
return $length;
}
However, I also have two other Custom Taxomoies....
Is this correct to add the other two like this?
add_filter( 'excerpt_length','remove_excerpt', 1000 );
function remove_excerpt( $length )
{
if ( is_tax('country') ) {
return 0;
}
elseif ( is_tax('us_state') ) {
return 0;
}
elseif ( is_tax('cities') ) {
return 0;
}
return $length;
}
I want the same result for all three...
Just want to make sure I am doing it correctly.
Thanks
Share Improve this question edited May 11, 2019 at 0:02 fuxia♦ 107k39 gold badges255 silver badges459 bronze badges asked May 10, 2019 at 23:53 HenryHenry 9831 gold badge8 silver badges31 bronze badges 1- * I tested it and it works fine. I just want to be sure and learn. Thanks – Henry Commented May 10, 2019 at 23:58
1 Answer
Reset to default 1I believe you can also pass an array to is_tax
:
if(is_tax(array('country', 'us_state', 'cities')) {
return 0;
}
Give that a try, but otherwise what you have is fine.
I am using this syntax to remove excerpts on Custom Taxonomy archive listings and it works great:
add_filter( 'excerpt_length','remove_excerpt', 1000 );
function remove_excerpt( $length )
{
if ( is_tax('country') ) {
return 0;
}
return $length;
}
However, I also have two other Custom Taxomoies....
Is this correct to add the other two like this?
add_filter( 'excerpt_length','remove_excerpt', 1000 );
function remove_excerpt( $length )
{
if ( is_tax('country') ) {
return 0;
}
elseif ( is_tax('us_state') ) {
return 0;
}
elseif ( is_tax('cities') ) {
return 0;
}
return $length;
}
I want the same result for all three...
Just want to make sure I am doing it correctly.
Thanks
I am using this syntax to remove excerpts on Custom Taxonomy archive listings and it works great:
add_filter( 'excerpt_length','remove_excerpt', 1000 );
function remove_excerpt( $length )
{
if ( is_tax('country') ) {
return 0;
}
return $length;
}
However, I also have two other Custom Taxomoies....
Is this correct to add the other two like this?
add_filter( 'excerpt_length','remove_excerpt', 1000 );
function remove_excerpt( $length )
{
if ( is_tax('country') ) {
return 0;
}
elseif ( is_tax('us_state') ) {
return 0;
}
elseif ( is_tax('cities') ) {
return 0;
}
return $length;
}
I want the same result for all three...
Just want to make sure I am doing it correctly.
Thanks
Share Improve this question edited May 11, 2019 at 0:02 fuxia♦ 107k39 gold badges255 silver badges459 bronze badges asked May 10, 2019 at 23:53 HenryHenry 9831 gold badge8 silver badges31 bronze badges 1- * I tested it and it works fine. I just want to be sure and learn. Thanks – Henry Commented May 10, 2019 at 23:58
1 Answer
Reset to default 1I believe you can also pass an array to is_tax
:
if(is_tax(array('country', 'us_state', 'cities')) {
return 0;
}
Give that a try, but otherwise what you have is fine.
本文标签: Can I add other Custom Taxonomy to my syntax (functionsphp)
版权声明:本文标题:Can I add other Custom Taxonomy to my syntax (functions.php) 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745503677a2153507.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论