0

I want to align my social icons vertically next to the body field, in my node.tpl.php file the body is included in the $content with everything else. The social icons sit a few lines above and look like this in my node.tpl.php file:

<div class="main-node-social-share">
  <?php print render($main_node_social_share);?>
</div>

How can i get $main_node_social_share to render right before the $content['body'] field?

// We hide the comments and links now so that we can render them later.
hide($content['comments']);
hide($content['links']);
print render($content);

1 Answer 1

2

Try some thing like this in custom module and see it helps.

function modulename_page_alter(&$page) {
  $social=array(
    '#markup'=>'<div id="social"><img src="https://cdn3.iconfinder.com/data/icons/free-social-icons/67/twitter_square-128.png"></div>',
  );
  array_unshift($page['content']['system_main']['nodes'][1],$social);

}
1
  • Although this didn't exactly work in my situation it is the right solution. Thanks Apr 30, 2014 at 13:55

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.