Use alternate template with if/else statement
-
I would like to add a line to this bit of code so that if it is the “$Shop_page” page use archive-shop.php template instead of the “Echo” line of code that is in there now.
I am not sure how to write this code…OR if its even possible to set this up this way.
I basically want to customize my SHOP index page. Right now it shares the archive-products template in my files. If I alter this file the changes appear on all category pages which I do not want.
Thanks!
Sandra ??CODE:
<?php if ( is_search() ) : ?> <?php printf( __( 'Search Results: “%s”', 'woocommerce' ), get_search_query() ); if ( get_query_var( 'paged' ) ) printf( __( ' – Page %s', 'woocommerce' ), get_query_var( 'paged' ) ); ?> <?php elseif ( is_tax() ) : ?> <?php echo single_term_title( "", false ); ?> <?php else : ?> <?php $shop_page = get_post( woocommerce_get_page_id( 'shop' ) ); echo apply_filters( 'the_title', ( $shop_page_title = get_option( 'woocommerce_shop_page_title' ) ) ? $shop_page_title : $shop_page->post_title ); ?> <?php endif; ?>
- The topic ‘Use alternate template with if/else statement’ is closed to new replies.