Advertisement
arie_cristianD

render post review content in top

Aug 13th, 2024
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.99 KB | None | 0 0
  1. add_action(
  2.     'init',
  3.     function () {
  4.         if ( class_exists( 'JNews_Review_Frontend' ) ) {
  5.             remove_filter( 'the_content', array( JNews_Review_Frontend::getInstance(), 'review_content' ), 10 );
  6.             add_filter( 'the_content', 'custom_review_content' );
  7.         }
  8.     }
  9. );
  10.  
  11.  
  12. function custom_review_content( $content ) {
  13.  
  14.     if ( jnews_get_metabox_value( 'jnews_review.enable_review', false ) ) {
  15.         $split_post = jnews_get_metabox_value( 'jnews_post_split.enable_post_split', false );
  16.  
  17.         if ( $split_post ) {
  18.             return $content;
  19.         }
  20.  
  21.         global $page, $numpages, $multipage;
  22.  
  23.         if ( $multipage ) {
  24.             if ( $page === $numpages ) {
  25.                 return render_review_content( $content );
  26.             }
  27.         } else {
  28.             return render_review_content( $content );
  29.         }
  30.     }
  31.     return $content;
  32. }
  33.  
  34. function render_review_content( $content ) {
  35.     if ( class_exists( 'JNews_Review_Frontend' ) ) {
  36.         $post_review = JNews_Review_Frontend::getInstance()->post_review();
  37.         $content     = $post_review . $content;
  38.     }
  39.     return $content;
  40. }
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement