Advertisement:

Author Topic: how to add adsense and sharing codes in the first message  (Read 574 times)

Offline winsoft

  • Semi-Newbie
  • *
  • Posts: 54
    • Search UK Jobs
how to add adsense and sharing codes in the first message
« on: October 22, 2019, 06:06:05 AM »
i though this might be useful for some people.

following code will show adsense on top and bottom of the first message and sharing buttons on top of the first message.

This codes works with smf 2.1 RC2:

I am using addthis but you can paste any other social sharing codes.

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 -->';

hope this would be helpful for you.