News:

Wondering if this will always be free?  See why free is better.

Main Menu

how to add addthis code manually?

Started by winsoft, October 16, 2019, 08:51:28 AM

Previous topic - Next topic

winsoft

I couldn't see any mod that does social sharing job.

I have this code:

<script type='text/javascript' src='//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-51b46ac16675e9c4'></script>

I have tried to add it onto display template php:

where to paste it please?

thanks


// Show the post itself, finally!
   echo '
                       <div class="post">';

   if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id'])
      echo '
                        <div class="approve_post">
                           ', $txt['post_awaiting_approval'], '
                        </div>';
   echo '
                        <div class="inner" data-msgid="', $message['id'], '" id="msg_', $message['id'], '"', $ignoring ? ' style="display:none;"' : '', '>
                           ', $message['body'], '
                        </div>
                     </div><!-- .post -->';

Bigguy


winsoft

thank you but i need it in the topic page

Bigguy

Ah I see. If you attach your file I will see what I can do for you.

shadav

remember to wrap it with
echo '
CODE
';

otherwise you'll end up with template errors, unless you are adding it inside an echo already....

it depends on where you are trying to display it at

winsoft

done it guys, i can paste it here if anyone else needs it?

Dzonny

Sure you can.

Glad that the problem is solved :)

winsoft

I am using addthis but you can paste any other social sharing codes. Buttons will only show up on the first message.

I have also add adsense code to show on top and bottom of the first message.

Quote// Show the post itself, finally!
   echo '
                     <div class="post">';

   if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id'])
      echo '
                        <div class="noticebox">
                           ', $txt['post_awaiting_approval'], '
                        </div>';
   echo '
                        <div class="inner" data-msgid="', $message['id'], '" id="msg_', $message['id'], '"', $ignoring ? ' style="display:none;"' : '', '>
                           ';
      if ($message['id'] == $context['first_message'])
echo '
YOUR SOCIAL SHARE CODES HERE
<br/>ADSENSE HERE<br />';echo '', $message['body'], '';
      if ($message['id'] == $context['first_message'])
echo '
ADSENSE HERE<br />';echo '
                        </div>
                     </div><!-- .post -->';


Advertisement: