How do you remove or modify the list of links shown after the content?
2 Answers
In your theme's template.php file, add this snippet:
function THEMENAME_preprocess_node(&$variables) {
if ($variables['is_front']) {
unset($variables['content']['links']);
}
}
Remember to clear the cache afterward. And replace THEMENAME with your actual theme.
-
@tim.plunkett I use zen theme when i insert your code inside my template.php i got
server error
message. what should i do? THanks,– joneCommented May 12, 2011 at 9:03 -
-
@Berdir i did like this:
function STARTERKIT_preprocess_node(&$variables) { if ($variables['is_front']) { unset($variables['content']['links']); } }
and i cleared the cache. the page is come up but nothing is changed i still see the read more links. What should i do?– joneCommented May 16, 2011 at 7:32 -
I'm no sure, try to see what value $variables['is_front'] has by printing it out, maybe you need a different condition– BerdirCommented May 16, 2011 at 9:03
-
You could also comment out the if completely, then the links should be always be hidden. And of course, make sure that your function is actually called, did you clear the theme registry cache and so on?– BerdirCommented May 16, 2011 at 9:04
Modify the node template...
You can use node template overrides such as "node-fonts.tpl.php" where "fonts" is the name of the node type. You will copy "node.tpl.php" to make this then modify it to your liking. This template is found in "[SITE ROOT]/modules/node/". Copy this to your theme folder. When I do this I create a subfolder called "node" to help organize the theme overrides.
If you want an easier solution then I would use ConTemplate (otherwise known as Content Template). This will allow you to control this from the content type admin config (creates a template tab which has options for the teaser and the full node). This also provides details about the available variables and sample data from the last inserted node of the type you are looking at.