Custom Fields
Re-Envisioned
Support MB Views Custom post types or taxonomies not showing in MB View

  • Creator
    Topic
  • #19031
    Resolved SAND
    Participant

    Hello,
    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,
    Sandra

Viewing 10 replies - 1 through 10 (of 16 total)
  • Author
    Replies
  • #19032
    Long Nguyen
    Moderator

    Hi Sandra,

    By default, all the post fields will show on the tab Post, see my screenshots
    https://cl.ly/e923f9b77fd5
    https://cl.ly/53485a259d05

    Could you please clear the cache and check the Insert Field again? Or take some screenshots in your end.

    #19075
    SAND
    Participant
    #19076
    SAND
    Participant
    #19077
    SAND
    Participant

    I tried adding screenshots before but without succes.
    I’ve now copied the links to the screenshots one by one in the former replies.

    #19085
    Long Nguyen
    Moderator

    Hi,

    To insert the taxonomies, please use the post field Post term list
    see my screenshot https://cl.ly/d65c03f5cde2

    #19093
    SAND
    Participant

    Ah 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?

    #19094
    SAND
    Participant

    Oh 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?

    https://share.getcloudapp.com/geuWZmQE

    #19098
    Long Nguyen
    Moderator

    Hi,

    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.

    #19101
    SAND
    Participant

    Hi,
    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)

    #19111
    Long Nguyen
    Moderator

    Hi,

    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 Proxy mb.

    For more information, please follow the documentation
    https://developer.wordpress.org/reference/functions/get_terms/

Viewing 10 replies - 1 through 10 (of 16 total)
  • You must be logged in to reply to this topic.