Parse a shortcode differently based on on what it’s nested in

Register a new shortcode handler depending on the attribute value: function wrapper_shortcode_handler ( $atts, $content ) { if ( “apple” === $atts[“snack”] ) add_shortcode( “flavor”, “healthy_callback” ); if ( “donut” === $atts[“snack”] ) add_shortcode( “flavor”, “fatty_callback” ); return do_shortcode( $content ); } See also Execute shortcode only in another shortcode

If custom taxonomy else conditional [closed]

For custom post types use is_post_type_archive(‘tips’). Let us know if this works. It should also work with an array is_post_type_archive( array( ‘tips’, ‘cpt’, ‘another cpt’ ) ) I am currently using this function to recognize specific post type archives. See: A Post Type Archive in codex. It would be best if you could specify which … Read more

Conditional loading of CSS for my plugin

Since WP 3.3 you can use wp_enqueue_*() after wp_head, and enqueued scripts and styles (if not already added to the head of the page) would be loaded in the footer. In short just call wp_enqueue_script() / wp_enqueue_style() in your shortcode callback: add_shortcode( ‘my_shortcode’, ‘my_shortcode_callback’ ); function my_shortcode_callback(){ //Shortcode does something, and generates mark-up to return … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)