• I am looking for a way to add unique ids to the menu items that are rendered in the single column template.
    I can edit the template, but it seems the menu items are not being looped so anything that I have tried to increment, never increments.
    can I retrieve the menu items post id from within the template, so that the id can be rendered in the html?

    I found $food_id, $group_id and others in the template, but none of them retrieve a number that is unique to the menu item.
    or maybe a way to retrieve the menu items sort order number?

    I need to style different parts of the menu and having unique ids is the only way that I can style the menu items and not affect everything in the menu.

    • This topic was modified 6 years, 5 months ago by lucein.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello @lucein,

    $food_id is unique to the menu item. You can assign id to make each menu item:
    <div class="rp-column-1 rp-column-block rp-column-margin" id="rp-coloun-<?php echo $food_id;?>">

    Ref: https://github.com/wpeverest/restaurantpress/blob/master/templates/layouts/one-column.php#L51

    Regards,
    WPEverest Support

    Thread Starter lucein

    (@lucein)

    hello,
    I tried using $food_id but all the items listed in the group end up all having the same id assigned to them inside the group and category.

    the id only changes when the menu items are part of another group and category. but they all have the same id for them.

    the only way I could get around it for now was to add price to the menu item. appending the price to the $food_id so that it would be unique. But then I would have to replace the price via css instead of using the price in associated with the the menu item. as I did below

    <p class=”price” id=”price_<?php echo $food_id . “_” . $food->get_price();
    ?>”><?php echo $food->get_price_html(); ?>
    </p>

    if I can get a unique id for every menu item listed, this would be extremely helpful.
    please advise.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘unique ids’ is closed to new replies.