Support » Themes and Templates » Remove functions in child theme

  • Hi there,

    I am using the twenty twelve theme and a new update is available, as is WP 3.5.
    Before making these updates I have made some changes to my original theme files. Now I know that I should not have done this, but at the time of doing it I was very new to css and php editing, so I did what I needed to do and it works well. However we now have the update. Fortunately I kept a list of changes that I made to the files and I want to make a child of the twenty twelve theme.

    I understand that I make a folder with “twentytwelve-child” for example and drop in the header text for this file and the import rule. However there are some instances where I have made some changes that I need some help with:

    1: I have taken some code out of custom-header.php and put it into styles.css as shown below

    <?php
    		// Has the text been hidden?
    		if ( ! display_header_text() ) :
    	?>
    		.site-title,
    		.site-description {
    			position: absolute !important;
    			clip: rect(1px 1px 1px 1px); /* IE7 */
    			clip: rect(1px, 1px, 1px, 1px);
    		}
    	<?php
    		// If the user has set a custom color for the text, use that.
    		else :
    	?>
    		.site-title a,
    		.site-description {
    			color: #<?php echo $text_color; ?> !important;
    		}
    	<?php endif; ?>

    2: Deleted some code from header.php:

    <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
    			<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>

    replacing with other code, as shown below:

    <?php if (is_front_page()) { ?>
            <h1 id="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
            <h2 id="site-description"><?php bloginfo( 'description' ); ?></h2>
      <?php } else { ?>
            <h2 id="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h2>
            <h3 id="site-description"><?php bloginfo( 'description' ); ?></h3>
      <?php } ?>

    3: I have removed the following from content-page.php:
    <h1 class="entry-title"><?php the_title(); ?></h1>
    and replaced it with:

    <?php if (is_front_page() ) : ?>
    			<h2 class="entry-title"><?php the_title(); ?></h2>
    			<?php else : ?>
    			<h1 class="entry-title"><?php the_title(); ?></h1>
    			<?php endif; // is_front_page() ?>

    4: In contents.php I have changed heading tags from H2 to H3
    5: I have also added some code to the header.php

    I know this list is a bit long, but it summarizes my issues quite well I think.

    Do I just have to copy the php files and drop them into the child folder? I am sure this will work, but due to the amount of php files that I am going to have to copy across I am worried about conflicts that may arise with the new updates of themes and WP itself. If that is the answer well then fine, however how to I attend to point 1?

    Thanks in advance for all of your help, it is much appreciated.

    Jamie
    E Advanced Healthcare

Viewing 1 replies (of 1 total)
  • Yes, just copy the files you altered into your child theme’s folder and you should be good to go.

    If you’re concerned about not having some of the updated code from the parent theme, grab a file comparison program (I use Meld, but I’m on a Linux machine, there are Windows and Mac equivalents) to quickly see what changes have been made and decide if you want to include any of them in your child-theme versions. Themes aren’t updated that often, really, so doing this in the future won’t be that frequent.

Viewing 1 replies (of 1 total)
  • The topic ‘Remove functions in child theme’ is closed to new replies.