Support » Plugin: Shortcode in Menus » Will php work?

Viewing 1 replies (of 1 total)
  • Plugin Author Gagan Deep Singh

    (@gagan0123)

    Volunteer Moderator

    @bttmrc

    Sorry to disappoint you, but writing PHP code wouldn’t work.

    Though you can add some custom plugin or add your code in theme’s functions.php file and add a shortcode to your function, something like:

    <?php
    function hello_world() {
        // Your PHP Code
        return 'Hello World';
    }
    add_shortcode( 'hello-world', 'hello_world' );
    

    and then you can use [hello-world] as shortcode in the menu, whatever that function will return, will be placed in the menu.

    • This reply was modified 4 months, 3 weeks ago by  Gagan Deep Singh. Reason: Correcting syntax
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.