WPPizza Shortcodes

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #5903
    Olly
    Admin & Mod

      **display orderpage**

      attributes:

      • type=’orderpage’ (required [str])

      examples:

      • [wppizza type='orderpage']

      **display items in category**

      attributes:

      • category=’pizza’ (optional: (string|array|!all). single slug, comma separated slugs or !all to display all (in conjunction with !all, you can also exclude categories by prefixing with “-” [minus]). if omitted entirely, will display the first category)
      • noheader=’1′ (optional: ‘anything’. omit attribute to show header. will suppress header (category title and description) in wppizza-loop.php. you can globally hide all category headers by setting “suppress headers” in wppizza->settings->layout.)
      • showadditives=’0′ (optional: ‘0’ or ‘1’. if omitted, a list of additives will be displayed if any of the category items has additives added. if set (0 or 1): force to display/hide additives list. useful when displaying more than 1 category on a page)
      • exclude=’6,5,8′ (optional [comma separated menu item id’s]): exclude some id’s
      • include=’6,5,8′ (optional [comma separated menu item id’s]): include only these id’s (overrides exclude)

      note: if you want to edit the category loop and/or headers, copy wppizza-loop.php from the plugins template directory into your theme directory and edit it there.

      examples:

      • [wppizza] =>will display all items in first category that has more than zero items
      • [wppizza category='pizza' noheader='1' showadditives='0' exclude='6,5,8'] => will display all items in category with slug "pizza", not showing headers or additives list and excluding items 6,5 and 8
      • [wppizza category='pizza,pasta'] => will display all items in category with slug "pizza" or "pasta"
      • [wppizza category='!all' exclude='6,5,8'] => will display all items in all categories but excluding items with id 6,5,8
      • [wppizza category='!all,-pizza,-drinks'] => will display all categories except "pizza" and "drinks".

      **display single menu item **

      attributes:

      • single=’11’ (required [str] – id of menu item to display)

      examples:

      • [wppizza single='11']

      **display bestsellers**
      (from ALL categories, sorted by number of sales descending. only items with sales >=1 are included )

      attributes:

      • bestsellers=’10’ (required: integer of how many items to display).
      • showadditives=’0′ (optional: ‘0’ or ‘1’. if omitted, a list of additives will be displayed if any of the items has additives added. if set (0 or 1): force to display/hide additives list. useful when displaying more than 1 category on a page)
      • include=’6,5,8′ (optional [comma separated menu item id’s]): ADDITIONALLY include these id’s to the bestsellers already displayed
      • ifempty=’5,9,8,11′ (optional [comma separated menu item id’s]): if no sales have been made yet and no include have been defined – mainly for new installations – set the menu item id’s you want to have displayed instead – ignores include attribute of appicable)

      examples:

      • [wppizza bestsellers='10' ifempty='5,9,8,11' showadditives='0' include='6,5,8']

      **display openingtimes**
      (returns grouped opening times in a string):

      attributes:

      • type=’openingtimes’ (required [str])

      examples:

      • [wppizza type='openingtimes']

      **display shopping cart**

      attributes:

      • type=’cart’ (required [str])
      • stickycart=’1′ (optional[bool]: anything. if its defined the cart will always be in viewpoint even when scrolling)
      • minicart=’1′ (optional[bool]: anything. if its defined the minicart will be visible according to your settings defined in wppizza->layout : minicart settings)
      • openingtimes=’1′ (optional[bool]: anything. if its defined openingtimes get displayed above cart)
      • orderinfo=1 (optional[bool]: anything. if its defined order info (discounts free delivery etc) get displayed below cart)
      • width=’200px’ (optional[str]: value in px or % -> defaults to 100%) (although < 150px is probably bad)
      • height=’200′ (optional[str]: value in px -> defaults to 250px)

      examples:

      • [wppizza type='cart' openingtimes='1' orderinfo='1' width='90%' height='350']

      **display the navigation**
      (to be used when using template files (i.e when using option 2)

      see What to do on first install ? -> option 2) here
      https://wordpress.org/plugins/wppizza/installation/
      :

      attributes:

      • type=’navigation’ (required [str])
      • title=’some title’ (optional[str]: will render as h2 as first element in cart element if set)
      • parent=’slug-name’ (optionsl [str]): only show child categories of this slug
      • exclude=’6,5,8′ (optional [comma separated category id’s]): exclude some id’s

      examples:

      • [wppizza type='navigation' title='some title' parent='slug-name' exclude='6,5,8']

      **display the users order history**
      (displays login form if not logged in, “anyone can register” has to be enabled)

      attributes:

      • type=’orderhistory’ (required [str])
      • maxpp=’5′ (optional [int]: how many orders to display per page – default=10)
      • multisite=’1′ (optional [str|int]: display orders from all blogs/sites – will be ignored in non-multiste setups. )
      • sitetitle=’1′ (optional [str|int]: display site/blog title for identification purposes next to order date on history page – will be ignored in non-multiste setups.)

      examples:

      • [wppizza type='orderhistory']
      • [wppizza type='orderhistory' maxpp='5'] => will display 5 orders per page
      • [wppizza type='orderhistory' multisite='1'] => will display all orders from all blogs for this user in a multisite setup
      • [wppizza type='orderhistory' multisite='1' sitetitle='1'] => will display all orders from all blogs for this user in a multisite setup and will display relevant blog/site title next to order date

      note: you would probably want to disable comments etc on that page

      **display a searchbox**

      attributes:

      • type=’search’ (required [str])
      • include=’wppizza,post,page,attachment,revision,nav_menu_item’ (optional[str]: include menu items, posts, pages and/or other cpts respectively)
      • loggedinonly=’1′ (optional[bool]: anything. if defined searchform only gets displayed for logged in users)

      examples:

      • [wppizza type='search' include='wppizza,post,page' loggedinonly='1']

      **display total value only**
      will display a small div with totals only

      attributes:

      • type=’totals’ (required [str])
      • value=’items’ (optional[str]: if set to ‘items’, only the total value of items will be displayed without delivery costs, discounts etc)
      • itemcount=’right’ (optional[left|right]: if set the count of items in cart will also be displayed to left or right of total
      • checkout=’1′ (wraps it all in a link to the checkout page)

      examples:

      • [wppizza type='totals' value='items' itemcount='right' checkout='1']

      note: the styling of this widget is very minimal, so you will probably want to use your own custom styles/css somewhere

      **add item to cart button elsewhere**

      if – for arguments sake – you are also using a different custom post type / plugin that displays some other menu items without having any cart or ecommerce options (or even if it has), you can link these items/posts to a wppizza menu item by displaying a button (with or without sizes dropdown if applicable) using the shortcode below.

      note that sizes are zero indexed:
      i.e, if your wppizza menu item has sizes “small”,”medium”,”large”,”xxl”, size=0 would be “small”, size=1 would be “medium” , size=2 would be “large” etc
      if your size id is invalid or has been omitted , the first available one will be used

      attributes:

      • type=’add_item_to_cart_button’ (required [str])
      • id=’1′ (required[int]: set the wppizza menu item id)
      • size=’0′ (optional[int]: set a specific size – zero indexed see above)
      • single=’1′ (optional[bool] force single button without dropdown options even if more than one size available)

      example:

      • [wppizza type='add_item_to_cart_button' id='6']

      note: for those buttons to do anything, the wppizza cart has to be on the page somewhere
      you might also need to style the button and dropdown as appropriate for your theme

      **show all additives elsewhere**

      example:

      • [wppizza type='additives']

      Note: the resulting div and spans have no styling but plenty of classes . style/css as required. something like this perhaps

      <style>
      .wppizza_additives{font-size:80%; text-align:center}
      .wppizza_additives > .wppizza_additive{padding:3px}
      .wppizza_additives > .wppizza_additive > .wppizza_additive_id{vertical-align: super; padding:0 2px; font-size:80%;}
      .wppizza_additives > .wppizza_additive > .wppizza_additive_id:before{content:'('}
      .wppizza_additives > .wppizza_additive > .wppizza_additive_id:after{content:')'}
      </style>
    Viewing 1 post (of 1 total)
    • The topic ‘WPPizza Shortcodes’ is closed to new replies.