Php wordpress

[ad_1]

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’);

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer