Advertising sustains the DA. Ads are hidden for members. Join today

Print service links from page.tpl.php

Last updated on
30 April 2025

If you need to control exactly where service links get printed, and want the links printed outside the node content —read on. Add the following code to your template.php. Replace theme_ with your theme name.

<?php
function theme_preprocess_page(&$vars, $hook) {
  if (module_exists('service_links')) {
    $vars['service_links'] = theme('links', service_links_render($vars['node'], TRUE));
  }
}
?>

$service_links is now available within your template.tpl.php -file, and you are able to print it out anywhere you like with

<?php 
if ($service_links): 
  print $service_links; 
endif; 
?>

Help improve this page

Page status: Not set

You can: