Advertisement
GochiSiyan

inline after subtitle

Dec 5th, 2021
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. add_filter('the_content', function ($content) {
  2. if ( get_post_type() === 'post' && is_single() && ! is_admin() ) {
  3. if ( JNews\Single\SinglePost::getInstance()->can_render_inline_related_post() ) {
  4. ob_start();
  5. ?>
  6. <script>
  7. (function () {
  8. console.log('this is content');
  9. let sub = document.querySelector('.jeg_post_subtitle'),
  10. line = document.querySelector('.jnews_inline_related_post_wrapper');
  11.  
  12. if (! (sub && line)) return;
  13.  
  14. sub.after(line);
  15. line.style.float = 'unset';
  16. line.style.width = 'unset';
  17. })();
  18. </script>
  19. <?php
  20. $content .= ob_get_clean();
  21. }
  22. }
  23.  
  24. return $content;
  25. }, 100);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement