[Resolved] Allow for tags to be ordered by order added, not in alphabetical order in a view
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
I have a cpt to highlight certain research journal articles. The custom cpt comes with a dedicated tag style taxonomy for the journal article authors. For the custom cpt I use a toolset view to display the date. Unfortunately, when setting up the view, I can only select to show the authors in alphabetical order (ascending or descending). However, I need to be able to retain the original author structure.
Is there any documentation that you are following?
It seems like a general wordpress / gutenberg issue to some degree, but as discussed here, hidden link the order of tags added is registered in the database so technically it should be possible to for it to retain the order?!
Is there a way to get the tags (in my case the author names) show up in the right and thus non-alphabetical order?
Hello. Thank you for contacting the Toolset support.
Let me review if I can offer you any workaround or is there is possible solution to your issue and for that I will require problem URL where I can see the issue as well as admin access details.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
So I tested your code with both a core and cpt taxonomy and it doesn't work. Here's what I am seeing:
When I include the shortcode without the code snippet being activated: It just shows the shortcode on the front end
When I activate the code snippet without the taxonomy specified: I see the correct print of the taxonomy called for with the shortcode, but with the same alphabetical order like in the original
When I include the taxonomy in the code snippet: Everything disappears, nothing is printed on the front end
In Debug.php I then get the following message:
[09-Feb-2023 16:21:35 UTC] PHP Notice: Undefined index: key-feature in /var/www/web124/htdocs/FSLCITest/wp-content/toolset-customizations/ordertax.php on line 14
key-feature in this case is the slug for my taxonomy.
Let me know if there's anything I can do to further debug.
You can use the login provided earlier and then test your code yourself. I have tested it based on the CPT "Tools", for which you can edit the content template here: hidden link
The corresponding front-end test post is called "Test Entry" and visible here: hidden link
Thanks so much for the revision. Indeed, it does work on the dev site now, which is awesome. However, for some reason beyond my understanding, I can't get it to work on my live site.
The main issue is that on the live site, the shortcode is not resolving, even before I activate the custom code to change the order. I copied it over from the test site and changed the taxonomy, it just displays the shortcode on the front end. Equally so, if I change the taxonomy to another one, or enter the code directly into an entry instead of the content template.
Here you can see that it's not working: hidden link
If I activate the code snippet, then the shortcode disappears on the front end but then nothing is shown. Any idea what might be causing the issue? I don't understand why it's working on my dev but not on my live env.
Ok, I figured out what the issue was: In your code snippet you still had "// change this to your taxonomy" but then left it as a general call to "taxonomy" in the actual code - which I didn't see until a moment ago. Now, if I leave it as taxonomy and don't change it, then the shortcode is properly resolved 🙂
However, now I've run into another, more layout related issue:
The items now appear stacked instead of in a list as you can see here: hidden link
Not sure why, but that doesn't look great. Also, I would like to include "Author:" before the shortcode is displaying the authors - essentially I want to replace the fields I'm already showing now below but with the correct order of authors 🙂
Your support is greatly appreciated!
Kind regards, Philip
P.S. I can't give you access to the live site due to Data Protection issues...
I solved it myself by using the Fields and Text Field to include the "Author:" text and now it's displayed also in a list as I wanted. Thanks so much for your support, much appreciated 🙂
My issue is resolved now. Thank you!
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.