Do I have a better way at populating a with menu items?

Free and Premium WordPress Plugins & Themes Forums WordPress Plugins Restaurant Menu Do I have a better way at populating a with menu items?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #532434
    None
    Guest

    I started learning WordPress less than two weeks ago and I’m experimenting with the ecosystem by creating a simple pizza restaurant website (which I may also decide to publish).

    One of the pages of this site is intended to display a menu with a list of menu items (specifically: pizza name, list of ingredients and price). I wished to use a <table> and so I did.

    Not having much experience with WordPress (and CMSs in general) I’m wondering if the solution I attempted is best than any other. Since I didn’t seem to find any APIs (both from WordPress and the Restaurant Menu plugin) I dug a little into the source code and, even more extensively, explored the structure of the MySQL database.

    In short, my solution at creating a <table> in a page of the website and populating it can be summarized as follows:

    1. I created a custom template page-menu-lb.php in the folder of the child theme I had initiated earlier;
    2. I inspected how the data inputted in the dashboard was stored in the database tables, and learned about the wpdb class for creating custom queries to the database;
    3. I created some .php files to query the database and store the collected data in an objected-oriented fashion. As I am dealing with pizzas, I created a Pizza class with the required attributes.

    Now, the code required me more development time than I expected, but all in all it is working fine. What I’m rather more interested in knowing is: am I writing idiomatic code? Does the Menu Restaurant plugin allow to better integrate code such as this? I read about the suggestion of using actions and filters in this site, but I really didn’t find more documentation describing how to do that, and specifically for my case I don’t even know if that can help me.

    Can you answer these questions, and possibly refer to the style adopted by WordPress and your plugin?

    #532439
    None
    Guest

    It seems like the site filtered out some of the characters in the title. It should read as:

    Do I have a better way at populating a \<table\> with menu items?

    #535718
    J. Davis
    Keymaster

    Hi,

    Thank you for clarification and sent example in a request. Doe to that example you can easily add custom styles to add borders to list view. You’ll get the same result.

    Best regards,
    John

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