更改wordpress自定义帖子类型的主题

时间:2014-02-23 18:08:21

标签: php wordpress plugins

我创建了一个插件来更改要加载的主题,如果你转到自定义帖子类型但是不起作用,因为get_post_type()在我的插件中不起作用

<?php
/*
 * Plugin Name: Theme post type
 * Plugin URI: ...
 * Description: ...
 * Author: ...
 * Author URI: ...
 * Version: 1.0
 */


        add_filter('template','use_posttype_custom');
        add_filter('stylesheet','use_posttype_custom');

    function use_posttype_custom($themename) {

        if(get_post_type()=='blog'){ return 'new_name'; }else{ return $themename; }
    }

?>

0 个答案:

没有答案
相关问题