snipt

Ctrl+h for KB shortcuts

PHP

Render a content field inside a Node Template. Correct syntax for a field added to a node.

// render a content field inside a Node Template
print render($content['field_NAME_OF_FIELD']);
https://snipt.net/embed/32062154ff962442643fb7469e7a44e7/
/raw/32062154ff962442643fb7469e7a44e7/
32062154ff962442643fb7469e7a44e7
php
PHP
3
2019-08-24T20:08:07
True
False
False
/api/public/snipt/35623/
render-a-content-field-inside-a-node-template-correct-syntax-for-a-field-added-to-a-node
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="x">// render a content field inside a Node Template</span> </span><span id="L-2"><a name="L-2"></a><span class="x">print render($content[&#39;field_NAME_OF_FIELD&#39;]);</span> </span></pre></div> </td></tr></table>
"drupal 7", "node template", "node theme"