移动Wordpress目录后解析错误

时间:2014-06-20 19:02:34

标签: php wordpress database-migration

我一直在/ new子目录中的wordpress网站上工作,并按照Wordpress中的步骤将其迁移到根目录。在第8步之后,由于出现错误消息,我甚至无法使用yourdomain.com/wp-login.php登录。我从主机的控制面板上重新安装了Wordpress并恢复了数据库,然后将wp-config.php更改为指向新恢复的数据库,但我仍然遇到同样的错误。

  

解析错误:语法错误, /home/content/92/8835692/html/wp-content/themes/venda/inc/posttypes/portfolio.php中的意外T_ENDIF 在线 227

在检查该文件时,没有什么特别突出的问题,因为我在服务器上用主题中的原始文件替换了它,但仍然无效。

以下是错误消息中的文档:

<?php
add_action('init', 'portfolio_init');
/* SECTION - project_custom_init */

function portfolio_init() {
    $labels = array(
        'name' => _x('Projects', 'post type general name', 'asalah'),
        'singular_name' => _x('Project', 'post type singular name', 'asalah'),
        'add_new' => _x('Add New', 'project', 'asalah'),
        'add_new_item' => __('Add New Project', 'asalah'),
        'edit_item' => __('Edit Project', 'asalah'),
        'new_item' => __('New Project', 'asalah'),
        'view_item' => __('View Project', 'asalah'),
        'search_items' => __('Search Projects', 'asalah'),
        'not_found' => __('No projects found', 'asalah'),
        'not_found_in_trash' => __('No projects found in Trash', 'asalah'),
        'parent_item_colon' => '',
        'menu_name' => 'Portfolio'
    );
    // Some arguments and in the last line 'supports', we say to WordPress what features are supported on the Project post type  
    $args = array(
        'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'show_ui' => true,
        'show_in_menu' => true,
        'query_var' => true,
        'rewrite' => true,
        'capability_type' => 'post',
        'exclude_from_search' => true,
        'has_archive' => true,
        'hierarchical' => false,
        'menu_position' => null,
        'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'revisions', 'post-formats')
    );
    // We call this function to register the custom post type  
    register_post_type('project', $args);

    $labels = array(
        'name' => _x('Tags', 'taxonomy general name', 'asalah'),
        'singular_name' => _x('Tag', 'taxonomy singular name', 'asalah'),
        'search_items' => __('Search Types', 'asalah'),
        'all_items' => __('All Tags', 'asalah'),
        'parent_item' => __('Parent Tag', 'asalah'),
        'parent_item_colon' => __('Parent Tag:', 'asalah'),
        'edit_item' => __('Edit Tags', 'asalah'),
        'update_item' => __('Update Tag', 'asalah'),
        'add_new_item' => __('Add New Tag', 'asalah'),
        'new_item_name' => __('New Tag Name', 'asalah'),
    );
    // Register Custom Taxonomy  
    register_taxonomy('tagportfolio', array('project'), array(
        'hierarchical' => true, // define whether to use a system like tags or categories  
        'labels' => $labels,
        'show_ui' => true,
        'query_var' => true,
        'rewrite' => array('slug' => 'tag-portfolio'),
    ));
}

/* --- Custom Messages - project_updated_messages --- */
add_filter('post_updated_messages', 'project_updated_messages');

function project_updated_messages($messages) {
    global $post, $post_ID;
    $messages['project'] = array(
        0 => '', // Unused. Messages start at index 1.  
        1 => sprintf(__('Project updated. <a href="%s">View project</a>'), esc_url(get_permalink($post_ID))),
        2 => __('Custom field updated.', 'asalah'),
        3 => __('Custom field deleted.', 'asalah'),
        4 => __('Project updated.', 'asalah'),
        /* translators: %s: date and time of the revision */
        5 => isset($_GET['revision']) ? sprintf(__('Project restored to revision from %s', 'asalah'), wp_post_revision_title((int) $_GET['revision'], false)) : false,
        6 => sprintf(__('Project published. <a href="%s">View project</a>'), esc_url(get_permalink($post_ID))),
        7 => __('Project saved.', 'asalah'),
        8 => sprintf(__('Project submitted. <a target="_blank" href="%s">Preview project</a>'), esc_url(add_query_arg('preview', 'true', get_permalink($post_ID)))),
        9 => sprintf(__('Project scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview project</a>'),
                // translators: Publish box date format, see http://php.net/date  
                date_i18n(__('M j, Y @ G:i', 'asalah'), strtotime($post->post_date)), esc_url(get_permalink($post_ID))),
        10 => sprintf(__('Project draft updated. <a target="_blank" href="%s">Preview project</a>'), esc_url(add_query_arg('preview', 'true', get_permalink($post_ID)))),
    );
    return $messages;
}

/* --- #end SECTION - project_updated_messages --- */

function project_url() {
    global $post;
    $url = get_post_meta($post->ID, 'project_url', true);
    if ($url) {
        ?>
        <a href="<?php echo $url; ?>" target="_blank">Live Preview →</a>
        <?php
    }
}

function asalah_portfolio_tag() {
    global $post;
    $terms = get_the_terms($post->ID, 'tagportfolio');
    if ($terms && !is_wp_error($terms)) :
        $links = array();
        foreach ($terms as $term) {
            $links[] = "portfoliotagfilter-" . $term->name;
        }
        $links = str_replace(' ', '-', $links);
        $tax = join(" ", $links);
    else :
        $tax = '';
    endif;
    return strtolower($tax);
}

function asalah_portfolio_tag_list() {

    global $post;
    $terms = get_the_terms($post->ID, 'tagportfolio');
    $count = count($terms);

    if ($terms) {
        foreach ($terms as $term) {
            $termname = strtolower($term->name);
            echo '<span>'.$termname.'</span>';
        }
    }
}


function asalah_return_portfolio_tag_list() {
    $output = '';
    global $post;
    $terms = get_the_terms($post->ID, 'tagportfolio');
    $count = count($terms);

    if ($terms) {
        foreach ($terms as $term) {
            $termname = strtolower($term->name);
            $output .= '<span>'.$termname.'</span>';
        }
    }

    return $output;
}

function asalah_portfolio_tag_list_filter() {
    $terms = get_terms("tagportfolio");  
    $count = count($terms); 

    echo '<ul>';  
    echo '<li><a class="selected" href="#" data-filter="*">';
    _e('Show All', 'asalah');
    echo '</a></li>';  
        if ( $count > 0 )  
        {  
            foreach ( $terms as $term ) {
                $termname = strtolower($term->name);  
                $termname = str_replace(' ', '-', $termname);
                $termname =  "portfoliotagfilter-".$termname;   
                echo '<li><a href="#" data-filter=".'.$termname.'">'.$term->name.'</a></li>'; 
            }  
        }  
    echo "</ul>";
}

function asalah_portfolio_tag_list_url() {
    $terms = get_terms("tagportfolio");
    $count = count($terms);

    echo '<ul>';
    if (asalah_option('asalah_portfolio_url')) {
        echo '<li><a class="filter_link_visit" href="'.asalah_option('asalah_portfolio_url').'">Show all</a></li>';
    }
    if ($count > 0) {
        foreach ($terms as $term) {
            $term_link = get_term_link($term, 'species');
            $termname = strtolower($term->name);
            $termname = str_replace(' ', '-', $termname);
            $termname = "portfoliotagfilter-" . $termname;
            echo '<li><a class="filter_link_visit" href="' . $term_link . '" >' . $term->name . '</a></li>';
        }
    }
    echo "</ul>";
}

function asalah_return_portfolio_tag_list_url() {
    $terms = get_terms("tagportfolio");
    $count = count($terms);
    $output = '';

    $output .= '<ul>';
    $output .= '<li><a class="filter_link" href="#filter" rel="*">show all</a></li>';
    if ($count > 0) {
        foreach ($terms as $term) {
            $termname = strtolower($term->name);
            $termname = str_replace(' ', '-', $termname);
            $termname = "portfoliotagfilter-" . $termname;
            $output .= '<li><a class="filter_link" href="#filter" rel="' . $termname . '">' . $term->name . '</a></li>';
        }
    }
    $output .= "</ul>";

    return $output;
}


function asalah_return_portfolio_fullwidth_carousel($title, $num = "6", $url = "", $button = "", $orderby = 'date', $tags = '', $exclude = '', $car_id = '') {


    global $post;
    ?>
    <?php
    $args = array('post_type' => 'project', 'posts_per_page' => $num, 'orderby' => $orderby);

    if ($exclude == '') {
        $args = array('post_type' => 'project', 'posts_per_page' => $num, 'orderby' => $orderby);
    } else {
        $args = array('post_type' => 'project', 'posts_per_page' => $num, 'orderby' => $orderby, 'post__not_in' => array($exclude));
    }

    if ($tags != '') {
        $args['tagportfolio'] = $tags;
    }
    $wp_query = new WP_Query($args);
    ?>
    <?php
    // use $post num to count the current post in the row
    // and use $intros to posts details to array and use it to output intros
    // after 3 posts alrady returned
    $postnum = 0;
    $intros = array();
    $output = '';
    if ($wp_query->have_posts()) :

        $output .= '<div class="big-title text-center">';
            $output .= '<h1>'.$title.'</h1>';
        $output .= '</div>';

        $output .= '<div class="full-width-recent-projects"><div class="projects-carousel touch-carousel navigation-3">'; ?>
        <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
            <?php
            $output .= '<div class="portfolio-item item"><div class="portfolio-border">';


                //get_the_post_thumbnail($post->ID, "portfolio", array('class' => 'portfolio_thumbnail'));
                $image_url = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
                /* Start Project Thumb */
                $output .= '<div class="portfolio-thumb">';
                    $output .= asalah_projects_thumbnail();
                $output .= '</div>';
                /* End Project Thumb */

                /* Start Project Details */
                $output .= '<div class="portfolio-details">';
                    $output .= '<a href="'. get_permalink() .'">';
                        $output .= '<h4>'.get_the_title().'</h4>';
                        $output .= asalah_return_portfolio_tag_list();
                    $output .= '</a>';
                    if( function_exists('get_zilla_likes') ) {
                        $output .= get_zilla_likes();
                    }
                $output .= '</div>';
                /* End Project Details */


            $output .= '</div></div>'; // end portfolio-item and portfolio-border
            ?>
        <?php endwhile; ?>

        <?php $output .= '</div></div>'; // end full-width-recent-projects and projects-carousel touch-carousel navigation-3 ?>
        <?php
        if ($url && $button) {
            $output .= '<div class="hr1" style="margin-bottom:35px;"></div>';
            $output .= '<div class="text-center"><a href="'.$url.'" class="btn-system btn-large border-btn"><i class="icon-brush"></i> '.$button.'</a></div>';
        }
        ?>

    <?php endif; ?>
    <?php
    return $output;
}


function asalah_return_portfolio_standard_carousel($title, $num = "6", $url = "", $button = "", $orderby = 'date', $tags = '', $exclude = '', $car_id = '') {


    global $post;
    ?>
    <?php
    $args = array('post_type' => 'project', 'posts_per_page' => $num, 'orderby' => $orderby);

    if ($exclude == '') {
        $args = array('post_type' => 'project', 'posts_per_page' => $num, 'orderby' => $orderby);
    } else {
        $args = array('post_type' => 'project', 'posts_per_page' => $num, 'orderby' => $orderby, 'post__not_in' => array($exclude));
    }

    if ($tags != '') {
        $args['tagportfolio'] = $tags;
    }
    $wp_query = new WP_Query($args);
    ?>
    <?php
    // use $post num to count the current post in the row
    // and use $intros to posts details to array and use it to output intros
    // after 3 posts alrady returned
    $postnum = 0;
    $intros = array();
    $output = '';
    if ($wp_query->have_posts()) :

        $output .= '<div class="recent-projects">';
        $output .= '<h4 class="title"><span>'.$title.'</span></h4>';
        $output .= '<div class="projects-carousel touch-carousel">'; ?>
        <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
            <?php
            $output .= '<div class="portfolio-item item"><div class="portfolio-border">';


                //get_the_post_thumbnail($post->ID, "portfolio", array('class' => 'portfolio_thumbnail'));
                $image_url = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
                /* Start Project Thumb */
                $output .= '<div class="portfolio-thumb">';
                    $output .= asalah_projects_thumbnail();
                $output .= '</div>';
                /* End Project Thumb */

                /* Start Project Details */
                $output .= '<div class="portfolio-details">';
                    $output .= '<a href="'. get_permalink() .'">';
                        $output .= '<h4>'.get_the_title().'</h4>';
                        $output .= asalah_return_portfolio_tag_list();
                    $output .= '</a>';
                    if( function_exists('get_zilla_likes') ) {
                        $output .= get_zilla_likes();
                    }
                $output .= '</div>';
                /* End Project Details */


            $output .= '</div></div>'; // end portfolio-item and portfolio-border
            ?>
        <?php endwhile; ?>

        <?php $output .= '</div></div>'; // end recent-projects and projects-carousel touch-carousel ?>
        <?php
        if ($url && $button) {
            $output .= '<div class="hr1" style="margin-bottom:35px;"></div>';
            $output .= '<div class="text-center"><a href="'.$url.'" class="btn-system btn-large border-btn"><i class="icon-brush"></i> '.$button.'</a></div>';
        }
        ?>

    <?php endif; ?>
    <?php
    return $output;
}



function asalah_return_portfolio_modern_carousel($title, $num = "6", $url = "", $button = "", $orderby = 'date', $tags = '', $exclude = '', $car_id = '') {


    global $post;
    ?>
    <?php
    $args = array('post_type' => 'project', 'posts_per_page' => $num, 'orderby' => $orderby);

    if ($exclude == '') {
        $args = array('post_type' => 'project', 'posts_per_page' => $num, 'orderby' => $orderby);
    } else {
        $args = array('post_type' => 'project', 'posts_per_page' => $num, 'orderby' => $orderby, 'post__not_in' => array($exclude));
    }

    if ($tags != '') {
        $args['tagportfolio'] = $tags;
    }
    $wp_query = new WP_Query($args);
    ?>
    <?php
    // use $post num to count the current post in the row
    // and use $intros to posts details to array and use it to output intros
    // after 3 posts alrady returned
    $postnum = 0;
    $intros = array();
    $output = '';
    if ($wp_query->have_posts()) :

        $output .= '<div class="big-title text-center">';
            $output .= '<h1>'.$title.'</h1>';
        $output .= '</div>';

        $output .= '<div class="recent-projects"><div class="projects-carousel touch-carousel navigation-3">'; ?>
        <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
            <?php
            $output .= '<div class="portfolio-item item"><div class="portfolio-border">';


                //get_the_post_thumbnail($post->ID, "portfolio", array('class' => 'portfolio_thumbnail'));
                $image_url = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
                /* Start Project Thumb */
                $output .= '<div class="portfolio-thumb">';
                    $output .= asalah_projects_thumbnail();
                $output .= '</div>';
                /* End Project Thumb */

                /* Start Project Details */
                $output .= '<div class="portfolio-details">';
                    $output .= '<a href="'. get_permalink() .'">';
                        $output .= '<h4>'.get_the_title().'</h4>';
                        $output .= asalah_return_portfolio_tag_list();
                    $output .= '</a>';
                    if( function_exists('get_zilla_likes') ) {
                        $output .= get_zilla_likes();
                    }
                $output .= '</div>';
                /* End Project Details */


            $output .= '</div></div>'; // end portfolio-item and portfolio-border
            ?>
        <?php endwhile; ?>

        <?php $output .= '</div></div>'; // end full-width-recent-projects and projects-carousel touch-carousel navigation-3 ?>
        <?php
        if ($url && $button) {
            $output .= '<div class="hr1" style="margin-bottom:35px;"></div>';
            $output .= '<div class="text-center"><a href="'.$url.'" class="btn-system btn-large border-btn"><i class="icon-brush"></i> '.$button.'</a></div>';
        }
        ?>

    <?php endif; ?>
    <?php
    return $output;
}

?>

0 个答案:

没有答案