Wordpress模板 - “可捕获的致命错误:类__PHP_Incomplete_Class的对象无法转换为字符串”

时间:2012-11-07 06:06:01

标签: php wordpress

我正在使用最新版本的Wordpress,在撰写新帖子时,我发现以下错误代替了位于书写区域下方的可选框:

  

捕获致命错误:类__PHP_Incomplete_Class的对象可以   不能转换成字符串   /home/xxx/public_html/wp-content/themes/xxx/functions/meta-boxes.php   在第466行

我已经粘贴了以下从meta-boxes.php

获取的问题代码

另外,下面,我对第466行代码发表了评论,让您知道错误在哪里:

 <?php  
    // get review-specific meta fields
    global $oswcPostTypes; 
    $postTypeId = get_post_type( $post->ID );   
    $postType = $oswcPostTypes->get_type_by_id($postTypeId);
    $meta_fields = $postType->meta_fields;
    foreach($meta_fields as $meta){
        //make backwards compatible
        if(is_object($meta)){
            $metaName = $meta->name;
        }else{
            $metaName = $meta;
        }
        $metaNameSafe = str_replace(" ","_",$metaName); // **466th line of error**
        $theMeta = get_post_meta($post->ID, $metaName, $single = true); ?>      
        <p>
        <label for="<?php echo $metaNameSafe; ?>"><?php echo $metaName; ?></label> </td>
        <textarea class="widefat" id="<?php echo $metaNameSafe; ?>" name="<?php echo $metaNameSafe; ?>"><?php echo $theMeta; ?></textarea>
        </p>

    <?php 

0 个答案:

没有答案