I create a function in php that check if the user is logged in or not based on that an icon change his url i put that code in code snippet the problem is that the code work on desktop but not on mobile any idez why? Thus the code :
// Add this code to your theme’s functions.php file or a custom plugin// Function to modify the href value based on the user’s login status function customize_my_account_link() { $account_url = is_user_logged_in() ? ‘/my-account’ : ‘/Login01’; ?> document.addEventListener(‘DOMContentLoaded’, function() { const customizeMyAccount = document.querySelector(‘.customize-my-account a’); customizeMyAccount.href = ”; }); <?php } add_action(‘wp_footer’, ‘customize_my_account_link’);
Php wordpress
[ad_1]
