Please help me to add taxonomy terms from custom taxonomy into home page. I have no idea how to do this as I'm coming from WordPress. In WordPress it is easy as calling get_terms(). I have following file as my home page: mytheme/templates/page--front.html.twig
I have more than one taxonomy type and all of them are going to queried in the home page.
How to query the taxonomy terms?
UPDATE:
I have created a new region called home_content in my theme.info.yml and I have created a view(block) for getting the taxonomy terms, added it to region in back-end and display it as {{page.home_content}}. It works but I have few questions.
I have fields for logo and text in the taxonomy. I want to list them too.
I need to customize the html. How can I do that?
Thanks for the support.
You don't really need to code anything
Create view with taxonomy terms required. Structure > Views > Create New View and add block view for taxonomy terms. User filter section to select specific terms or dictionaries. Save the view.
Go to Structure > Block Layout and insert block with your view into desired region. In visibility section, pages tab: type <front> in pages and select Show for the listed pages in order to display it on home page only.
Above steps will display your required terms on home page.
To copy and modify template(s) in your theme, follow the instructions on drupal.org: https://www.drupal.org/node/2358785
Related
I have woocommerce plugin. I created a custom tag taxonomy under products to pick the product ingredients. ( https://pasteboard.co/J2BlgqI.png ). To show them as buttons on the product page ( https://pasteboard.co/J2Bn7FD.jpg ).
Now I want the visitor when they click on the ingredient it shows them an ingredient page information. So, if they click on “Beeswax” it shows them Beeswax information like name, function and etc…
Each time I click on “Beeswax it directs me to a filter page https://pasteboard.co/J31hg2w.png .
How can I make a page for each ingredient?
Is it even doable this way? or is there another way to accomplish this?
please advice…
thanks
Yes you can have custom templates for your taxonomies. The template hierarchy explains everything.
Custom taxonomies use this template file path:
taxonomy-{taxonomy}-{term}.php – If the taxonomy is sometax, and taxonomy’s term is someterm, WordPress will look for
taxonomy-sometax-someterm.php. In the case of post formats, the
taxonomy is ‘post_format’ and the terms are ‘post-format-{format}.
i.e. taxonomy-post_format-post-format-link.php for the link post
format.
taxonomy-{taxonomy}.php – If the taxonomy were sometax, WordPress would look for taxonomy-sometax.php.
taxonomy.php
archive.php
index.php
Since you haven't created a taxonomy-ingredients.php WordPress uses the next available option and falls back to the generic template.
You can even create a different template (page) for each of your Ingredient by using the first option above.
I am using Drupal 8.
I have created a simple view. It is designed so that content with a taxonomy term (category) has a contextual filter.
I am wanting that a user can click on a category in an a custom content type of HowTo, and go to that category page, and on that page they can see a list of all other HowTo articles with the same category.
In the view editor, in the preview, it is working, with the contextual filter.
However, when I try this on the category page, it does not work.
Any ideas on how to fix this?
The issue for me was the url alias pattern was category/[term:name] and my view url was category/%. I changed the alias to [term:name] and it started working. So now my terms can be viewed at category/term.
I think the taxonomy term node was overriding the view display.
I had the same problem. In my case, was caused by having multiple views with the same path.
So, I work at a web development agency and we recently decided to give our custom CMS up and start developing with Drupal. Currently, I am developing a wholesale product website. What I need to do is to create some product catalogs without using commerce since we do not need the purchase, checkout and payment features and I thought that using the built-in Content, Taxonomy and Views features we can get our job done.
I have created the product categories in Taxonomy. The main (root) categories are main Taxonomy objects and the subcategories are terms.
I created a custom Content type called: products. In this type I have the following form fields: Product Code, Name, Image, Description and a list field to choose the Terms I would like the product to be displayed in.
I would appreciate some help in order to set the whole structure up as I am still heavily influenced by the custom CMS we used to work on that had similar content management with Joomla!
In conclusion, I would like to:
Set a sidebar menu up that contains the categories and the subcategories as a tree. I would also like the menu to be updated if any changes occur in the taxonomy (e.g I add a term in taxonomy and it shows up on the menu).
Set the structure so that when someone clicks on a category that does NOT contain products but subcategories, gets the list of the categories bellow the active one.
I am really looking forward to your answers and I'd like to thank you in advance.
You could give a try to a combination of Taxonomy Menu and Menu Block modules. Taxonomy Menu allows you to easily generate menus from taxonomy vocabularies, and Menu Block creates menus and "menus portion", for instance, from level 2 to 3 from a specific point.
So basically, you can create menus from taxonomy and then create submenus from those menus with Menu Block. It can be tricky but you can do a lot of things with these modules.
Good luck
I am really working hard to get a specific Post view in my Wordpress blog.
Example
Click http://theunlockr.com/roms/
Then Click http://theunlockr.com/roms/android-roms/
Then CLick http://theunlockr.com/roms/android-roms/asus-roms/
I figured that this is a nested view of categories and subcategories and finally the post in the respective category.
Need some input on how to do this on a basic wordpress blog.
I have already tried page builder and Grid views and alot of plugins, but cant really make this kind of view.
This is done via custom post types and custom taxonomies.
For example, you could create a custom post type rom, and assign the custom taxonomy roms with child categories Android ROMs -> Asus ROMs. This child category is assigned to the custom post type.
I have enabled the taxonomy menu module and created a custom view from my vocabulary terms. However, the taxonomy menu terms are by default in the following structure [taxonomy_category]/[term-name] and link to the default taxonomy view.
How can I override the default taxonomy term links to link to my view page?I want to link the taxonomy term to this view page : products/term_id . I have downloaded taxonomy display module but either I didn't know how to configure it correctly or it doesn't work....
Anybody, who knows how can I change the links of the taxonomy terms?
Thanks!
there's a default (disabled) view that links to "taxonomy/term/term_id". You should enable that view and make the necessary changes to suit your needs.
Otherwise, you can create a view.
In the "Page Settings" you have the path.
Just put "/taxonomy/term/%" in the path.
It worked for me.