Advertisement
mspotilas

miniva theme fix (inc/posts.php)

Oct 2nd, 2018
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.79 KB | None | 0 0
  1. /**
  2.  * Insert grid container before the loop.
  3.  *
  4.  * @param obj $query The WP_Query instance.
  5.  */
  6. function miniva_loop_start( $query ) {
  7.     if ( ! $query->is_main_query() ) {
  8.         return;
  9.     }
  10.     if ( $query->is_feed() ) {
  11.         return;
  12.     }
  13.     if ( is_singular() ) {
  14.         return;
  15.     }
  16.     if ( miniva_is_grid() ) {
  17.         miniva_container_open( 'grid', 'posts-container' );
  18.     }
  19. }
  20. add_action( 'loop_start', 'miniva_loop_start' );
  21.  
  22. /**
  23.  * Insert grid container after the loop.
  24.  *
  25.  * @param obj $query The WP_Query instance.
  26.  */
  27. function miniva_loop_end( $query ) {
  28.     if ( ! $query->is_main_query() ) {
  29.         return;
  30.     }
  31.     if ( $query->is_feed() ) {
  32.         return;
  33.     }
  34.     if ( is_singular() ) {
  35.         return;
  36.     }
  37.     if ( miniva_is_grid() ) {
  38.         miniva_container_close();
  39.     }
  40. }
  41. add_action( 'loop_end', 'miniva_loop_end' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement