0 && WPUltimatePostGrid::is_premium_active() ) {
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 ) {
$grid->set_dynamic_rules( $dynamic_rules );
}
$link_type = $grid->link_type();
$link_target = $grid->link_target();
$layout_mode = $grid->layout_mode();
$centered = $grid->centered() ? 'true' : 'false';
$posts = '
';
$posts .= $grid->draw_posts();
$posts .= '
';
$output = apply_filters( 'wpupg_posts_shortcode', $posts, $grid );
// Message when no items match filter
if( $grid->empty_message() ) {
$output .= '' . $grid->empty_message() . '
';
}
$pagination = '';
if( $grid->pagination_type() == 'pages' ) {
$pagination_type = $grid->pagination_type();
$pagination_style = $grid->pagination_style();
$style_data = ' data-margin-vertical="' . $pagination_style['margin_vertical'] . '"';
$style_data .= ' data-margin-horizontal="' . $pagination_style['margin_horizontal'] . '"';
$style_data .= ' data-padding-vertical="' . $pagination_style['padding_vertical'] . '"';
$style_data .= ' data-padding-horizontal="' . $pagination_style['padding_horizontal'] . '"';
$style_data .= ' data-border-width="' . $pagination_style['border_width'] . '"';
$style_data .= ' data-background-color="' . $pagination_style['background_color'] . '"';
$style_data .= ' data-text-color="' . $pagination_style['text_color'] . '"';
$style_data .= ' data-border-color="' . $pagination_style['border_color'] . '"';
$style_data .= ' data-active-background-color="' . $pagination_style['background_active_color'] . '"';
$style_data .= ' data-active-text-color="' . $pagination_style['text_active_color'] . '"';
$style_data .= ' data-active-border-color="' . $pagination_style['border_active_color'] . '"';
$style_data .= ' data-hover-background-color="' . $pagination_style['background_hover_color'] . '"';
$style_data .= ' data-hover-text-color="' . $pagination_style['text_hover_color'] . '"';
$style_data .= ' data-hover-border-color="' . $pagination_style['border_hover_color'] . '"';
$pagination .= '';
}
$output .= apply_filters( 'wpupg_pagination_shortcode', $pagination, $grid );
wp_localize_script( 'wpupg_grid', 'wpupg_grid_' . $grid->ID(), array(
'posts' => $grid->posts(),
));
}
}
return $output;
}
public function tinymce_plugin( $plugin_array )
{
$plugin_array['wpupg_grid_shortcode'] = WPUltimatePostGrid::get()->coreUrl . '/js/tinymce_shortcode.js';
return $plugin_array;
}
}