Skip to content

Instantly share code, notes, and snippets.

@maheshwaghmare
Created December 5, 2018 06:19
Show Gist options
  • Save maheshwaghmare/a509a9e1dfda5cd704a3dae4a8165e01 to your computer and use it in GitHub Desktop.
Save maheshwaghmare/a509a9e1dfda5cd704a3dae4a8165e01 to your computer and use it in GitHub Desktop.
Astra Pro - Add custom hook into WooCommerce My Account hooks group.
<?php
/**
* Add Hooks into Custom Hooks.
*
* Common Hook: woocommerce_account_content - [Use priority 0-9 to show in Top and 10-xxx to show in Bottom]
*
* Tab Specific Hooks:
* - Orders Tab: woocommerce_account_orders_endpoint - [Only at top]
* - Downloads Tab: woocommerce_account_downloads_endpoint - [Only at top]
* - Addresses Tab: woocommerce_account_edit-address_endpoint - [Only at top]
* - Account Details Tab: woocommerce_account_edit-account_endpoint - [Only at top]
*
* @todo Change `prefix_` with your own prefix.
*
* @since 1.0.0
*/
if( ! function_exists( 'prefix_astra_custom_layouts_hooks' ) ) :
function prefix_astra_custom_layouts_hooks( $hooks = array() )
{
// Added into the WooCommerce My Account hooks group.
if( array_key_exists( 'woo-account', $hooks ) ) {
$hooks['woo-account']['hooks'][ 'woocommerce_account_content' ] = array(
'title' => 'woocommerce_account_content',
'description' => __( 'Action to add your content before/after WooCommerce my account.', 'astra-addon' ),
);
}
return $hooks;
}
add_filter( 'astra_custom_layouts_hooks', 'prefix_astra_custom_layouts_hooks' );
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment