So I've added

print $vote_up_down_widget

to my node.tpl.php and it works great. The problem is that when I am in the admin section of my site and I select which content types I want to allow voting on, the site just ignores these settings and displays the widget anyways.. How do I resolve this issue?

Comments

davedg629’s picture

You have added "print $vote_up_down_widget" to node.tpl.php. Node.tpl.php will control what is displayed for every node on your website, it doesn't matter that you change the settings and displays for the widget on the admin pages. You need to create a new tpl.php file for the node type you want the widget to display on.

Lets say you want the widget to display on the content type "blog". You would create a new file called node-blog.tpl.php and copy the contents of node.tpl.php into it. Then add your "print $vote_up_down_widget" where you want it in the node-blog.tpl.php file and delete the line from the node.tpl.php file. Hope that helps, later.

Dave

davedg629’s picture

I am having my own problem with the display of this widget. I am using the alternative (up only) vote widget. I do not want the widget to be displayed in the "content" of the node so I have decided to add "print $vote_up_down_widget" to the template file for the node type. My node type is "goal" and the file is named node-goal.tpl.php. Here is the part of the file where I inserted the widget:

   <span class="taxonomy"><?php print $terms?></span>
  <strong><?php print $vote_up_down_widget ?> </strong> 
  <div class="g-details"><?php print 'Details:'?></div>
  <div class="goal-content"><?php print $content?></div>
  <?php if ($links) { ?>
    <div class="links">&raquo; <?php print $links?></div>
  <?php }; ?>
</div>

The widget is not displaying though. I don't know why, it seems like everyone else has got this to work. Thanks for any help.

davedg629’s picture

Status: Active » Closed (fixed)

Alright I was not including the template file code into my themes template file. Included it and it worked.