0 && WPUltimatePostGrid::is_premium_active() ) { // Term Grid. if ( $grid->type() == 'terms' ) { if( isset( $options['term_id'] ) ) { $term_ids = str_replace( ',', ';', $options['term_id'] ); $term_ids = str_replace( 'current_term', get_queried_object_id(), $term_ids ); $dynamic_rules = array( 'values' => explode( ';', $term_ids ), 'type' => 'restrict', ); unset( $options['term_id'] ); } if( isset( $options['exclude_term_id'] ) ) { $term_ids = str_replace( ',', ';', $options['exclude_term_id'] ); $term_ids = str_replace( 'current_term', get_queried_object_id(), $term_ids ); $dynamic_rules = array( 'values' => explode( ';', $term_ids ), 'type' => 'exclude', ); unset( $options['exclude_term_id'] ); } } else { // Post Grid. if( isset( $options['post_id'] ) ) { $post_ids = str_replace( ',', ';', $options['post_id'] ); $post_ids = str_replace( 'current_post', get_the_ID(), $post_ids ); $dynamic_rules[] = array( 'post_type' => 'wpupg_general', 'taxonomy' => 'id', 'values' => explode( ';', $post_ids ), 'type' => 'restrict', ); unset( $options['post_id'] ); } if( isset( $options['exclude_post_id'] ) ) { $post_ids = str_replace( ',', ';', $options['exclude_post_id'] ); $post_ids = str_replace( 'current_post', get_the_ID(), $post_ids ); $dynamic_rules[] = array( 'post_type' => 'wpupg_general', 'taxonomy' => 'id', 'values' => explode( ';', $post_ids ), 'type' => 'exclude', ); unset( $options['exclude_post_id'] ); } foreach( $options as $taxonomy => $terms ) { if( taxonomy_exists( $taxonomy ) ) { $dynamic_rules[] = array( 'post_type' => 'wpupg_dynamic', 'taxonomy' => $taxonomy, 'values' => explode( ';', str_replace( ',', ';', $terms ) ), 'type' => 'restrict', ); } } } } if( count( $dynamic_rules ) > 0 || 'rand' === $grid->order_by() ) { $grid->set_dynamic_rules( $dynamic_rules ); } else { // Make sure latest version of grid is shown. $grid_ids = get_option( 'wpupg_regenerate_grids_check', false ); if( $grid_ids && in_array( $grid->ID(), $grid_ids ) ) { WPUltimatePostGrid::get()->helper( 'grid_cache' )->generate( $grid->ID() ); unset( $grid_ids[ array_search( $grid->ID(), $grid_ids ) ] ); update_option( 'wpupg_regenerate_grids_check', $grid_ids ); } } $link_type = $grid->link_type(); $link_target = $grid->link_target(); $layout_mode = $grid->layout_mode(); $centered = $grid->centered() ? 'true' : 'false'; $posts = '