I found this code from @LoicTheAztec that adds allows you to add some extra text to the My Account – Dashboard tab in WooComerce.
I am trying to add a hyper link to it however my php knowledge and syntax is appalling and I clearly can’t use the standard a href html to do this as this throws an error : syntax error, the unexpected identifier "https", expecting ")"
Any help on how I could add a URL to this would be very much appreciated. Thank you.
Code :
add_action( 'woocommerce_account_content', 'action_woocommerce_account_content' );
function action_woocommerce_account_content( ) {
global $current_user; // The WP_User Object
echo '<p>' . __("<a href="https://google.com"> Request Wholesale account </a>", "woocommerce") . '</p>';
};
3
Answers
Solved this with Martin's help. Thanks for all the other suggestions too.
The way I ended up doing it was to use the Dashboard hook as suggested and the single quote echo.
You are using double quotes twice which cancel each others. simpler way to do it. also you need to separate the translation function from the html.
Always escape/secure output for security using like
esc_html__
.