I've been stuck on getting a custom preprocess_node function to work in a Drupal 6 install. I can get it to echo out things based on values but I just can't seem to get overrides working. The latest thing I've tried is the answer described in the answer on this page. If I do:
$node->title = "Test";
and do a print_r on the $node I can see that it is overridden in the array with the new value but the title that's being output is still the old one. I've also tried setting $variables[title] but no luck. I'm actually trying to target something deeper than the title but thought I'd start with this. Here's an example I've tried putting in the template.php file. I've replaced my actual theme name with mythemename.
function mythemename_preprocess_node(&$variables) {
//Profiles
if($variables['type'] == "child_profile"){
$node = $variables['node'];
$node->title = "Test";
//This echo correctly shows the new title but it's not actually overriding anything
echo $node->title;
$variables['node']=$node;
}}
page
, so the title could be overridden usinghook_preprocess_page
. Try to override the things that you want to override and let us know if it's still not working. – Beebee Aug 28 '13 at 15:43content
inside$variables
? It could be that the content is already rendered and stored in$variables['content']
when it gets to the preprocess function. And that's what's being output, and not the$variables['node']
contents. – Beebee Aug 28 '13 at 16:08