1. Home
  2. AccessAlly
  3. Third Party Tools
  4. Using Shortcodes with Menus in AccessAlly

Using Shortcodes with Menus in AccessAlly

By default, AccessAlly will only show the pages that members have access to in your menus.

For example, if a member has access to 3 pages in Module 1, their menu will contain only those pages. As Module 2 becomes unlocked, they will see more pages in the menu.

This works fine for most cases. But sometimes you want to still show a link, but direct it to a different page if you have a “coming soon” page, for example.

That’s where the power of AccessAlly shortcodes and the “Shortcode in Menus” plugin come together.

Using the Shortcode in Menus plugin

First, download and activate the Shortcode in Menus plugin (it’s free) :

Shortcode in Menus

Once you have it installed, when you go to the WordPress Appearance -> Menus area, you will see a new type of menu item called Shortcode.

You will want to make sure that “Shortcodes” are enabled in the “Screen Options” area in the top right corner of your WordPress display settings.

Screenshot of enabling the shortcodes in the top bar

To add a Shortcode link, you will want to use AccessAlly’s shortcode generator, which you can run on the menu editing page by clicking the link in the top WordPress bar.

Dashboard Shortcode Adder

The most common use case for this type of menu item will be to use the conditional AccessAlly shortcodes, based on tags.

Screenshot of shortcode in menu item

Example Shortcodes

Once you have the shortcodes generated with your exact tags, you will want to insert the link for the menu item using an HTML “a href” link.

This is what your final shortcode may look like:

[accessally_has_any_tag tag_id='2782' comment='Cool_Course_Has_Access']
<a href='https://yoursite.com/course-page/'>Start the course</a>
[/accessally_has_any_tag]

[accessally_missing_any_tag tag_id='2782' comment='Cool_Course_Has_Access']
<a href='https://yoursite.com/coming-soon/'>Sign up for the course</a>
[/accessally_missing_any_tag]

The first section displays the regular page, for those who have access. The second section will display the link for the “coming soon” page or any other link you want to send people to if they didn’t have the tag.

After you hit Add to Menu, you won’t be able to edit your shortcode anymore. So make sure to save your code somewhere else, so it’s easy to make any changes in the future.

You can also drag and drop the menu item like you would any other link.

Updated on November 16, 2023
Was this article helpful?

Related Articles

NO QUESTION GOES UNANSWERED

Live Weekly Q&A

Join us for live Q&A. Learn the basics, discover what's possible, and connect with AccessAlly users.

Need Support?

Have questions? Get in touch. Our inbox support hours are 9am-5pm EST, Monday - Friday.

Laptop with the AccessAlly demo site

AccessAlly is the most flexible way to sell and elegantly deliver digital offerings. All in one place.

WATCH THE DEMO

You'll get follow-up emails about AccessAlly and new features. Opt out anytime. Full privacy policy here.