Play

Add Plus1 Voting Widget to Nodes in Panels

Jocelyn
Post to Twitter

If you're using ‎Panels‎ to output your content type and you enable the ‎Plus 1‎ module, you may notice the Plus 1 widget doesn't appear when you view your node.

If you don't see the widget, then you've probably enabled 'no extras' in your Panels node template override. If there's no other reason for enabling this option, you can simply uncheck the box and the Plus 1 widget will appear when you view your node.

If you do need to keep this unchecked, you can add a snippet to either your theme's node.tpl.php or node-customtype.tpl.php.

<?php
if (module_exists('plus1')) {
  if (
in_array($node->type, variable_get('plus1_nodetypes', NULL))) {
    if (
$page && variable_get('plus1_in_full_view', 1)) {
      print
plus1_jquery_widget($node, $teaser, $page);
    }
  }
}
?>

Add comment

  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags
  • Websites and email addresses turn into links automatically
  • Use one of the forms name.module, name.theme, name.translation, name.installprofile or name.project, in order to link to http://drupal.org/project/name. Note that a link will be generated even if a project does not exist
  • Lines and paragraphs break automatically
Your email will not be displayed publicly. If you have a Gravatar account, used to display your avatar.

jsfwd on Twitter 

  • BIXI debuts bike sharing program in Toronto http://bit.ly/cTruQl 1 day 21 hours ago
  • Vote #Toronto to host DrupalCon 2012 North America http://bit.ly/aXgBkJ 3 days 19 hours ago
  • Toronto #Drupal meetup tonight 6:30pm @CSI http://bit.ly/cGL63w 4 days 19 hours ago
  • Display a Twitter Profile using YQL & jQuery http://bit.ly/ajAfu6 5 days 21 hours ago
  • Google Images got a facelift.... size, type & colour filters... pagers gone... wow! 1 week 2 days ago
  • Wouldn't that just be Drupal? RT @becircle: I just heard the words I feared I might hear some day "They created a GUI for Drush" #drupal 1 week 3 days ago
  • #Raptors acquire Leandro Barbosa... w00t w00t!! 2 weeks 5 days ago
  • The NBA is a whole lot less interesting today. 3 weeks 22 hours ago
  • Site Aliases, Groups and Remote Capabilities! RT @lwalk: New features in Drush 3 http://bit.ly/aIzmxw #drush #drupal 4 weeks 2 days ago
  • Twitter delays the OAuthcalypse another 6 weeks http://countdowntooauth.com 4 weeks 3 days ago
@jsfwd on Twitter »
i heart cycling