• Resolved SRD75

    (@srd75)


    Hi. I’ve tried the following functions to modify the header and footer.

    function webby_storefront_credit() {
       ?>
       <div class="site-info">
    
             <?php echo esc_html( apply_filters( 'storefront_copyright_text', $content = '&copy; ' . get_bloginfo( 'name' ) . ' ' . date( 'Y' ) ) ); ?>
    
             <?php if ( apply_filters( 'storefront_credit_link', true ) ) { ?>
    
             <br /> <?php echo '<a href="https://s.doig.com.au" target="_blank" title="' .  '" rel="author">' . esc_html__( 'Built by Steve  ', 'storefront' ) . '</a>' ?> and <a href="https://www.webby.net.au" title="Webby Website Optimisation">Webby Website Optimisation</a>.
    
             <?php } ?>
    
       </div><!-- .site-info -->
    
       <?php
    }
    
    function webby_remove_footer_credit () {
        remove_action( 'storefront_footer', 'storefront_credit', 20 );
        add_action( 'storefront_footer', 'webby_storefront_credit', 20 );
    }
    
    add_action( 'init', 'webby_remove_footer_credit', 10 );
        
    function webby_storefront_site_title_or_logo( $echo = true ) {
    	if ( function_exists( 'the_custom_logo' ) && has_custom_logo() ) {
    		$logo = get_custom_logo();
    		$html = is_home() ? '<h1 class="logo">' . $logo . '</h1>' : $logo;
    	} else {
    		$tag = is_home() ? 'h2' : 'div';
    
    		$html = '<' . esc_attr( $tag ) . ' class="beta site-title"><a href="' . esc_url( home_url( '/' ) ) . '" rel="home">' . esc_html( get_bloginfo( 'name' ) ) . '</a></' . esc_attr( $tag ) . '>';
    
    		if ( '' !== get_bloginfo( 'description' ) ) {
    			$html .= '<h1 class="site-description">' . esc_html( get_bloginfo( 'description', 'display' ) ) . '</h1>';
    		}
    	}
    
    	if ( ! $echo ) {
    		return $html;
    	}
    
    	echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    }
    
    function webby_site_title () {
        remove_action( 'storefront_header', 'storefront_site_title_or_logo', 20 );
        add_action( 'storefront_header', 'webby_storefront_site_title_or_logo', 20 );
    }
    
    add_action( 'init', 'webby_site_title', 10 );

    This code is in the functions.php file of the child theme, and the child theme is active.

    However, the header and footer are still the same.

    Help appreciated.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Niall a11n

    (@wpniall)

    Hi @srd75,

    I’m sorry we missed your post. Have you been able to resolve this issue?

    If not,

    As your post involves a development topic, I’m going to leave it open for a bit longer to see if anyone is able to chime in and help you out.

    I can also recommend the WooCommerce Developer Resources Portal for resources about WooCommerce development.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there too.

    Thread Starter SRD75

    (@srd75)

    Hi Niall, I have since moved away from Storefront.

    Cheers.

    Niall a11n

    (@wpniall)

    Hi there, thanks so much for letting us know! Hope you have a great week!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Trouble modifying template functions’ is closed to new replies.