WordPress shortcode in content, output in sidebar?

If you wanna show the content in sidebar if current post content has the shortcode then you should try has_shortcode function. Here is a demonstration- $content = get_the_content(); if( has_shortcode( $content, ‘your-shortcode’ ) ) { // The content has a [your-shortcode] short code, so this check returned true. } Hope it helps.

How can I include the user id inside of a shortcode php output?

So I’m assuming the “current commenter” is actually the current user logged into WP. So to get the current user ID, you can simply use get_current_user_id: echo do_shortcode(“[theplugin_user_data user_id='” . get_current_user_id() . “‘]”); UPDATE Ok, so we want, then, the comment’s author ID: //$comment = get_comment(); // in your case, it seems you already have … Read more

Action Hook Inside WordPress Plugin Shortcode

It’s not entirely clear what your ultimate goal is, but a simple way to catch a form submission is to hook init and check if something is set: function wpd_check_post_vars(){ if( isset( $_POST[‘first_name’] ) ){ // do something } } add_action( ‘init’, ‘wpd_check_post_vars’ ); There’s no connection here between the action and your Shortcode, it’s … Read more

How can I insert a shortcode in the title tag of another?

No, you can’t do that, as the title argument is passed as a string. Given the information you provided, I suppose that your [dt_fancy_title] shortcode does not actually execute shortcodes. The syntax for this function should be: function dt_fancy_title_callback( $params, $content = null ) { // extract the title argument from the params, setting default … Read more