• Resolved celticmaverick

    (@celticmaverick)


    https://www.celticmaverick.com

    Was putting in code to install a favicon … and something went wrong – getting this message:

    Parse error: syntax error, unexpected T_ENDIF in /content/Hosting/c/e/celticmaverick.com/web/wp-content/themes/twentyten/header.php on line 1

    This is the code in header.php in Twenty Ten – it all got clustered together somehow as well when I open it in Notepad – although it prints out ok below.: Thanks.

    <?php/** * The Header for our theme. * * Displays all of the <head> section and everything up till <div id=”main”> * *

    @package WordPress * @subpackage Twenty_Ten * @since Twenty Ten 1.0 */?><!DOCTYPE html><html <?php language_attributes(); ?

    >><head><title><?php /* * Print the <title> tag based on what is being viewed. */ global $page, $paged;

    wp_title( ‘|’, true, ‘right’ ); // Add the blog name. bloginfo( ‘name’ ); // Add the blog description for the

    home/front page. $site_description = get_bloginfo( ‘description’, ‘display’ ); if ( $site_description && ( is_home()

    || is_front_page() ) ) echo ” | $site_description”; // Add a page number if necessary: if ( $paged >= 2 ||

    $page >= 2 ) echo ‘ | ‘ . sprintf( __( ‘Page %s’, ‘twentyten’ ), max( $paged, $page ) ); ?></title><link

    rel=”profile” href=”https://gmpg.org/xfn/11&#8243; /><link rel=”stylesheet” type=”text/css” media=”all” href=”<?php bloginfo(

    ‘stylesheet_url’ ); ?>” /><link rel=”pingback” href=”<?php bloginfo( ‘pingback_url’ ); ?>” /><?php /* We add some

    JavaScript to pages with the comment form * to support sites with threaded comments (when in use). */ if (

    is_singular() && get_option( ‘thread_comments’ ) ) wp_enqueue_script( ‘comment-reply’ ); /* Always have

    wp_head() just before the closing </head> * tag of your theme, or you will break many plugins, which * generally

    use this hook to add elements to <head> such * as styles, scripts, and meta tags. */ wp_head();?></head><body <?

    php body_class(); ?>><div id=”wrapper” class=”hfeed”> <div id=”header”> <div id=”masthead”>

    <div id=”branding” role=”banner”> <?php $heading_tag = ( is_home() || is_front_page() ) ? ‘h1’

    : ‘div’; ?> <<?php echo $heading_tag; ?> id=”site-title”>

    <span> ” title=”<?php echo esc_attr(

    get_bloginfo( ‘name’, ‘display’ ) ); ?>” rel=”home”><?php bloginfo( ‘name’ ); ?>

    </span> </<?php echo $heading_tag; ?>> <div id=”site-description”><?php

    bloginfo( ‘description’ ); ?></div> <?php // Check if this is a

    post or page, if it has a thumbnail, and if it’s a big one if ( is_singular() &&

    has_post_thumbnail( $post->ID ) &&

    ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘post-thumbnail’ ) )

    && $image[1] >= HEADER_IMAGE_WIDTH ) :

    // Houston, we have a new header image! echo get_the_post_thumbnail( $post-

    >ID, ‘post-thumbnail’ ); else : ?> <img

    src=”<?php header_image(); ?>” width=”<?php echo HEADER_IMAGE_WIDTH; ?>” height=”<?php echo HEADER_IMAGE_HEIGHT; ?>” alt=””

    /> <?php endif; ?> </div><!– #branding –> <div

    id=”access” role=”navigation”> <?php /* Allow screen readers / text browsers to skip the navigation menu

    and get right to the good stuff */ ?> <div class=”skip-link screen-reader-text”><a href=”#content”

    title=”<?php esc_attr_e( ‘Skip to content’, ‘twentyten’ ); ?>”><?php _e( ‘Skip to content’, ‘twentyten’ ); ?></div>

    <?php /* Our navigation menu. If one isn’t filled out, wp_nav_menu falls back to wp_page_menu. The menu

    assiged to the primary position is the one used. If none is assigned, the menu with the lowest ID is used. */ ?>

    <?php wp_nav_menu( array( ‘container_class’ => ‘menu-header’, ‘theme_location’ => ‘primary’ ) ); ?>

    </div><!– #access –> </div><!– #masthead –> </div><!– #header –> <div id=”main”>

Viewing 6 replies - 1 through 6 (of 6 total)
  • Download the theme again and add the change again to a new header.php.

    Use one of the free syntax editors or notepad.

    There should be a ‘cr’ line break like below so something is broke.

    <?php
    /** * The Header for our theme. *

    Have a look at doing your development changes using a child theme and a local environment, here is a post on getting started with twenty ten child themes, and a few other tutorials you may like.

    Then you can test your changes before uploading to your live website.

    Fixing the Error
    To fix the error you have now you will need ftp, download twenty ten, upload and overwrite the header.php file in your themes folder.

    HTH

    David

    Thread Starter celticmaverick

    (@celticmaverick)

    Thanks adeptris – everything was working perfectly – must have pressed a wrong key somewhere.

    Yes, somebody else suggested child themes – so I will check that out.

    Hate to have to download it again – does this mean that I am starting from scratch? Lucky I only have one page LOL – And finally, do I need to un-install the theme I have (Twenty Ten) .. I only have that one … and it is all I ever intend to have as I want a simple, clean site. Thanks again.

    Hi Celticmaverick,

    The link above is just to the theme, you would copy down your changed files, replace then with the clean twenty ten files, create your chile theme, add your changed files, upload and activate.

    Child Themes are so easy, you add a style.css with a few lines with a reference to the parents style.css, add a screenshot image to the child theme folder and you are set.

    Any style changes you add to the child themes style.css get priority over the parent.

    Using you example you would copy the header.php from the parent to the child theme folder, and edit that file this would be loaded by WordPress and not the parents.

    Here is an Overview of reasons to use a child theme.

    Creating a local development environment is also not hard, using a package like WAMP, which has all the applications required to have a local WordPress on the Windows Platform.

    Walk Though
    So for your theme,
    1. Create a folder for your child theme.
    2. Create an empty file style.css.
    3. Add this code to the new file changing the URI links to your website.

    /*
    Theme Name: Twenty Ten Celtic Maverick
    Description: A WordPress 3 child theme by Celtic Maverick.
    Theme URI: http: //example.com/
    Author: Celtic Maverick
    Author URI: http: //example.com/about/
    Template: twentyten
    */
    
    @import url('../twentyten/style.css');
    
    /* IMPORTANT: Only add new Styles Below This Line */

    4. Add any new styles or Style Changes ‘Below the Line’
    5. Copy the screenshot.png from the parent folder to the child.
    6. Add your changed files (header.php) to the Child folder
    7. Upload and Activate

    You will then have a non destructive theme!

    If this topic is resolved mark it as resolved please!

    Hope this is clearer, not as daunting or such a black art as people think.

    David

    Thread Starter celticmaverick

    (@celticmaverick)

    David – Thanks a million for taking the time with that super reply – I will definitely learn Child Themes.

    New to WordPress – so can you clarify this please … just so that I get the site back before moving to Child themes.

    the error you have now you will need ftp, download twenty ten, upload and overwrite the header.php file in your themes folder.

    HTH

    David

    I have Filezilla ok.

    Looks like I only need a new version of header.php?

    Am I supposed to download Twenty Ten from someplace with Filezilla by ftp – or do I just re-install Twenty Ten from inside the wp-admin dashboard? Thank you.

    Move you changed files down to your PC, then re-install the twenty ten theme, through admin or by ftp, if you have only edited the header.php then you can just ftp the one file from a local download.

    Create the child theme and ftp the new folder to /wp-content/themes/, activate and enjoy.

    Now if you were to break a theme and get ‘locked out’, just use ftp and remove the theme folder, and when you visit WordPress it will re-instate ‘twenty ten’ so you can login and switch themes.

    Local testing will limit these type of situations, as testing local means you can live edit files and recover easy.

    David

    Thread Starter celticmaverick

    (@celticmaverick)

    Many Thanks again David – got the site back – off now to study child themes. Issue resolved.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Error message – site not loading’ is closed to new replies.