Should use widgets in this case?

The general concept on dynamic sidebars Basically WP loops through the global $wp_registered_widgets and builds the widget depending on it’s arguments. You can intercept them easily: Use a filter You can use the dynamic_sidebar_params to add a class to target specific widgets: // SHOW the params for better insights function wpse44903_dump_sidebar_params( $params ) { echo … Read more

How do I change the gallery that is inserted in the post?

You can filter the default gallery shortcode. Here is something I’ve used in the past. add_filter( ‘post_gallery’, ‘wpse_gallery’, 10, 2 ); function wpse_gallery() { global $post; /* Orderby */ if ( isset( $attr[‘orderby’] ) ) : $attr[‘orderby’] = sanitize_sql_orderby( $attr[‘orderby’] ); if ( !$attr[‘orderby’] ) unset( $attr[‘orderby’] ); endif; /* * Extract default gallery settings … Read more