artemsemkin

Rubenz: disable AJAX navigation in/out blog

Feb 12th, 2021
777
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function arts_is_blog_page() {
  2.   global $post;
  3.  
  4.   // Post type must be 'post'.
  5.   $post_type = get_post_type( $post );
  6.  
  7.   // Check all blog-related conditional tags, as well as the current post type,
  8.   // to determine if we're viewing a blog page.
  9.   return (
  10.       ( is_home() || is_archive() || is_single() )
  11.       && ( $post_type == 'post' )
  12.   ) ? true : false;
  13. }
  14.  
  15. add_filter( 'body_class', 'arts_add_no_ajax_blog_classes' );
  16. function arts_add_no_ajax_blog_classes( $classes ) {
  17.   $body_classes = array( 'page-no-ajax', 'no-ajax' );
  18.  
  19.   if ( arts_is_blog_page() ) {
  20.     $classes = array_merge( $classes, $body_classes );
  21.   }
  22.  
  23.   return $classes;
  24. }
  25.  
RAW Paste Data