I had added some content to contextual help section for plugin options page.
Now I’d like that page defaulted/toggled to contextual help section open on specific condition in my PHP code. My only issue is that I am not strong with JS and don’t see clear approach to coding that (I know how to pass variable to JS through localize, but not what code will actually get it done).
I had found relevant JS functions in source, but not sure how to properly reuse them for my task.
You could also trigger/simulate the help button being clicked by binding to the ready event.
Pre jQuery 1.7
jQuery 1.7+ (bind deprecated as of 1.7)
The difference here is that you’ll see the help section slide down as the page finishes loading, as if a user had clicked the link.
Can’t hurt to have another option though. 🙂
Injecting this whereever you find suitable (or loading it as external js via
wp_enqueue_script()
should do it: