Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #5324

    Hello,

    I am using a child theme under Simple Catch Pro.

    I want to make a few changes to the header content, to change H1 tags to H2 on logo and title, and to remove the H2 tag on slogan. Maybe also do some other minor changes. Could somebody please give me some guidance on how to achieve this?

    My website is at http://www.saf-org.no

    Thankful for assistance.

    Best regards,
    TJ Braatveit

    #5360
    Sakin
    Keymaster

    @TJBraatveit: This is bit complicated process. I suggest you to take help from professionals.

    First you have to unhook the parent theme function for which you want to change it.

    For example let’s unlook the parent theme simplecatch_headerdetails function

    // Unhook default Simple Catch Pro functions
    function unhook_simplecatch_functions() {
    // Don't forget the position number if the original function has one
    add_action( 'simplecatch_before_sidebartop', 'simplecatch_headerdetails', 10 );
    }
    add_action( 'init', 'unhook_simplecatch_functions' );

    Then you need to build the child theme function to change that

    add_action( 'simplecatch_before_sidebartop', 'simplecatch_headerdetails_child', 10 );
    function simplecatch_headerdetails_child() {
    //delete_transient( 'simplecatch_headerdetails' );

    global $simplecatch_options_settings;
    $options = $simplecatch_options_settings;

    if ( ( !$simplecatch_headerdetails = get_transient( 'simplecatch_headerdetails' ) ) && ( empty( $options[ 'remove_header_logo' ] ) || empty( $options[ 'remove_site_title' ] ) || empty( $options[ 'remove_site_description' ] ) ) ) {
    echo '<!-- refreshing cache -->';

    $simplecatch_headerdetails = '<hgroup class="logo-wrap clearfix">';

    if( empty( $options[ 'remove_header_logo' ] ) ) {

    $simplecatch_headerdetails .= '<h1 id="site-logo">'.'<a href="'.esc_url( home_url( '/' ) ).'" title="'.esc_attr( get_bloginfo( 'name', 'display' ) ).'">';
    if ( !empty( $options[ 'featured_logo_header' ] ) ):
    $simplecatch_headerdetails .= '<img src="'.esc_url( $options['featured_logo_header'] ).'" alt="'.get_bloginfo( 'name' ).'" />';
    else:
    // if empty featured_logo_header on theme options, display default logo
    $simplecatch_headerdetails .='<img src="'. get_template_directory_uri().'/images/logo.png" alt="logo" />';
    endif;
    $simplecatch_headerdetails .= '</a></h1>';
    }

    if ( empty( $options[ 'remove_site_title' ] ) || empty( $options[ 'remove_site_description' ] ) ) {

    $simplecatch_headerdetails .= '<div id="site-details">';

    if( empty( $options[ 'remove_site_title' ] ) ) {
    $simplecatch_headerdetails .= '<h1 id="site-title"><span><a href="'.esc_url( home_url( '/' ) ).'" title="'.esc_attr( get_bloginfo( 'name', 'display' ) ).'">'.esc_attr( get_bloginfo( 'name', 'display' ) ).'</a></span></h1>';
    }
    if( empty( $options[ 'remove_site_description' ] ) ) {
    $simplecatch_headerdetails .= '<h2 id="site-description">'.esc_attr( get_bloginfo( 'description' ) ).'</h2>';
    }
    $simplecatch_headerdetails .= '</div>';
    }

    $simplecatch_headerdetails .= '</hgroup>';

    set_transient( 'simplecatch_headerdetails', $simplecatch_headerdetails, 86940 );
    }
    echo $simplecatch_headerdetails;
    } // simplecatch_headerdetails


    #5403

    @Sakin: Thank you. Yes, taking help from professionals is a good advice, it seems. 🙂 I realize that I know even less about PHP than what I thought.

    Thank you.

    TJ Braatveit

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘How to change header in child theme?’ is closed to new replies.