Related posts on single

This is a PRIVATE forum for verified users only, to view all replies/answers, you must be logged in!

Status: not resolved
Viewing 17 reply threads
  • Author
    Posts
    • #16342

      rfischmann
      Member

      Hi,

      I see that, below related posts layout options, you mention this: “Select related post block layout you wish to display after single post content. (related posts by tag or category)”

      I believe Jetpack’s Related Posts feature is much richer and more precise, so I wish to use it instead.

      Can I replace Newsbeat’s related posts with Jetpack’s and maintain a similar layout to, let’s say, layout v1?

      Cheers.

    • #16352

      Jacob
      Staff

      Hey there, You must be logged in to view this reply!

      Login | Register | Forgot Password?

    • #16361

      rfischmann
      Member

      Cheers.

      It’s also better because all the processing is done on Jetpack’s servers.

    • #16539

      rfischmann
      Member

      While this is not implemented natively, here’s what I’m doing:

      function jetpackme_remove_rp() {
          if (class_exists('Jetpack_RelatedPosts')) {
              $jprp = Jetpack_RelatedPosts::init();
              $callback = array( $jprp, 'filter_add_target_to_dom' );
              remove_filter( 'the_content', $callback, 40 );
          }
      }
      add_filter( 'wp', 'jetpackme_remove_rp', 20 );
      
      add_action( 'newsbeat__after_single_post', 'rfischmann__output_custom_ads_after_single_post_2019jun28' );
      function rfischmann__output_custom_ads_after_single_post_2019jun28() {
          echo '<div class="pbs-header widget-title-wrapper w-t-w m-t__30"><h3 class="pbs-title widget-title w-t"><span>Posts relacionados</span></h3></div>';
          echo do_shortcode('[jetpack-related-posts]');
          echo '<div id="bloco-native-rodape"></div>';
          echo '<div class="clearer"></div>';
      }

      However, I think do_shortcode can’t be run from custom-functions.php, can it? It’s not working.

    • #16710

      Jacob
      Staff

      Hey there, You must be logged in to view this reply!

      Login | Register | Forgot Password?

    • #16721

      rfischmann
      Member

      Didn’t seem to make any difference.

      I see Jetpack’s code in the source [https://d.pr/i/RrqiIG], but it’s not showing up.

    • #16744

      Jacob
      Staff

      Hey there, You must be logged in to view this reply!

      Login | Register | Forgot Password?

    • #16756

      rfischmann
      Member

      If I comment that line, then the function before would be useless.

      That’s needed because Jetpack inserts related posts by default right after the end of the post’s content. I don’t want that.

    • #16912

      rfischmann
      Member

      I’ve just noticed a very weird thing: the Jetpack’s line of 3 related posts is showing up when I preview the post while it’s still being edited [https://d.pr/i/LiKWZj], but it disappears after it’s published.

      Any ideas on that?

    • #16918

      rfischmann
      Member

      I did some code tweaking and it’s showing up now.

      Even so, I still insist you guys should integrate Jetpack’s Related Posts feature inside Newsbeat. It’s awesome.

    • #16972

      Jacob
      Staff

      Hey there, You must be logged in to view this reply!

      Login | Register | Forgot Password?

    • #16978

      rfischmann
      Member

      What do you mean?

    • #16985

      Jacob
      Staff

      Hey there, You must be logged in to view this reply!

      Login | Register | Forgot Password?

    • #16986

      rfischmann
      Member

      It is, the first line with 3 related posts is from Jetpack.

      The other 6 posts are native ads.

    • #17821

      rfischmann
      Member

      Are you guys working on this, Jacob?

    • #18040

      rfischmann
      Member

      One more ignored topic, of course.

    • #18049

      Jacob
      Staff

      Hey there, You must be logged in to view this reply!

      Login | Register | Forgot Password?

    • #18055

      rfischmann
      Member

      Thanks.

Viewing 17 reply threads
  • You must be logged in to reply to this topic.

This is a PRIVATE forum for verified users only, to view all replies/answers, you must be logged in!

© Copyright 2020 by wpthms.com. All Rights Reserved.