Advertisement
fauzanjeg

Hide Sidefeed for Spesific Page || Category and 404 Page for Example

Nov 29th, 2021
924
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.63 KB | None | 0 0
  1. /* Hide Sidefeed for Spesific Page || Category and 404 Page for Example */
  2. function hide_sidefeed_for_spesific_page( $flag ) {
  3.     if ( is_category() || is_404() ) { /* If is Category or 404 Page */
  4.         $flag = false;
  5.     }
  6.     return $flag;
  7. }
  8. function hide_sidefeed_for_spesific_page_css() {
  9.     $sidefeed = new \JNews\Sidefeed\Sidefeed();
  10.     if ( ! $sidefeed->can_render() ) {
  11.         echo '<style>.jeg_sidecontent .jeg_viewport { margin-left: unset; }</style>';
  12.     }
  13. }
  14. add_action(
  15.     'init',
  16.     function() {
  17.         add_filter( 'jnews_enable_sidefeed', 'hide_sidefeed_for_spesific_page' );
  18.         add_action( 'wp_head', 'hide_sidefeed_for_spesific_page_css' );
  19.     }
  20. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement