What about using jQuery to insert the unique code to your CTA menu class or item ID? Something like:
// generate your unique codes in jQuery
var mycode = your_random_code_function() // or an array of codes
// then…
var myhref = $("body.landingpage .navbar-nav .cta a").attr("href");
$("body.landingpage .navbar-nav .cta a").attr("href", myhref + "?offerid=" + mycode);
// etc…
// add the .cta class to the menu item that needs a code via Appearance > Menus in WP
// or just use its WP generated ID
Otherwise I think you’d have to look at a custom walker class.
Related Posts:
- Show different different menu in theme_location depending on x
- How to hide a menu from public, but share content with a private link [closed]
- How to display conditional menus with Twenty-twenty two theme (and other new block themes)?
- choose selected for select option with condition [closed]
- Split up wp_nav_menu with custom walker
- how to create a menu with all sub categories?
- How to avoid wp_nav_menu() ID conflict?
- WordPress Menu Custom Walker Class
- How to change order of menu items
- Remove unusable metaboxes in nav menu management screen
- Highlight parent menu item when child is not in menu
- Add Commas Between Menu Items?
- Allow html tags in WordPress Custom Menus Description Field
- Add custom attribute to menu item link using Filter
- Show child pages by menu order using Superfish Dropdown menu?
- Bootstrap drop down menu with wp_nav_menu
- Remove nav menu or menu item
- Adding a within ‘s from wp_nav_menu()
- Building a Sub-menu: Display Parent Category/Page’s Children When Viewing Children
- Getting stripos error when trying to add menu classes
- Output the aria-labelledby parameter for a nav menu child
- Hide menu items for visitors and filter based on role
- Custom Walker for Walker_Nav_Menu
- Make compatible custom menu widget for Twitter Bootstrap
- Different side menu on each page
- Automatically generated menu
- Appearance -> Menu -> Menu Structure : Add plain HTML code as an element
- Replace menu permalink/hyperlink with only menu name/slug
- Variables within wp_nav_menu
- wp_update_nav_menu_item not saving in multisite API
- get_search_form() doesn’t appear to take parameter into account
- Header style different on home and remaining pages
- Pass GET params to URL from a main menu item
- show different admin menu to different user roles
- wp_nav_menu_items filter :: custom menus fall outside ul class
- Schedule Page to Menu [duplicate]
- How can I add items to the menu via the PHP file?
- Limit the menu child levels under “admin > appearance > menus”
- display menus on all page except one?
- Show Menu from one WordPress install in another WordPress install
- Check if Page Already Exists in Menu
- Reuse a custom WordPress menu on another WordPress website
- Is this format possible with a custom Nav Walker class?
- Default WordPress menu content
- Add code to WordPress menu items by class
- how do i change the text under a navigation menu [closed]
- How do you add a around the second level of a Menu?
- custom walker nav issue involving ajax
- Remove admin menu
- How to add html attributes to the “ul” html tag with “wp_nav_menu” function?
- Limit User Iinterface for Admin?
- Creating menu and breadcrumb “sections” within WordPress 3 being used as a CMS
- Give child-categories same class (the parent category-slug) as parent in menu list?
- How Do I Add Images To Main Navigation Menu
- Custom Menu not functioning properly
- Using front-page.php need new blog page
- Is it still not possible to show separate submenu with “Custom Menu”?
- Three menus – parent / child / sibling
- WordPress Nav Walker – Top menu link with dropdown link not clickable (dropdown opens)
- Rename the label on a menu location which is already defined?
- How to making dynamic URLs for menus in WordPress?
- swap out only main menu for logged in users
- Menu Not Showing on Mobile
- Add custom class to li element which has children
- How to Show Different Menus to Logged in Users in WordPress [duplicate]
- Unable to get menu pattern using a walker
- Menu not adding the right items
- Adding CSS-class to WordPress Menu in backend
- How to change the menu like this?
- Custom ul class
- wp_nav_menu inside an object — how do I deal with fallback_cb?
- How to get or know the slug of home.php
- Removing Submenu from Menu
- How to create menu spread over four lines including images
- Adding conditional classes to wp_get_nav_menu_items
- Custom link missing as option in my ‘add menu items’
- Mobile navigation javascript problem
- Custom menu including also primary menu items
- open menu link (PDF) in new tab not download
- twentysixteen child theme – responsive menu – ham icon button not working – Cannot read property ‘classList’ of null
- How to add Loginout to Sub-menu
- Does the Default theme of WordPress like 2016, 2017 and 2019 uses Walker_Nav_Menu Class
- PHP Warning adding menu
- how to split vertical menu into two columns using walker nav menu
- Customize version different to Live version
- Editing/Removing Secondary Menu from Divi
- Can’t add optional class to menu item when using Walker_Nav_Menu
- Menu Button that link to different pages for unique user?
- Change “login/register” to “useraccount” when a user has logged in
- Question regarding register_nav_menus();
- Making wordpress menu horizontal [closed]
- WordPress Navigation default output
- Specifying Class style for Menu
- Is there a limit to number of pages displayed for selection in custom menu?
- Convert HTML code to WordPress menu
- How to view menu and submenus in URL
- Add monthly archives menu and submenu
- wp nav menu – highlighting current page not working properly [closed]
- Hamburger Navigation Menu
- How to replicate a mobile menu from a site to a wordpress site [closed]