请救救我!解析错误:语法错误,博客代码中出现意外的‘<’,不知道如何修复它!

时间:2016-02-01 作者:Collette

这是当前的代码:

<?php
//* Start the engine
include_once( get_template_directory() . \'/lib/init.php\' );


//* Enqueue scripts and styles
add_action( \'wp_enqueue_scripts\', \'ohwild_scripts_styles\' );
function ohwild_scripts_styles() {

    wp_enqueue_script( \'ohwild-responsive-menu\', esc_url( get_stylesheet_directory_uri() ) . \'/js/responsive-menu.js\', array( \'jquery\' ), \'1.0.0\' );
    wp_enqueue_style( \'dashicons\' );

}

//* Register responsive menu script
add_action( \'wp_enqueue_scripts\', \'ohwild_enqueue_scripts\' );
function ohwild_enqueue_scripts() {

    wp_enqueue_script( \'ohwild-responsive-menu\', get_stylesheet_directory_uri() . \'/js/responsive-menu.js\', array( \'jquery\' ), \'1.0.0\', true ); 

}


//* Child theme (do not remove)
define( \'CHILD_THEME_NAME\', \'cecilla\' );
define( \'CHILD_THEME_URL\', \'http://cecilla.ohwild.com\' );
define( \'CHILD_THEME_VERSION\', \'1.0\' );


//* Add HTML5 markup structure
add_theme_support( \'html5\', array( \'search-form\', \'comment-form\', \'comment-list\', \'gallery\', \'caption\' ) );

//* Move header & footer outside wrap
remove_action( \'genesis_footer\', \'genesis_do_footer\' ); 
add_action( \'genesis_after\', \'genesis_do_footer\' );

remove_action( \'genesis_header\', \'genesis_do_header\' );
add_action( \'genesis_before\', \'genesis_do_header\' );

//* Add viewport meta tag for mobile browsers
add_theme_support( \'genesis-responsive-viewport\' );

//* Add support for custom header
add_theme_support( \'custom-header\', array(
    \'width\'           => 750,
    \'height\'          => 110,
    \'flex-width\'      => false,
    \'flex-height\'     => false,
    \'header-selector\' => \'.site-title a\',
    \'header-text\'     => false,
) );

//* Add new image sizes
add_image_size( \'featured\', 230, 230, TRUE );

//* Remove the secondary sidebar
unregister_sidebar( \'sidebar-alt\' );

//* Unregister secondary navigation menu
add_theme_support( \'genesis-menus\', array( \'primary\' => __( \'Primary Navigation Menu\', \'genesis\' ) ) );

//* Remove site layouts
genesis_unregister_layout( \'content-sidebar-sidebar\' );
genesis_unregister_layout( \'sidebar-sidebar-content\' );
genesis_unregister_layout( \'sidebar-content-sidebar\' );
genesis_unregister_layout( \'content-sidebar\' );

//* force sidebar/content layout
add_filter( \'genesis_pre_get_option_site_layout\', \'child_do_layout\' );
function child_do_layout( $opt ) {
    { 
        $opt = \'sidebar-content\'; // You can change this to any Genesis layout
        return $opt;
    }
}

//* Remove the header right widget area
unregister_sidebar( \'header-right\' );

//* Customize the entry meta in the entry header
add_filter( \'genesis_post_info\', \'ohwild_entry_meta_header\' );
function ohwild_entry_meta_header( $post_info ) {

    $post_info = \'[post_date format="F j, Y"] [post_categories]\';
    return $post_info;


//* Move leave a comment link to bottom of post
add_filter( \'genesis_post_meta\', \'ohwild_entry_meta_footer\' );
function ohwild_entry_meta_footer( $post_meta ) {

    $post_meta = \'[post_comments zero="0" one="1" more="%"]\';
    return $post_meta;

}

//* Remove comment form allowed tags
add_filter( \'comment_form_defaults\', \'ohwild_remove_comment_form_allowed_tags\' );
function ohwild_remove_comment_form_allowed_tags( $defaults ) {

    $defaults[\'comment_field\'] = \'<p class="comment-form-comment"><label for="comment">\' . _x( \'Comment\', \'noun\', \'ohwild\' ) . \'</label> <textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>\';
    $defaults[\'comment_notes_after\'] = \'\';  

    return $defaults;

}

//* Modify the size of the Gravatar in the author box
add_filter( \'genesis_author_box_gravatar_size\', \'ohwild_author_box_gravatar\' );
function ohwild_author_box_gravatar( $size ) {

    return 175;

}

//* Modify the size of the Gravatar in the entry comments
add_filter( \'genesis_comment_list_args\', \'ohwild_comments_gravatar\' );
function ohwild_comments_gravatar( $args ) {

    $args[\'avatar_size\'] = 110;
    return $args;
}

//* Customize search form input box text
add_filter( \'genesis_search_text\', \'sp_search_text\' );
function sp_search_text( $text ) {
    return esc_attr( \'search + hit enter\' );
}

//* Remove footer widgets
remove_theme_support( \'genesis-footer-widgets\', 3 );

//* Add support for 1 footer widget
add_theme_support( \'genesis-footer-widgets\', 1 );



//* Hook featured posts
add_action( \'genesis_after_content_sidebar_wrap\', \'add_genesis_widget_area\' );
function add_genesis_widget_area() {
                genesis_widget_area( \'after-content-widget\', array(
        \'before\' => \'<div class="after-content-widget widget-area">\',
        \'after\'  => \'</div>\',
    ) );

}

genesis_register_sidebar( array(
    \'id\' => \'after-content-widget\',
    \'name\' => __( \'Featured Posts Widget\', \'ohwild\' ),
    \'description\' => __( \'This area will display after the content and above the footer. Display your popular posts here.\', \'ohwild\' ),
) );


// Display featured image on post and page
add_action( \'genesis_entry_content\', \'featured_post_image\', 8 );
function featured_post_image() {
  if ( !is_singular( array( \'post\', \'page\' ) ))  return;
    the_post_thumbnail(\'large\');
}

// Add Read More Link to Excerpts
add_filter(\'excerpt_more\', \'ohwild_get_read_more_link\');
add_filter( \'the_content_more_link\', \'ohwild_get_read_more_link\' );
function ohwild_get_read_more_link() {
   return \' <div class="read-more"><a href="\' . get_permalink() . \'">read more</a></div>\';
}


/**
* Remove Image Alignment from Featured Image
*
*/
function be_remove_image_alignment( $attributes ) {
$attributes[\'class\'] = str_replace( \'alignleft\', \'aligncenter\', $attributes[\'class\'] );
return $attributes;
}
add_filter( \'genesis_attr_entry-image\', \'be_remove_image_alignment\' );


//* Customize footer
remove_action( \'genesis_footer\', \'genesis_do_footer\' );
add_action( \'genesis_footer\', \'indiebirdie_custom_footer\' );
function indiebirdie_custom_footer() {
echo \'<div class="creds"><p>\';
echo \'All Rights Reserved &copy; \';
echo date(\'Y\');
echo \' / Site Designed by <a href="http://indiebirdie.com">Indie Birdie</a>\';
echo \'</p></div>\';
}
有人知道怎么修吗?我将不胜感激!

1 个回复
SO网友:david_nash

ohwild_entry_meta_header() 缺少结束}.