I have some content-types and nodes custom styled with templates and some do not employ node links. Is the button printable in custom themes or will it only appear in node links?

Comments

ycwjjjj’s picture

I would also look for the code for template for contemplate module.
I tried to add the code below in my tpl.php used by contemplate module. It seems working but not sure it is the proper way or not.

print $node->content['tweetbutton']['#children'];

upupax’s picture

This work for me, but this duplicate the tweetbutton.
I tried to write some preprocess code, but I still have two buttons.
Someone can help me?

  if (module_exists('tweetbutton')) {
    $tweetbutton = array();
    
    if ($vars['node']->content['tweetbutton']['#children']){
        $tweetbutton = $vars['node']->content['tweetbutton']['#children'];
        unset($vars['node']->content['tweetbutton']);
    }
    
    $vars['tweetbutton'] = $tweetbutton;
  }

and then in my node.tpl.php


print $tweetbutton;

chia’s picture

Status: Active » Fixed

or you can do

theme('tweetbutton_display', $node); // for displaying in node
theme('tweetbutton_display', $user, array('entity_type' => 'user'));  //for displaying in user profiles
theme('tweetbutton_display', $comment, array('entity_type' => 'comment')); // for displaying in comments page
theme('tweetbutton_display', NULL, array('url' => $_GET['q'], 'text' => drupal_get_title())); // for displaying in pages other than node

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Rosamunda’s picture

just subscribing! :)

edit: I´m using contemplate too, and it worked ok with <?php print $node->content['tweetbutton']['#value'] ?>

gthing’s picture

Status: Closed (fixed) » Active

I am using theme('tweetbutton_display', $node); in my node.tpl.php but it is not showing up.

I have enabled the link to show up in my content and my teaser, and if I allow it to show up in my links section it does show up there as expected.

This doesn't work either: print $node->content['tweetbutton']['#value']

gthing’s picture

Status: Active » Closed (fixed)

My bad, I had to do print theme('tweetbutton_display', $node);