Custom template for taxonomy term page in Drupal 7
Hi All, I want to customize taxonomy term page for particular vocabulary. (for all vocabulary is also fine) I am able to customize look and feel of node teasers by using http://drupal.org/node/1106090 It provides a way to style the node differently while listing vs displaying full node. Now i want to have separate template for taxonomy term page. I don't see any default "Drupal 7 Template Suggestions" at http://drupal.org/node/1089656 Anyone know how to achieve this? Thanks in advance. -- :DJ
Using the Views module http://drupal.org/project/views, you can override the basic taxonomy/term/[tid] then under the "Theme: Information" link in the Views UI, leverage the views template suggestions as part of your theme to customize the markup. On Mon, Apr 18, 2011 at 8:07 AM, Deva <devendra.in@gmail.com> wrote:
Hi All,
I want to customize taxonomy term page for particular vocabulary. (for all vocabulary is also fine) I am able to customize look and feel of node teasers by using http://drupal.org/node/1106090 It provides a way to style the node differently while listing vs displaying full node.
Now i want to have separate template for taxonomy term page. I don't see any default "Drupal 7 Template Suggestions" at http://drupal.org/node/1089656
Anyone know how to achieve this?
Thanks in advance.
-- :DJ
Thanks Carl. Is there any other solution like updating template.php file to force Drupal to use our custom template like "page-taxonomy.tpl.php" as this is possible in D6. On Mon, Apr 18, 2011 at 9:41 PM, Carl Wiedemann <carl.wiedemann@gmail.com>wrote:
Using the Views module http://drupal.org/project/views, you can override the basic taxonomy/term/[tid] then under the "Theme: Information" link in the Views UI, leverage the views template suggestions as part of your theme to customize the markup.
On Mon, Apr 18, 2011 at 8:07 AM, Deva <devendra.in@gmail.com> wrote:
Hi All,
I want to customize taxonomy term page for particular vocabulary. (for all vocabulary is also fine) I am able to customize look and feel of node teasers by using http://drupal.org/node/1106090 It provides a way to style the node differently while listing vs displaying full node.
Now i want to have separate template for taxonomy term page. I don't see any default "Drupal 7 Template Suggestions" at http://drupal.org/node/1089656
Anyone know how to achieve this?
Thanks in advance.
-- :DJ
-- :DJ
Yes, you can define your own template suggestions via template preprocess functions. See http://drupal.org/node/223440 On Mon, Apr 18, 2011 at 10:29 AM, Deva <devendra.in@gmail.com> wrote:
Thanks Carl.
Is there any other solution like updating template.php file to force Drupal to use our custom template like "page-taxonomy.tpl.php" as this is possible in D6.
On Mon, Apr 18, 2011 at 9:41 PM, Carl Wiedemann <carl.wiedemann@gmail.com>wrote:
Using the Views module http://drupal.org/project/views, you can override the basic taxonomy/term/[tid] then under the "Theme: Information" link in the Views UI, leverage the views template suggestions as part of your theme to customize the markup.
On Mon, Apr 18, 2011 at 8:07 AM, Deva <devendra.in@gmail.com> wrote:
Hi All,
I want to customize taxonomy term page for particular vocabulary. (for all vocabulary is also fine) I am able to customize look and feel of node teasers by using http://drupal.org/node/1106090 It provides a way to style the node differently while listing vs displaying full node.
Now i want to have separate template for taxonomy term page. I don't see any default "Drupal 7 Template Suggestions" at http://drupal.org/node/1089656
Anyone know how to achieve this?
Thanks in advance.
-- :DJ
-- :DJ
This will help. Thanks a ton. On Mon, Apr 18, 2011 at 10:08 PM, Carl Wiedemann <carl.wiedemann@gmail.com>wrote:
Yes, you can define your own template suggestions via template preprocess functions. See http://drupal.org/node/223440
On Mon, Apr 18, 2011 at 10:29 AM, Deva <devendra.in@gmail.com> wrote:
Thanks Carl.
Is there any other solution like updating template.php file to force Drupal to use our custom template like "page-taxonomy.tpl.php" as this is possible in D6.
On Mon, Apr 18, 2011 at 9:41 PM, Carl Wiedemann <carl.wiedemann@gmail.com
wrote:
Using the Views module http://drupal.org/project/views, you can override the basic taxonomy/term/[tid] then under the "Theme: Information" link in the Views UI, leverage the views template suggestions as part of your theme to customize the markup.
On Mon, Apr 18, 2011 at 8:07 AM, Deva <devendra.in@gmail.com> wrote:
Hi All,
I want to customize taxonomy term page for particular vocabulary. (for all vocabulary is also fine) I am able to customize look and feel of node teasers by using http://drupal.org/node/1106090 It provides a way to style the node differently while listing vs displaying full node.
Now i want to have separate template for taxonomy term page. I don't see any default "Drupal 7 Template Suggestions" at http://drupal.org/node/1089656
Anyone know how to achieve this?
Thanks in advance.
-- :DJ
-- :DJ
-- :DJ
One more question. How to identify in "preprocess_page" function, if the current loading page is "Taxonomy Term" page. On Mon, Apr 18, 2011 at 10:12 PM, Deva <devendra.in@gmail.com> wrote:
This will help. Thanks a ton.
On Mon, Apr 18, 2011 at 10:08 PM, Carl Wiedemann <carl.wiedemann@gmail.com
wrote:
Yes, you can define your own template suggestions via template preprocess functions. See http://drupal.org/node/223440
On Mon, Apr 18, 2011 at 10:29 AM, Deva <devendra.in@gmail.com> wrote:
Thanks Carl.
Is there any other solution like updating template.php file to force Drupal to use our custom template like "page-taxonomy.tpl.php" as this is possible in D6.
On Mon, Apr 18, 2011 at 9:41 PM, Carl Wiedemann < carl.wiedemann@gmail.com> wrote:
Using the Views module http://drupal.org/project/views, you can override the basic taxonomy/term/[tid] then under the "Theme: Information" link in the Views UI, leverage the views template suggestions as part of your theme to customize the markup.
On Mon, Apr 18, 2011 at 8:07 AM, Deva <devendra.in@gmail.com> wrote:
Hi All,
I want to customize taxonomy term page for particular vocabulary. (for all vocabulary is also fine) I am able to customize look and feel of node teasers by using http://drupal.org/node/1106090 It provides a way to style the node differently while listing vs displaying full node.
Now i want to have separate template for taxonomy term page. I don't see any default "Drupal 7 Template Suggestions" at http://drupal.org/node/1089656
Anyone know how to achieve this?
Thanks in advance.
-- :DJ
-- :DJ
-- :DJ
-- :DJ
You could use arg() http://api.drupal.org/api/drupal/includes--path.inc/function/arg/6 if (arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2))) { ... } On Mon, Apr 18, 2011 at 10:47 AM, Deva <devendra.in@gmail.com> wrote:
One more question. How to identify in "preprocess_page" function, if the current loading page is "Taxonomy Term" page.
On Mon, Apr 18, 2011 at 10:12 PM, Deva <devendra.in@gmail.com> wrote:
This will help. Thanks a ton.
On Mon, Apr 18, 2011 at 10:08 PM, Carl Wiedemann < carl.wiedemann@gmail.com> wrote:
Yes, you can define your own template suggestions via template preprocess functions. See http://drupal.org/node/223440
On Mon, Apr 18, 2011 at 10:29 AM, Deva <devendra.in@gmail.com> wrote:
Thanks Carl.
Is there any other solution like updating template.php file to force Drupal to use our custom template like "page-taxonomy.tpl.php" as this is possible in D6.
On Mon, Apr 18, 2011 at 9:41 PM, Carl Wiedemann < carl.wiedemann@gmail.com> wrote:
Using the Views module http://drupal.org/project/views, you can override the basic taxonomy/term/[tid] then under the "Theme: Information" link in the Views UI, leverage the views template suggestions as part of your theme to customize the markup.
On Mon, Apr 18, 2011 at 8:07 AM, Deva <devendra.in@gmail.com> wrote:
Hi All,
I want to customize taxonomy term page for particular vocabulary. (for all vocabulary is also fine) I am able to customize look and feel of node teasers by using http://drupal.org/node/1106090 It provides a way to style the node differently while listing vs displaying full node.
Now i want to have separate template for taxonomy term page. I don't see any default "Drupal 7 Template Suggestions" at http://drupal.org/node/1089656
Anyone know how to achieve this?
Thanks in advance.
-- :DJ
-- :DJ
-- :DJ
-- :DJ
On 04/18/2011 11:47 AM, Deva wrote:
One more question. How to identify in "preprocess_page" function, if the current loading page is "Taxonomy Term" page. Assuming you actually want to theme and change the page.tpl.php or add a template suggestion at that level and not at the lower preprocess_taxonomy_term() level then you would do so the same way that anyother path is checked. L
ook in the hook_menu for taxonomy and youll find a section there the "real drupal path" is defined. Then use the arg() function test for that path in your preprocess function. Alternatively you can add your suggestion ANY time you find this to be true: in_array('page__taxonomy', $variables['theme_hook_suggestions']); Please use dpm() and the devel module or a debugger to get more information. -- Michael Favia michael@favish.com tel. 512.669.5650 http://www.favish.com
Thanks Carl & Michael. On Mon, Apr 18, 2011 at 10:26 PM, Michael Favia <michael.favia@gmail.com>wrote:
On 04/18/2011 11:47 AM, Deva wrote:
One more question. How to identify in "preprocess_page" function, if the current loading page is "Taxonomy Term" page.
Assuming you actually want to theme and change the page.tpl.php or add a template suggestion at that level and not at the lower preprocess_taxonomy_term() level then you would do so the same way that anyother path is checked. L
ook in the hook_menu for taxonomy and youll find a section there the "real drupal path" is defined. Then use the arg() function test for that path in your preprocess function.
Alternatively you can add your suggestion ANY time you find this to be true:
in_array('page__taxonomy', $variables['theme_hook_suggestions']);
Please use dpm() and the devel module or a debugger to get more information.
-- Michael Favia michael@favish.com tel. 512.669.5650 http://www.favish.com
-- :DJ
You can also use menu_get_object(), which is arguably cleaner than using arg(). On Apr 18, 2011, at 1:02 PM, Deva <devendra.in@gmail.com> wrote:
Thanks Carl & Michael.
On Mon, Apr 18, 2011 at 10:26 PM, Michael Favia <michael.favia@gmail.com> wrote: On 04/18/2011 11:47 AM, Deva wrote:
One more question. How to identify in "preprocess_page" function, if the current loading page is "Taxonomy Term" page.
Assuming you actually want to theme and change the page.tpl.php or add a template suggestion at that level and not at the lower preprocess_taxonomy_term() level then you would do so the same way that anyother path is checked. L
ook in the hook_menu for taxonomy and youll find a section there the "real drupal path" is defined. Then use the arg() function test for that path in your preprocess function.
Alternatively you can add your suggestion ANY time you find this to be true:
in_array('page__taxonomy', $variables['theme_hook_suggestions']);
Please use dpm() and the devel module or a debugger to get more information. -- Michael Favia michael@favish.com tel. 512.669.5650 http://www.favish.com
-- :DJ
participants (4)
-
Carl Wiedemann -
Deva -
Ken Rickard -
Michael Favia