Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #296541

    omar333
    Participant

    Hello guys I’m trying to implement some Taboola code so that related posts appear below the post. I tried their plug in but nuthing is showing up. Can you help me?

    #296542

    omar333
    Participant
    This reply has been marked as private.
    #296543

    omar333
    Participant
    This reply has been marked as private.
    #297039

    Thai
    Moderator

    Hi There,
    Thanks for writing in.
    Because this requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please add following PHP code below into functions.php locates in child theme’s folder:

    add_action( 'x_after_view_icon_content', 'x_print_script_1' );
    add_action( 'wp_head', 'x_print_script_2');
    add_action( 'wp_footer', 'x_print_script_3');
    function x_print_script_1(){
      ?>
      <div id="taboola-below-article-thumbnails"></div>
      <script type="text/javascript">
        window._taboola = window._taboola || [];
        _taboola.push({
          mode: 'thumbnails-a',
          container: 'taboola-below-article-thumbnails',
          placement: 'Below Article Thumbnails',
          target_type: 'mix'
        });
      </script>
      <?php
    }
    function x_print_script_2(){
      ?>
      <script type="text/javascript">
        window._taboola = window._taboola || [];
        _taboola.push({article:'auto'});
        !function (e, f, u) {
          e.async = 1;
          e.src = u;
          f.parentNode.insertBefore(e, f);
        }(document.createElement('script'),
        document.getElementsByTagName('script')[0],
        'http://cdn.taboola.com/libtrc/pasionaguila/loader.js');
      </script>
      <?php
    }
    function x_print_script_3(){
      ?>
      <script type="text/javascript">
      window._taboola = window._taboola || [];
      _taboola.push({flush: true});
    </script>
      <?php
    }

    Hope it helps.