php


'Order by' specified order in Woocommerce shortcode


I am currently using the shortcode:
[product_categories ids="135, 214, 244, 1958, 72, 205, 43, 559, 73, 1033, 69, 2009, 1365, 1250, 462, 346, 1649, 1344, 1379, 1373" orderby="id"]
to display Woocommerce product categories on a Wordpress site. It works, but I need the categories to be displayed in the order that they're listed in the ids quotations. I know of orderby="name", "date", and "id", and none of those will work for this particular task unless you know of any nifty hacks that involve them.
Any Ideas? Thanks
I haven't solved the issue but I'm going to post this work around as an answer in case anyone else is struggling with this.
Just re-ordered the sub-categories in the order you want them displayed manually. Do this with the drag-and-drop method in WooCommerce > products > categories. Then in your short-code, write:
[product_categories parent="*your parent category id*" ids="*the sub-category ids you want displayed*" hide_empty="0"]
This will display your specified sub categories in the order that you put them in with the drag and drop.
Note:
If you want to hide categories without any products in them remove the 'hide_empty' portion of the short-code. Also when displaying multiple sub categories, remember that the ids are separated by commas. ie: ids="1, 2, 3"
If anyone knows the short-code solution please post/comment, because the drag and drop method is very time consuming when you have hundreds of categories.

Related Links

How to get and display post's “position” in the query?
Unexpected behavior when calling a Ruby script via PHP's shell_exec()
One cookie with many values or many cookies with one value?
dynamic stylesheet
Getting Post Information Outside the Wordpress Loop
I want to call a class object, being the class name a given parameter
code effect in html/blog
Symfony 1.4: Programatically set environment for CLI
PHP Call Time Pass Reference
How dangerous is allowing Flash in a blog?
what's wrong with this php code?
php echo include
PEAR's mail queue alternative?
Is PHP PEAR included with php?
Sort array by object property in PHP?
Invert function: base 38 conversion

Categories

HOME
php
office365
exchange-server
applescript
plaid
risk-management
twitter-fabric
turbojpeg
video-streaming
mithril.js
cdi
eddystone
watch-os-3
android-externalstorage
tomcat8
infrared
pfobject
sqlplus
quantitative-finance
hevc
miniprofiler
docx4j
envoy
es6-modules
windows2012
quick-nimble
sca
om-next
image-optimization
xvfb
nanogallery
strapi
reset
slideshow
coverage.py
transparency
sendinput
vesta
directwrite
sonicmq
android-mediarecorder
gmaps.js
.when
front-camera
cefpython
jpda
livecycle
nunit-console
unsigned
maximize
jeasyui
android-async-http
textblock
preferenceactivity
psd
dsa
ngcordova
google-gdk
mobilefirst-server
textscan
unidata
hp-idol-ondemand
multivariate-testing
nidaqmx
otl
screwturn
refit
miglayout
xulrunner
tabletools
usb-flash-drive
colon
hints
web-frameworks
arel
multiscaleimage
xcode4.5
radscheduler
filelock
css-friendly
servlet-container
channelfactory
mygeneration
j2mepolish
jquery-effects
activex-exe

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App