I have this bit of code, but I use a different button now and I just can't get the code to work? It's for this button at the homepage: https://imgur.com/a/NUBzN5C How do I change code so that it works?
I think I'll change it two buttons: LOGIN, REGISTER. What is the url for the login page? Because url/#login doesn't work... and /inloggen doesn't neither.
Hi Alex,
How are you?
I have this bit of code, but I use a different button now and I just can't get the code to work? It's for this button at the homepage: https://imgur.com/a/NUBzN5C How do I change code so that it works?
add_action('wp_footer',function(){
?>
<script>
window.addEventListener("load", (event) => {
if(typeof localforage !=='undefined'){
localforage.getItem('bp_login_token').then(function(token){
if(token){
if(document.querySelector('.home a.elementor-button elementor-button-link elementor-size-sm'))
document.querySelector('.home a.elementor-button elementor-button-link elementor-size-sm').setAttribute('href','https://meestergijs.nl/app/#component=course');
}else{
if(document.querySelector('.home a.elementor-button elementor-button-link elementor-size-sm'))
document.querySelector('.home a.elementor-button elementor-button-link elementor-size-sm').setAttribute('href','https://meestergijs.nl/aanmelden/');
}
})
}
});
</script>
<?php
});
add classes to your button and use them please do not use elementor calsses elementor provides option to add custom class to button.
Let's say my CSS class is: startmetoefenen, where do I add that in Elementor?
And then how do I incorporate that class in the code shared below? Because I can't get it to work..
please use this code then :
Hi Alex, it doesn't seem to work.
Could you check if I need to change something in Elementor perhaps? You still have credentials?
Gijs
Note to self: I save my old code here.
add_action('wp_footer',function(){
?>
<script>
window.addEventListener("load", (event) => {
if(typeof localforage !=='undefined'){
localforage.getItem('bp_login_token').then(function(token){
if(token){
if(document.querySelector('.home a.elementor-button-link.elementor-size-ms'))
document.querySelector('.home a.elementor-button-link.elementor-size-ms').setAttribute('href','https://meestergijs.nl/app/#component=course');
}else{
if(document.querySelector('.home a.elementor-button-link.elementor-size-ms'))
document.querySelector('.home a.elementor-button-link.elementor-size-ms').setAttribute('href','https://meestergijs.nl/aanmelden/');
}
})
}
});
</script>
<?php
});
that button does not have the class " startmetoefenen " please add that class to that button to fix the issue
Still doesn't work.
I think I'll change it two buttons: LOGIN, REGISTER. What is the url for the login page? Because url/#login doesn't work... and /inloggen doesn't neither.
no class seen on the button actually :
Correct. I have changed my mind. As said in my previous reply: What is the correct url for the login page?
Im sorry Im not able to understand your query , do you mean this url ? :
https://meestergijs.nl/app
Yes, but I want the login screen to be shown like this: https://imgur.com/a/0IMxOJ1
hi im sorry that is not possible as of now.
Ok, understood. Thanks