Home>Support>how can I insert php code, is there a PHP editor

how can I insert php code, is there a PHP editor

Hi there, I´m using the following customizable responsive menu:

http://peterfeatherstone.com/wordpress/responsive-menu/faq/how-do-i-show-different-menus-on-different-pages/

My cuestion is how can I write php code, is there something similiar to Css editor or Custom CSS??? but for PHP???, or how can I set the code there (page I paste) is written.

Thanks for ur help

URL: http://peterfeatherstone.com/wordpress/responsive-menu/faq/how-do-i-show-different-menus-on-different-pages/

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 9 years, 3 months ago Andrew Misplon
    Hi, I Work Here

    Hi Artvaz

    The PHP outlined at the link provided is targeted at a much deeper level of integration. For that you’d be working in a child theme and editing the Vantage template files and or adding your own. If you’re not at that level then it’s best to work with a plugin. I saw you chatting to Magus about this earlier. Did you try https://wordpress.org/plugins/if-menu/. Was there a problem with the Vantage mobile menu?

  2. 9 years, 3 months ago artvaz

    yeah Andrew thanks god you are here ahahah, look for some reason the vantage mobile responsive menu is not working, do u think thats happening due to now I have different menus deppending on the page??

  3. 9 years, 3 months ago Andrew Misplon
    Hi, I Work Here

    One moment, let me just test out If Menu quickly on my local installation.

  4. 9 years, 3 months ago artvaz

    Alright, your have to know that now I´m using Zen Menu Logic, as Magus Recommended me

  5. 9 years, 3 months ago Andrew Misplon
    Hi, I Work Here

    Cool, thanks, let me test that now. One moment.

  6. 9 years, 3 months ago Andrew Misplon
    Hi, I Work Here

    Zen Menu Logic – great looking plugin but unfortunately doesn’t work with the existing Vantage Mobile Menu setup.

    I’m still looking around. Be with you ASAP.

  7. 9 years, 3 months ago artvaz

    Thanks I´ll be waiting

  8. 9 years, 3 months ago Andrew Misplon
    Hi, I Work Here

    Give this plugin a try, I’ve used it in the past:

    https://wordpress.org/plugins/menu-items-visibility-control/

    Once activated go to Appearance > Menus, select your main menu and edit an item. You’ll see a visibility field. There you can enter a PHP conditional argument. The ones you need are easy to learn. For example:

    ! is_page( 'cart' )
    

    That will display this menu item on all pages except the cart page. ‘cart’ refers to the page slug name. The slug is the url if you’re using pretty permalinks.

    Similarly, you could say:

    is_page( 'cart' )
    

    By removing the ! we’ve changed it to say, display this menu item ONLY if the page is ‘cart’.

    Give it a go.

  9. 9 years, 3 months ago Andrew Misplon
    Hi, I Work Here

    Reference conditionals: http://codex.wordpress.org/Conditional_Tags. Super powerful once you get into it a little.

  10. 9 years, 3 months ago artvaz

    Ok Andrew, how can I set to show it in more than one page???

    I was imagine like this:

    is_page( ‘cart1’, ‘cart2’, ‘cart3’, and so on )

    am I right???

  11. 9 years, 3 months ago Andrew Misplon
    Hi, I Work Here

    Try:

    is_page( array( 'cart1', 'cart2', 'cart3' ) )
    
  12. 9 years, 3 months ago Andrew Misplon
    Hi, I Work Here

    Check out the is_page section here: http://codex.wordpress.org/Conditional_Tags. Some cool examples.

  13. 9 years, 3 months ago artvaz

    or like this???

    is_page( array( ‘cart1’, ‘cart2’, ‘cart3’, and so on ) )

  14. 9 years, 3 months ago Andrew Misplon
    Hi, I Work Here

    Yeah, that’s it. Just be sure that your inverted commas are like mine in the code block. Plain text.

  15. 9 years, 3 months ago artvaz

    ohh sorry my mistake yeah I just read that thanks Andrew I will give it a try

  16. 9 years, 3 months ago Andrew Misplon
    Hi, I Work Here

    No worries, bit of cross over as we both have the thread open etc. Let me know how it goes. A very basic plugin, I know, but if it does the job then it’ll all be worth it.

  17. 9 years, 3 months ago artvaz

    Andrew I was wondering if as in the document you give me it says you can use Page ID´s, and I write as follows

    is_page(array( 1658, 1394 ))

    corresponding to:

    qpuntto.com/puebla

    and

    qpuntto.com/puebla/bares

    but it kinda not worked.

  18. 9 years, 3 months ago Andrew Misplon
    Hi, I Work Here

    It should work. The conditional says: Only display this menu item if we are on page 1658 or 1394.

    Which menu item did you add this conditional to?

  19. 9 years, 3 months ago artvaz

    Toluca Menu>Restaurantes

    Restaurantes is the item I added

  20. 9 years, 3 months ago Andrew Misplon
    Hi, I Work Here

    I’m not seeing a menu added. Can you confirm that Appearance > Theme Settings > Layout > Masthead Menu is NOT set to Empty Menu.

  21. 9 years, 3 months ago Andrew Misplon
    Hi, I Work Here

    If you’d like, send a set of temporary login details. Send to: [email protected]. Thanks.

  22. 9 years, 3 months ago artvaz

    it is set as Default Menu, ANdrew, which menu among the 3 possible I have has to been set up as Primary menu?? do you think thats the problem???

  23. 9 years, 3 months ago Andrew Misplon
    Hi, I Work Here

    One menu must be set as primary. We must only make edits to that one menu. This plugin is different to Zen. With this plugin we’re listing all our pages in one menu and then editing each item to say when it should be displayed.

  24. 9 years, 3 months ago Andrew Misplon
    Hi, I Work Here

    That sounds like the break through we needed.

  25. 9 years, 3 months ago Private Message - Arturo Vazquez

    This is a private message.

  26. 9 years, 3 months ago Andrew Misplon
    Hi, I Work Here

    I think just a small problem with the bars page ID. To get the ID just edit a page and check the URL. puebla was correct. Check the two pages now. On those two pages the restaurant link will show.

  27. 9 years, 3 months ago artvaz

    Let me see if I understand and correct me if I´m wrong please

    if the visibility field is empty what happen?, it will show all the items???

  28. 9 years, 3 months ago Andrew Misplon
    Hi, I Work Here

    What your statement says is:

    “If the page is puebla or bares then show the restaurant menu item. On any other pages that is not peubla or bares, don’t show the restaurant menu item.”

    Try explain what your end result must be and I’ll help with the conditional.

  29. 9 years, 3 months ago artvaz

    I resolved it already, my mistake, for some reason if one of the items wasnt mentioned in other item, it shows even it was set to show other pages, already working thanks Andrew! you are the best thanks for ur time!!

  30. 9 years, 3 months ago Andrew Misplon
    Hi, I Work Here

    Awesome! Glad to hear you were able to resolve. As I mentioned, very basic plugin, nothing fancy but there is still plenty of power once we get our head around inserting the correct PHP conditionals. If you need help in the future, please, let us know.

    Cheers for now :)

  31. 9 years, 3 months ago artvaz

    Andrew I´m trying to set the menus also for my posts (http://qpuntto.com/resenastolucametepec/el-cafe-mas-perro-bulldog-cafe/) but it is not working

    im doing it as follows:

     
    is_page(array( 1571, 1657, 1662, 1963, 1965, 1664, 253, 737, 1480, 1490, 1439, 1671, 1771, 1427, 1421, 1417, 1016, 1419, 1425, 1423, 1834, 1836, 1837 )); is_single(array( 2166, 2077 ) );
     

    What am I doing wrong???

  32. 9 years, 3 months ago artvaz

    and for example the parent “post” where you can see all of my posts is this one:

    http://qpuntto.com/resenastolucametepec/

    so I dont know which is its ID

  33. 9 years, 3 months ago Andrew Misplon
    Hi, I Work Here

    Sorry, I’m not following. When you say Set the menus also for my posts could you explain what you’re trying to do. Thanks :)

  34. 9 years, 3 months ago artvaz

    I´m using

    Reference conditionals: http://codex.wordpress.org/Conditional_Tags. Super powerful once you get into it a little.

    so I can have different menus depending on the page, but now my problem is that I also need to have different menus depending on the post, so I´m using the following code to make the conditional menu:

    is_page(array( 1571, 1657, 1662, 1963, 1965, 1664, 253, 737, 1480, 1490, 1439, 1671, 1771, 1427, 1421, 1417, 1016, 1419, 1425, 1423, 1834, 1836, 1837 )); is_single(array( 2166, 2077 ) ); 
     

    the following post is ID 2166

    http://qpuntto.com/resenastolucametepec/el-cafe-mas-perro-bulldog-cafe/

  35. 9 years, 3 months ago Andrew Misplon
    Hi, I Work Here

    Ahh right, thanks for reminding me.

    is_single
    

    is what you need to be using for posts.

    http://codex.wordpress.org/Conditional_Tags#A_Single_Post_Page

  36. 9 years, 3 months ago artvaz

    yeah I´m using that way look like this:

     
    is_page(array( 1571, 1657, 1662 )); is_single(array( 2166, 2077 ) );
     
  37. 9 years, 3 months ago artvaz

    so what I´m saying is:

    I want the menu to appear on PAGES 1571,1667,1662 and on POSTS 2166 2077

  38. 9 years, 3 months ago Andrew Misplon
    Hi, I Work Here

    I’m not sure this plugin can handle two statements, I haven’t tested that yet. Perhaps try saying this instead:

    is_page(array( 1571, 1657, 1662, 1963, 1965, 1664, 253, 737, 1480, 1490, 1439, 1671, 1771, 1427, 1421, 1417, 1016, 1419, 1425, 1423, 1834, 1836, 1837 )) && is_single(array( 2166, 2077 ) ); 
    
  39. 9 years, 3 months ago artvaz

    It was not posible, I think I will have to think on another way of redirectig my clients thanks Andrew for your time

  40. 9 years, 3 months ago Andrew Misplon
    Hi, I Work Here

    I can get it to work with OR instead of AND. Try this:

    is_page(array( 1940 )) || is_single(array( 1896 ) )
    
  41. 9 years, 3 months ago artvaz

    very useful thanks again!!!!

  42. 9 years, 3 months ago Andrew Misplon
    Hi, I Work Here

    For sure :)

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More