mardi 26 novembre 2019

Menu Links Trigger a Pop Up

I am using Wordpress and Optin Monster for my pop ups, I am trying to have it so two different menu ID's trigger a different pop up when clicked. As you can see for one Pop Up I am using two different Menu ID's this works fine. But when I try to click the one labeled menu-link2 it just shows the menu-link pop up instead.

add_filter( 'nav_menu_link_attributes', 'ekf_menu_attribute_add', 10, 3 );
function ekf_menu_attribute_add( $atts, $item, $args )
{
  // Specify the menu item ID we want to add our attribute to
  $menu_link = 138509 || 138505;
  $menu_link2 = 138512;
  // Conditionally match the ID and add the attribute and value
  if ($item->ID == $menu_link) {
    $atts['data-optin-slug'] = 'bislxouzheoi8sw0rs5d';
    $atts['class'] .= 'manual-optin-trigger';
  }
    //Return the new attributes
    return $atts;
  if ($item->ID == $menu_link2) {
    $atts['data-optin-slug'] = 'jq7mkeex06ojlh0pklck';
    $atts['class'] .= 'manual-optin-trigger';
  }
  //Return the new attributes
  return $atts;
}

Aucun commentaire:

Enregistrer un commentaire