2

I'm new to Drupal coming from Wordpress, but I was able to put a site up&running. Theming is easy in WP, but I have not figured that out in D7.

I have a Content Type and the node-content output HTML as below. But I wanted to add custom html in-between section of the node-content:

<div class="node-content">
    <div class="section field field-name-field-xxx ">
    ....
    </div>
    <!--need to add My Custom HTML here-->
    <div class="section field field-name-field-yyy ">
    ....
    </div>
</div>

I have searched online but I am not getting the basic instructions how to proceed. Presently I'm using a child theme of Zircon.

Any help?

1
  • Highly recommend watching the theming series on drupalize.me. You will get an answer here eventually, but if you are brand new to Drupal theming, I suggest absorbing all of that information first.
    – Kevin
    Commented Jan 25, 2017 at 22:35

1 Answer 1

1

Create a custom template file node--type.tpl.php where type is the machine name of your content type.

Place it in your theme's templates folder /sites/all/themes/YOURTHEME/templates and clear/flush the cache to see changes.

Ex: Article content type: node--article.tpl.php

<?php print render($content['field_xxx']); ?>

// custom html goes here

<?php print render($content['field_yyy']); ?>
1
  • Thank You for the Idea. am too lazy to type all the code into node--[type].tpl.php so I research further based on the you provided and I was able to customized the field I need by creating field--field-name--content-type.tpl.php file. This Link should be useful for some [link]3cwebservices.com/drupal/how-override-field-templates-drupal-7[/…
    – Good Muyis
    Commented Jan 26, 2017 at 23:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.