Created
July 2, 2021 15:43
-
-
Save plugin-republic/42f4f24a8cf517d93845f9da014a528e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Display a link to the My Account page under upload fields | |
*/ | |
function prefix_display_link_to_account_page( $item, $id, $group_layout, $file ) { | |
$page_id = get_option( 'woocommerce_myaccount_page_id' ); | |
if( ! is_user_logged_in() && $page_id && isset( $item['field_type'] ) && $item['field_type'] == 'upload' ) { | |
$url = get_permalink( $myaccount_page_id ); | |
printf( | |
'<p><a href="%s">%s</a></p>', | |
$url, | |
'Click here to log in' | |
); | |
} | |
} | |
add_action( 'pewc_after_include_frontend_template', 'prefix_display_link_to_account_page', 10, 4 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment