WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Website gone after changing code? (4 posts)

  1. Jane Milburn
    Member
    Posted 1 year ago #

    In trying to remove the search box from my home page in Twenty Eleven by deleting the following code from header.php, as adviced in this forum, my website vanished. roymilburn.com.

    <?php
    // Has the text been hidden?
    if ( 'blank' == get_header_textcolor() ) :
    	?>
    	<div class="only-search<?php if ( ! empty( $header_image ) ) : ?> with-image<?php endif; ?>">
    	<?php get_search_form(); ?>
    	</div>
    	<?php
    else :
    	?>
    	<?php get_search_form(); ?>
    <?php endif; ?>
    
    <?php
    				// Has the text been hidden?
    				if ( 'blank' == get_header_textcolor() ) :
    			?>

    I put the code back in but still no website. I am wondering if I put it back in the right place. Here I have pasted just a section of what is above and below the code. Is it in the right place? Many thanks for any help in advance.

    ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( $header_image_width, $header_image_width ) ) ) &&
    							$image[1] >= $header_image_width ) :
    						// Houston, we have a new header image!
    						echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
    					else :
    						// Compatibility with versions of WordPress prior to 3.4.
    						if ( function_exists( 'get_custom_header' ) ) {
    							$header_image_width  = get_custom_header()->width;
    							$header_image_height = get_custom_header()->height;
    						} else {
    							$header_image_width  = HEADER_IMAGE_WIDTH;
    							$header_image_height = HEADER_IMAGE_HEIGHT;
    						}
    						?>
    					<img src="<?php header_image(); ?>" width="<?php echo $header_image_width; ?>" height="<?php echo $header_image_height; ?>" alt="" />
    				<?php endif; // end check for featured image or standard header ?>
    
    			<?php endif; // end check for removed header image ?>
                            <?php
    // Has the text been hidden?
    if ( 'blank' == get_header_textcolor() ) :
    	?>
    	<div class="only-search<?php if ( ! empty( $header_image ) ) : ?> with-image<?php endif; ?>">
    	<?php get_search_form(); ?>
    	</div>
    	<?php
    else :
    	?>
    	<?php get_search_form(); ?>
    <?php endif; ?>
    
    <?php
    				// Has the text been hidden?
    				if ( 'blank' == get_header_textcolor() ) :
    			?>
    
    			<?php endif; // end check for removed header image ?>
    p _e( 'Main menu', 'twentyeleven' ); ?></h3>
    				<?php /* Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff. */ ?>
    				<div class="skip-link"><a href="#content">"><?php _e( 'Skip to primary content', 'twentyeleven' ); ?></a></div>
    				<div class="skip-link"><a href="#secondary">"><?php _e( 'Skip to secondary content', 'twentyeleven' ); ?></a></div>
    				<?php /* Our navigation menu. If one isn't filled out, wp_nav_menu falls back to wp_page_menu. The menu assigned to the primary location is the one used. If one isn't assigned, the menu with the lowest ID is used. */ ?>
    				<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
    			</nav><!-- #access -->
    	</header><!-- #branding -->
    
    	<div id="main">

    [Please be sure to use the backticks or code buttons for posting code - as is, it may have been damaged by the forum's parser.]

  2. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    Probably the best thing to do is to replace via FTP the damaged header.php file with a new copy from a download of the theme to your desktop.

  3. Jane Milburn
    Member
    Posted 1 year ago #

    This is very embarrassing as I had a similar problem last week which esmi and yourself helped me with, sorry. I will try your suggestion, many thanks

  4. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    No problem - these things happen :).

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.