1

I have a view listing nodes of my taxonomy terms. All well and good and my view shows nodes of every taxonomy term with the taxonomy term name as the view title.

My taxonomy terms though have an image assigned to them. So is there any hook or any other way to show the taxonomy term title next to its corresponding image? Something like this?

Example image:

enter image description here

And here is a screenshot of the view. Notice the path that is taking the term id as a parameter to display nodes of a specific term.

EDIT: I am using the default Taxonomy Term View

Views UI

enter image description here

8
  • My taxonomy terms though have an image assigned to them. How did you assign the image to taxonomy term?
    – CodeNext
    Commented Aug 9, 2016 at 8:44
  • I created an image field. So every taxonomy term has an image also.
    – pierostz
    Commented Aug 9, 2016 at 9:05
  • Can you please paste a screen-shot of your Views UI Setting section, So it is very easy to answerer to understand. So, everybody can be on same page and can give you better suggestion.
    – CodeNext
    Commented Aug 9, 2016 at 9:22
  • I edit the question. Is it clear enough now or you want me to elaborate more?
    – pierostz
    Commented Aug 9, 2016 at 9:28
  • One question, While creating views, one very first page, you have a option of choosing Views of............... Did you choose Content or Taxonomy term?
    – CodeNext
    Commented Aug 9, 2016 at 9:39

2 Answers 2

2

I would use Panels for that. You may combine any elements from Drupal on the same page (node fields, views, terms, blocks, etc.) with Panels.

With this module you can edit the taxonomy term page as you wish (Structure > Pages > Taxonomy view > Active then edit).

In the Content section, after setting path, context and layout, you add your taxonomy term custom image field, followed by your taxonomy term name (with a little CSS float, you will have your image on the left).

Finally, you add your View below (do not forget to activate the Chaos tools sub-module "Views content panes") and you're done.

Panels needs a little practice but it is a powerful tool to work on page templates.

1

Thanks to @Toki I figured out a simple solution using Context instead of Panels.

  1. I created a new view of taxonomy terms with a contextual filter of Term ID provided by the URL. In my View I have a limit of one item to display, and I show only the term name and icon field without anything else.
  2. I created a block and using Context I placed my block to the Term Pages (I don't think this is needed because the Block will only show up in Taxonomy Term pages anyway, because of the Contextual Filter).
  3. I added some css and done.

Sometimes we complicated things. Thanks again @Toki for the main idea.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.