Community Forums › Forums › Archived Forums › Design Tips and Tricks › Move page title to another hook in WooCommerce
Tagged: entry-title, reposition title, WooCommerce
- This topic has 5 replies, 3 voices, and was last updated 8 years, 11 months ago by
Brad Dalton.
-
AuthorPosts
-
January 26, 2017 at 12:33 pm #200081
hmistler
MemberHello - I'm trying to make my page title on my WooCommerce shop page the same design as all my other pages, but using Action Hooks plugin I notice WooCommerce puts the page title in the "before_loop", whereas I need it to be in the "after_header" hook. How can I move this? Ideally would like to add a line to my functions.php file, but just not sure of the right code for this. Thanks!
https://mossandblue.com/shop/January 26, 2017 at 1:51 pm #200085hmistler
Member*Update*
Here is the part of the code in the archive_product page that comes with WooCommerce and controls the shop page, if it helps:
if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } get_header( 'shop' ); ?> <?php /** * woocommerce_before_main_content hook. * * @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content) * @hooked woocommerce_breadcrumb - 20 */ do_action( 'woocommerce_before_main_content' ); ?> <?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?> <h1 class="page-title"><?php woocommerce_page_title(); ?></h1> <?php endif; ?> <?php /** * woocommerce_archive_description hook. * * @hooked woocommerce_taxonomy_archive_description - 10 * @hooked woocommerce_product_archive_description - 10 */ do_action( 'woocommerce_archive_description' ); ?> <?php if ( have_posts() ) : ?> <?php /** * woocommerce_before_shop_loop hook. * * @hooked woocommerce_result_count - 20 * @hooked woocommerce_catalog_ordering - 30 */ do_action( 'woocommerce_before_shop_loop' ); ?>January 26, 2017 at 5:49 pm #200092Victor Font
ModeratorYou can't change this through an action hook because the title code is not being rendered in a hook. It's hard coded in the template. You can copy the template into your child theme's woocommerce directory and move the title in the template.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?January 26, 2017 at 5:55 pm #200093hmistler
MemberOk...how would I move the title in the template?
January 26, 2017 at 6:41 pm #200094Victor Font
ModeratorCut and paste the code surrounding the woocommerce_page_title() function.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?January 27, 2017 at 10:15 pm #200156Brad Dalton
ParticipantMight be wrong because i haven't tested these solutions however:
1. You can use a filter function in your child themes functions file.
Or
2. You can remove the page title and then add it back using any of the genesis or woocommerce hooks.
Try this in your child theme's functions:
add_filter( 'woocommerce_show_page_title', false );
You could also use this code conditionally.
-
AuthorPosts
- The topic ‘Move page title to another hook in WooCommerce’ is closed to new replies.