Change shortcode attributes based on URL parameters
add_filter( 'piecal_shortcode_atts', function( $atts ) {
if ( is_admin() || wp_doing_ajax() ) {
return $atts;
}
if ( empty( $_GET['piecalsearch'] ) ) {
return $atts;
}
$atts['view'] = 'listUpcoming';
$atts['duration'] = 12;
return $atts;
}, 20 );
In this example, we're looking for a "piecalsearch" parameter in the URL and then changing the view and duration. You can use this method to change any shortcode attribute and look for any URL parameter, which is a powerful option when you want to selectively apply customizations to the calendar based on the URL.