Shortcode in restrict message
-
Hello. I would like to add a shortcode in the restrict message, but the options i’ve tried doesn´t work.
Thanks.
Regards.
-
Could you please show me an example of what you’re trying and what the results are?
Yeah sure.
The page is this: https://viajarandroll.com/curso/cicloturismo/capitulo-1-la-bicicleta/
As you can see in the pink box, the first link is to enter the web. However, this link changes depending on each page of the web (I am using the Genesis modal login login box), adding to the url / # login. So I have created a shortcode that takes out the URL from the page the user is on, and adds the previous parameter. But when I try to add the shortcode to the restriction message, it does not appear.
I leave you the shortcode code too.
function shortcode_login() { global $wp; $current_url = home_url( add_query_arg( array(), $wp->request ) ); echo '<a href="'. $current_url . '">' . $current_url . '</a>'; } add_shortcode('db-login', 'shortcode_login');I hope to have explained.
Thanks, and greetings
I see the log in links on the page and they redirect to the log in page.
Is that not what is supposed to happen?
Hi, Pippin.
It is not the behavior it should have.
As you say, open a modal box but on the home page. And this should open on the page where this log in is.
I give you examples:
For https://viajarandroll.com/curso/cicloturismo/capitulo-1-la-bicicleta/ the log in URL must be https://viajarandroll.com/curso/cicloturismo/capitulo-1-la-bicicleta/#login .
For https://viajarandroll.com/curso/cicloturismo/capitulo-2-accesorios-y-portabultos/ the log in URL must be https://viajarandroll.com/curso/cicloturismo/capitulo-2-accesorios-y- portabultos / # login.
For https://viajarandroll.com/curso/cicloturismo/capitulo-3-las-alforjas/ the log in URL must be https://viajarandroll.com/curso/cicloturismo/capitulo-3-las-alforjas/#login .
For https://viajarandroll.com/curso/cicloturismo/capitulo-4-antipinchazos-sistemas/ the log in URL must be https://viajarandroll.com/curso/cicloturismo/capitulo-4-antipinchazos-systems/#login .
For this I have created a shortcode that takes the URL of the page on which it is user, and adds the parameter. But the restriction message does not show me the shortcode.
It’s hard to explain when it’s not your language. I hope that with examples you understand me.
Thanks for the patience, greetings.
Does your short code work (and open the modal) when not used in the [restrict] shortcode?
You can watch it here: https://viajarandroll.com/prueba/.
The code is this:
function shortcode_login() { global $wp; $current_url = home_url( add_query_arg( array(), $wp->request ) ); echo '<a href="'. $current_url . '/#login">Login</a>'; } add_shortcode('db-login', 'shortcode_login');I just solved it. As simple as putting it like this:
Thank you very much for the great support.
A greeting.
Glad to hear it!
The topic ‘Shortcode in restrict message’ is closed to new replies.