[Support request] Adding PHP in Menu

Home Forums Support [Support request] Adding PHP in Menu

Home Forums Support Adding PHP in Menu

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #354619
    Mark

    Howdy!

    I have a quick question about adding a PHP to the main menu.

    <?php $values = get_post_custom_values(“Phone”); if ( !empty($values) ) {echo ” . $values[0]. ‘ ‘;} else {echo ’01 485 11 45’;} ?>

    How this works is if I i want a specific phone number to show on a specific page on my site I can use Custom Fields.

    But currently on my site http://www.bushirecork.ie I have the number showing in the main menu. If there a way of showing that within the main menu on generate press?

    Thanks

    #354641
    Leo
    Staff
    Customer Support

    Hi Mark,

    It’s not possible to add PHP to menu items but Tom provided an alternative solution here: https://generatepress.com/forums/topic/add-php-code-to-menu-item/#post-293154

    #356171
    Mark

    Hi Leo, thanks for that but them plugins dont seem to work. Just show up blank. Must be the PHP?

    #356280
    Leo
    Staff
    Customer Support

    Shortcodes in Menus doesn’t work? What shows up blank?

    #356283
    Mark

    I installed the recommended plugins to insert php into the menu and added my php and nothing shows up.

    #356285
    Leo
    Staff
    Customer Support

    The plugin inserts shortcodes into menu so you would have to turn the php into shortcode first then insert it with the plugin.

    #356287
    Mark

    Oh sorry yeah, thats what I meant

    #356297
    Leo
    Staff
    Customer Support

    Sorry so you did that but it’s not working? What are you seeing?

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