Jump to content


These Forums Are Now Read-Only


For TubePress support, please post a question here or open a support ticket and we will be glad to assist.


Photo

How to add share buttons?


  • Please log in to reply
4 replies to this topic

#1 Steven Hodson

Steven Hodson

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 05 December 2010 - 11:38 AM

I am trying to figure out how to add in share buttons - Twitter/Facebook/StumbleUpon - under the main video displayed. You can see the site at http://www.winextra.tv. What I want to be able to do is one of two things:

Ideally: post a share link to the video as displayed on a single page at the site
Or: post a share link to the video on YouTube

Since this doesn't use the typical WP permalink structure I'm a little lost.

The one other question as well is where in the custom tpl.php file would the links go? In my testing I tried to do this
<div class="tubepress_container" id="tubepress_gallery_<?php echo ${org_tubepress_template_Template::GALLERY_ID}; ?>">

  <?php echo ${org_tubepress_template_Template::PLAYER_HTML}; ?>
	<div class="db-sharing">
	    <test code went here>
	</div>

The problem is that it ended up next to the title and I was hoping it would display under the video player.

any help would be greatly appreciated.

#2 eric

eric

    Lead Developer

  • TubePress Staff
  • 2787 posts

Posted 06 December 2010 - 08:29 PM

Hi Steve,

You should be able to do this easily via a custom theme. In your case I would have a single file in the theme at tubepress/content/themes//players/normal.tpl.php. You can copy over the file from tubepress/ui/lib/themes/default/players/normal.tpl.php. Then you can add the share link below the embedded HTML. I would start with something like this:

<div class="tubepress_normal_embedded_wrapper" style="width: <span class="syntaxdefault"><?php echo ${org_tubepress_template_Template::EMBEDDED_WIDTH}; ?>px">      <div id="tubepress_embedded_title_<?php echo ${org_tubepress_template_Template::GALLERY_ID}; ?>" class="tubepress_embedded_title">      <?php echo ${org_tubepress_template_Template::VIDEO}->getTitle(); ?>        </div>    <div id="tubepress_embedded_object_<?php echo ${org_tubepress_template_Template::GALLERY_ID}; ?>">      <?php echo ${org_tubepress_template_Template::EMBEDDED_SOURCE}; ?>    </div>    <div>This video's ID is <?php echo ${org_tubepress_template_Template::VIDEO}->getId(); ?>"></div>  </div></span>
That's just an example to show you how to retrieve the currently playing video's ID.

I really recommend going the route of a custom theme as it will make your TubePress installation upgrade safe.

Make sense?

p.s. also please note that version 2.1.2 is out

#3 Steven Hodson

Steven Hodson

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 06 December 2010 - 08:42 PM

<div>This video's ID is <?php echo ${org_tubepress_template_Template::VIDEO}->getId(); ?>"></div>



Okay I am pretty sure I understand getting the ID and from what I can gather this is what goes into the URL that is passed to Twitter, SU and Facebook. So I guess my question is then what would be the url - including the ID - that would get passed as one of the share links parameters?

Yes I know that there is an update but I've been holding off updating until I get this stuff figured out.

But while we are on that subject what is best practice for update a Pro install of TubePress ?? use the update from in WP Admin or download newest update -> upload to server and then activate the new version and then change the Env. path string in the code?

thanks

#4 eric

eric

    Lead Developer

  • TubePress Staff
  • 2787 posts

Posted 06 December 2010 - 11:42 PM

what would be the url - including the ID - that would get passed as one of the share links parameters?


Since you're using the "normal" playerLocation (http://tubepress.com...layer_locations), you can just append "tubepress_video=" to the URL to auto-load the video in the embedded player. So in your case it would be something along these lines:

<a href="<span class="syntaxdefault"><?php echo $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"] . '?tubepress_video=' . ${org_tubepress_template_Template::VIDEO}->getId(); ?>">Link to this video</a> </span>
Does that make sense?

#5 Steven Hodson

Steven Hodson

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 06 December 2010 - 11:54 PM

Okay I think I understand but just to make sure let me use the example of coding in the Twitter ReTweet button just to see if I do understand.
<a href="http://twitter.com/share" class="twitter-share-button" 
        data-url="<?php bloginfo('url') . '?tubepress_video=' . ${org_tubepress_template_Template::VIDEO}->getId(); ?>"
	data-text="<?php the_title(); ?>"
	data-count="horizontal">Tweet</a>

Close or no cigar ?? :)

Edit: No cigar.
Now I am using the default gallery.tpl.php in a folder under content/themes/daily-brief (this is the one used for the first video block on the page) and set using the theme="" parameter in the "print tubepressGallery() section.

The error message I am getting is: Call to a member function getId() on a non-object