Support

Home Forums Event Espresso Premium Unique page ID for registration page

Unique page ID for registration page

Posted: October 17, 2018 at 7:24 am


tsca

October 17, 2018 at 7:24 am

I have several events, and my client asked me to remove the site navigation and footer, for one event only(dont ask!) – so that when someone registers and pays they don’t appear. I just removed the nav and footer by targeting the page-id <body> class in CSS.

Now the problem is when I create a new event, the registration page has the same page-id so thats also not showing the nav and footer.

Is there a better way to do this, or at least to make the page-id class different for each event? I’m not particularly confident with JS or PHP!
Thanks


Tony

  • Support Staff

October 17, 2018 at 7:47 am

Hi there,

So if I understand this correctly, you want to remove the nav and footer from the /registration-checkout/ page for a specific event(s).

The registration checkout (where the user enters their contact and payment details) is a single page so you can’t target that page ID with CSS to remove the header/footer for only a specific event.

The page ID of the checkout page ID should not be changed per event, that’s going to cause more problems.

What you can do, is add the event ID(s) to the body class of the checkout page, then target those classes with your CSS, so .{page-id-classe}.{event-id-class} .{nav-class} for example:

.page-id-7.event-id-54 .nav {
    display: none;
}

Will only target .nav, if event id 54 has been added to the cart.

You’ll need to use some PHP to do this:

https://gist.github.com/Pebblo/f4561461339c59411a849f93c91912a9

I know you mentioned above you are not confident with PHP, but you can add that to a custom functions plugin on the site and we have some documentation on how to do that here:

https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/

If you follow those steps it’s not as scary as it seems 🙂


Tony

  • Support Staff

October 17, 2018 at 7:54 am

Just to note, I’ve just updated the code as it relied on your page slug being ‘registration-checkout’ which is a little fragile, it now uses the page ID so works regardless of custom page slugs.

Just refresh the gist page I linked to before copying the code and you’ll have the latest version.


tsca

October 17, 2018 at 7:58 am

Thanks Tony thats great – I’ll see what I can do with it and I’ll let you know how it goes.
Cheers


Tony

  • Support Staff

October 17, 2018 at 9:09 am

You’re most welcome, please do let me know how you get on.


tsca

October 18, 2018 at 1:50 am

Worked perfectly Tony – thanks so much!


Tony

  • Support Staff

October 18, 2018 at 2:55 am

You’re most welcome, thanks for the update.

If have a minute we would really appreciate if you could share your experience with Event Espresso or provide a review on WP.org.

Either way, have a great day.

The support post ‘Unique page ID for registration page’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso