【问题标题】:add_filter( 'single_template' ... not working although used correctly?add_filter( 'single_template' ...虽然使用正确但不起作用?
【发布时间】:2014-06-21 09:26:48
【问题描述】:

我正在使用 WPMU(如果这很重要),但据我所知,插件应该可以正常工作......应该适用通常的规则。

我尝试使用过滤器add_filter( 'single_template', 'ss_get_stock_image_template' );,但它没有被调用。这里有什么地方做错了吗?

function ss_get_stock_image_template($single_template) {
    global $post;

    if ($post->post_type == 'image') {
        $single_template = ss_img_lib. 'single-image.php';      

    }
    return $single_template;
}

add_filter( 'single_template', 'ss_get_stock_image_template' );

【问题讨论】:

    标签: wordpress plugins filter wpmu


    【解决方案1】:

    令我惊讶的是,在我的自定义帖子类型声明中更改 menu_position 修复了它...哇...

    【讨论】:

      猜你喜欢
      • 2012-10-13
      • 1970-01-01
      • 1970-01-01
      • 2011-11-15
      • 2023-04-01
      • 1970-01-01
      相关资源
      最近更新 更多