I’ve added a custom field called ‘field_header’ to the basic page content type. How do I access this field on the page.tpl.php template so I can display it wherever I want? Ideally I would like to remove it from $content as well. Thanks!
I’ve added a custom field called ‘field_header’ to the basic page content type. How
Share
Don’t forget not every page is necessarily a node page so you’d really be better off trying to access this in
node.tpl.php, notpage.tpl.php.In
node.tpl.phpyou can render the particular field like this:If you absolutely have to do this in
page.tpl.phpthen you want to implement a preprocess function in your template file to get the variable you need:Then in
page.tpl.phpyou’ll have access to the variable$my_headerwhich will contain your full rendered field.