show all items from all categories in one page

WPPizza – A Restaurant Plugin for WordPress Support General Support show all items from all categories in one page

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #5412
    foxpc
    Participant

      Hi,
      first it’s a great plugin! great job!
      we also going to but some add-ons after will make some tests in our site to see that all works as we need.
      i working on “one page template”.
      my question is:
      1. how to print all menu items from all the categories? the sort code print only from one category and i need from all like:
      category name:
      all menu items

      category name2:
      all menu items

      etc….
      2. how to use categories navigation without reloading the page?
      i mean when i click on “pizza” it will show all the items from pizza category without reloading the page.

      Thanks!

      #5414
      Olly
      Admin & Mod

        >1 how to print all menu items…

        just put multiple shortcodes on the page

        >2. how to use categories navigation without reloading the page?

        you’ll need to write some script that does that

        alternatively, put all the shortcodes on their own distinct pages and use/find a theme that loads all pages in one go and then just shows/hides whenever the appropriate link is clicked.
        i know there are some / have seen some , but off the top off my head i don’t know which one

        #5415
        foxpc
        Participant

          Hi,
          about the 1
          i want to make this dynamically.
          because i don’t want to remember to insert every time shortcode when i or some of our employee will create new category.
          there is some filter or loop to change that?

          about the 2.
          i can write script but how can i change the categories slug to be only #cat name?

          Thanks!

          #5416
          Olly
          Admin & Mod

            >there is some filter or loop to change that?
            I might be wrong of course, but it sounds to me like you are using option 1 here
            https://wordpress.org/plugins/wppizza/installation/
            when you might want to consider option 2 perhaps (although this in turn might not suit your scenario. dunno . all depends on how you want to put things together)

            having said that – and thinking out loud for a bit – i suppose i could add/amend the shortcode attributes to automatically show all categories which is actually not a bad idea to start off with really to have that option….

            >re2:

            you will *always* need a parent of some sort (assuming that i understand you correctly)
            this is not down to the plugin, but down to wordpress
            again, depending on how it’s setup:

            the parent can be whatever you like though.

            so this will work:

            http://www.domain.com/somepagenameslug/pizzas
            http://www.domain.com/somepagenameslug/pasta
            etc

            this:
            http://www.domain.com/pizzas
            http://www.domain.com/pasta
            etc
            WILL ONLY WORK IF you create those pages (i.e pizza and pasta) and then put the relevant shortcode on it
            (of course in this case you will have to add new pages whenever you create a new category, so it presumably is not an option for you and i’m just saying this here for completeness sake)

            i don’t understand the following though (I’m probably missing something):
            >to be only #cat name..
            the category slug IS the cat name…(unless of course you changed the slug), no ?

            #5417
            foxpc
            Participant

              Hi,
              i will explain myself better and give you some examples.
              i want to try two scenarios,
              the first one is to show all our menu in one page. so no matter how many categories i will create and items it will print all of them in one place.
              the example is:
              cat1
              menu items for this cat
              cat2
              menu items for this cat
              cat3
              menu items for this cat
              and etc…

              the second scenario is to show one category by default, and the others categories will be shown based on filter (based on what user will select).
              here is a good example:
              http://demo.cookpress.ru/
              go down until you will find “Menu of the day” (the menu link seems not working so you will see the menu there when you will scroll down).

              #5418
              Olly
              Admin & Mod

                although you could mess around with the arguments in the ‘wppizza_filter_loop’ filter, it won’t loop over that page to show you all the headers (i.e. category names) all it would/could do is to show *all* items on one page. so this will only partially be helpful.
                (essentially you’d be changing the query , but that doesn’t affect the header)

                easiest thing to do – and i wanted to do that for a while anyway but never got round to it – is for me to add the possibility of a shortcode that allows all categories to be displayed , so you dont have to think about it again. might take a couple of days though, depending on what else crops up.

                while I’m at it, I might as well also add a class to the headers and articles that references the selected category – probably by id as the navigation has this already as id’s – which should help you in the second scenario when you need to show/hide things

                although the navigation widget/shortcode was only meant to be used if you use templates, it should work in your scenario too…..(with a bit of creative js, showing/hiding things depending on class/id)

                #5419
                foxpc
                Participant

                  Hi,
                  that will be awesome!
                  Thanks you!
                  when you will add this things i can do the rest with js.

                  #5420
                  Olly
                  Admin & Mod

                    no worries.
                    will be fun (and probably useful to others too)
                    might aven be able to do this by tomorrow (unless unforeseen things crop up), but allow me a few days

                    i’ll keep you posted (there might be a couple of things you might have to be aware of…will let you know)

                    #5473
                    Olly
                    Admin & Mod

                      just an update.
                      haven’t forgotten. just came across a couple of other things that would benefit from being looked at.

                      another couple of days.
                      (actually making this work is easy, coding it so i don’t break possible customisations of this is the bit that needs to be considered/checked)

                      #5475
                      Olly
                      Admin & Mod

                        in v2.11.2 you now have a number of additional shortcodes to play with

                        see here: https://wordpress.org/plugins/wppizza/faq/ – > what are the available shortcodes

                        i have also added a bunch of classes and id’s to the article and header elements.
                        i.e an article has something like this “wppizza-article-special-offers-16”, where the last integer is the category id , whereas the bit before the id and after wppizza-article- bit is the category slug (so in this case “special-offers”). you’ll probably get the rest from here

                        one note though: as people might have customised their css using direct selectors somewhere, i cannot hardcode a wrapper div around this , however, there are a couple of filters you can use to add this like so (add the below to your themes functions.php:

                        
                        /***************
                        wrap loop in div
                        with category id added to classname
                        ************/
                        add_action('wppizza_loop_outside_start', 'le879_wrap_loop_start',10,4);
                        function le879_wrap_loop_start( $the_query, $options,  $termSlug, $categoryId) {
                        if($the_query->found_posts>0){/*only add div if >0 posts*/
                        print"<div class='some-prefix-".$categoryId."'>";/*or use the termslug or whatever*/
                        }
                        }
                        add_action('wppizza_loop_outside_end', 'le879_wrap_loop_end',10,1);
                        function le879_wrap_loop_end($the_query) {
                        if($the_query->found_posts>0){/*only add div if >0 posts*/
                        print"</div>";
                        }
                        }
                        

                        i figure you can work it out from here, but if you have questions just shout

                        #5477
                        foxpc
                        Participant

                          Hi,
                          i want to say some good word, thank you very much! for your great work and support for this great plugin.
                          secend, i definitely will buy some add-ons after i will finish with the test.

                          #5486
                          foxpc
                          Participant

                            Hi,
                            i have noticed one problem.
                            you dont hide category title and description of category if category dont have menu item when you print all categories.
                            just add if category dont have menu item – dont print category title and description.

                            Thanks

                            #5487
                            Olly
                            Admin & Mod

                              >just add if category dont have menu item

                              not quite *that* simple (but i do remember thinking about – and then forgetting it)
                              will do . thanks for reminding me

                              #5492
                              Olly
                              Admin & Mod

                                then again, sometimes it is actually quite easy. try v2.11.2.1

                                (i also edited the filters above to account for that if you need to)

                              Viewing 14 posts - 1 through 14 (of 14 total)
                              • The topic ‘show all items from all categories in one page’ is closed to new replies.