[Resolved] Add PHP code to menu item

Home Forums Support [Resolved] Add PHP code to menu item

Home Forums Support Add PHP code to menu item

  • This topic has 6 replies, 3 voices, and was last updated 7 years ago by Tom.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #293049
    Amos

    Hello. i want to add a php code to menu item (primary) it is possible?

    #293051
    Leo
    Staff
    Customer Support

    Hi there,

    What are you trying to add? It maybe easier to use a plugin like this: https://wordpress.org/plugins/if-menu/

    Let me know.

    #293057
    Amos

    i want to add the first code :
    https://docs.woocommerce.com/document/show-cart-contents-total/
    inside menu item.

    i dont want to use 3rd party plugin for this.

    #293062
    Leo
    Staff
    Customer Support

    I don’t think that code is for you to add to the menu as it says it’s for template.

    This is probably what you are looking for: https://en-ca.wordpress.org/plugins/woocommerce-menu-bar-cart/

    Let me know if this helps.

    #293154
    Tom
    Lead Developer
    Lead Developer

    It’s not possible to add PHP to menu items.

    You would have to turn the PHP into a shortcode, then use a plugin like this: https://en-ca.wordpress.org/plugins/shortcode-in-menus/

    #293304
    Amos

    Thank You Tom and Leo. i am using the code inside the “After Header Content” Hook and it is look good also.
    Tom there is any update about the woocommerce add on ? ๐Ÿ™‚

    #293456
    Tom
    Lead Developer
    Lead Developer

    Nothing new yet ๐Ÿ™‚

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.