Custom post types or taxonomies not showing in MB View
- This topic has 17 replies, 3 voices, and was last updated 4 years, 6 months ago by
A..
-
AuthorPosts
-
April 14, 2020 at 8:46 PM #19031
SAND
ParticipantHello,
I'm trying to use Views to display custom taxonomy terms on the homepage.
But when I click on "Insert field" only post fields are showing, custom post types or taxonomies are not shown.
Do you know why the fields of custom post types or taxonomies are not showing?Thanks in advance,
SandraApril 14, 2020 at 10:06 PM #19032Long Nguyen
ModeratorHi Sandra,
By default, all the post fields will show on the tab Post, see my screenshots
https://cl.ly/e923f9b77fd5
https://cl.ly/53485a259d05Could you please clear the cache and check the Insert Field again? Or take some screenshots in your end.
April 16, 2020 at 11:38 PM #19075SAND
ParticipantApril 16, 2020 at 11:39 PM #19076SAND
ParticipantApril 16, 2020 at 11:40 PM #19077SAND
ParticipantI tried adding screenshots before but without succes.
I've now copied the links to the screenshots one by one in the former replies.April 17, 2020 at 9:13 AM #19085Long Nguyen
ModeratorHi,
To insert the taxonomies, please use the post field
Post term list
see my screenshot https://cl.ly/d65c03f5cde2April 17, 2020 at 2:49 PM #19093SAND
ParticipantAh great, thanks Long!
But when I paste the shortcode on the page, nothing is shown on the front page and Elementor is not loading in the backend.
https://share.getcloudapp.com/geuWZmQE
When I click "Edit with Elementor" (on the page with the shortcode) Elementor is not loading. I see the next error:
"
Uncaught Twig_Error_Loader: Template "template" is not defined. in /home/..../wp-content/plugins/meta-box-builder/vendor/twig/twig/lib/Twig/Loader/Array.php:80
Stack trace:
#0 /home/..../wp-content/plugins/meta-box-builder/vendor/twig/twig/lib/Twig/Environment.php(329): Twig_Loader_Array->getCacheKey('template')
#1 /home/.../wp-content/plugins/meta-box-builder/vendor/twig/twig/lib/Twig/Environment.php(419): Twig_Environment->getTemplateClass('template')
#2 /home/.../wp-content/plugins/meta-box-builder/vendor/twig/twig/lib/Twig/Environment.php(362): Twig_Environment->loadTemplate('template')
#3 /home/.../wp-content/plugins/mb-views/src/Renderer.php(42): Twig_Environment->render('template', Array)
#4 /home/..../wp-content/plugins/mb-views/src/Shortcode.ph
"Am I doing something wrong?
April 17, 2020 at 3:02 PM #19094SAND
ParticipantOh sorry, I used a view which was deleted.
I'm using the right shortcode now and Elementor is loading but still nothing is shown on the front end.
Is there something wrong with the view?
April 17, 2020 at 6:57 PM #19098Long Nguyen
ModeratorHi,
I've made a short screen record about using Views shortcode and add to Elementor widget shortcode https://www.loom.com/share/9049c378c176415793dbc82168572b34
Remember don't add the Location in the View item because the location page will use a specific template (generated by this extension) and you cannot edit this page with Elementor any more.
April 17, 2020 at 10:20 PM #19101SAND
ParticipantHi,
Thanks a lot for the screen record! I understand now why it wasn't working.Sorry, one more question:
Is it also possible with a shortcode to list all the terms of a taxonomy on for instance the home page? Like all the symptoms in the taxonomy symptoms? (independent of the post)
April 18, 2020 at 11:38 AM #19111Long Nguyen
ModeratorHi,
In View, you can use this sample code to list the terms of the taxonomy
<h2>Categories: </h2> {% set terms = mb.get_terms( 'category' ) %} {% for term in terms %} {{term.name}} <br> {% endfor %}
use the function
get_terms()
supported by WordPress via Proxymb.
For more information, please follow the documentation
https://developer.wordpress.org/reference/functions/get_terms/April 19, 2020 at 2:47 PM #19121SAND
ParticipantOk, thanks Long for all your good and quick answers!
Highly appreciated.April 20, 2020 at 5:45 PM #19164SAND
ParticipantThanks!
With some trial and error I managed to add the links to the term archive.
I've used the following code:{% set terms = mb.get_terms( 'symptoom' ) %} {% for term in terms %} {% set termlink = mb.get_term_link(term)%} <a href="{{termlink}}">{{term.name}}</a> , {% endfor %}
It works, but I'm not sure if this is the best way to write the code.
So, please show me if I should write it differently.April 21, 2020 at 9:17 AM #19172Long Nguyen
ModeratorHi,
Yeah, the code shows the terms of
symptoom
and link to the archive page as well. Keep up the good work.April 21, 2020 at 2:33 PM #19182SAND
ParticipantThanks, with your help I'm learning to use Metabox.io and I'm finding out it can really do a lot! Next thing I'm going to use is MB Relationships and MB Admin Columns.
-
AuthorPosts
- You must be logged in to reply to this topic.