Community & Support

View page title from term description

Hi there.

I have a view page that displays only nodes which use a specific taxonomy term (filter). Now I want to display the description of this term as the title of the view page.

I searched the forums and tried out a couple fo things but to no avail. Any help appreciated!

Comments

Solution

1) Create a different template for the taxonomy page: http://drupal.org/node/104316

2) In the title of page-taxonomy.tpl.php

<h1 class="title">
<?php
$current
= taxonomy_get_term(arg(2));
echo
$current->description;
?>

</h1>

Subscribing, also solution

Subscribing, also solution available for panels page title with node-overrule please?
Greetings, Martijn

Do you mean...

Thank you, tekken, for

Thank you, tekken, for posting this solution.

I was able to just add this to my page.tpl.php file and it works great without having to create a new template file (in the original poster's post, they needed it as the page title.):

<?php $current = taxonomy_get_term(arg(2)); ?>
<?php if ($current): ?>
    <div class="taxonomy-description">
        <?php echo $current->description; ?>
    </div>
<?php endif; ?>

I placed this in page.tpl.php

I placed this in page.tpl.php and it worked for all taxonomies under a vocabulary, but it did not work if I placed it in page-vocabulary.tpl.php. Any ideas why?

Also how do you do this for top level vocabularies because it didn't show up for the vocabulary when I did put it in page.tpl.php and only showed up for all the terms under the vocab...Thanks!!!

Hi, Maybe stupid. But

Hi, Maybe stupid. But shouldn;t it be page-taxonomy.tpl.php ?
greetings, Martijn

Yeah, I have a

Yeah, I have a page-taxonomy.tpl.php but I think the php code needs to be something with taxonomy_get_vocabulary, but I don't know what it should be since trying different taxonomy_get_* didn't work....

just for people like me

Yu must put this code to title and select php filltering :)

I ♥ Drupal.

You can also add this snippet

You can also add this snippet right into the view's header by turning on PHP filter module and choosing PHP as the input format.

thanks!

thanks - that worked... =)

How to fill term description automatically

How to fill term description automatically

Hello,

Do you know how to complete terms pages automatically ?

I mean at least copy the same term word to the description and keywords fields.

Thanks a lot.

Meta description for taxonomy views

I am also trying to give taxonomy views a meta description, does anyone know how to do that?

nobody click here