开发者

Wordpress Search Results - Check for custom post type

开发者 https://www.devze.com 2023-01-22 16:56 出处:网络
I am using the custom post types in my wordpress blog and want to have a different icon for each type of post.

I am using the custom post types in my wordpress blog and want to have a different icon for each type of post.

<?php if ( is_post_type(开发者_开发知识库 'team' ) ) {
    echo '<img src="team.png" />';}
else
{
    echo '<img src="page.png" />';
}?>

But I get following error message: Fatal error: Call to undefined function is_post_type().

Any suggestions?


What version of WP are you using? Looks like is_post_type() was deprecated...

http://core.trac.wordpress.org/ticket/13747

You should probably use get_post_type() instead:

http://codex.wordpress.org/Function_Reference/get_post_type

0

精彩评论

暂无评论...
验证码 换一张
取 消