Hot answers tagged contextual-help
5
You need to use the contextual_help help filter.
add_filter( 'contextual_help', 'wpse50723_remove_help', 999, 3 );
function wpse50723_remove_help($old_help, $screen_id, $screen){
$screen->remove_help_tabs();
return $old_help;
}
The filter is for the old context help (pre 3.3). (I'm not sure it matters what is returned...?).
In any case the ...
3
Since WordPress 3.3, contextual help tabs are added via the Screen object, using add_help_tab(). The basic structure is as follows:
<?php
$screen = get_current_screen();
$screen->add_help_tab( array(
'id' => 'sfc-base',
'title' => __('Connecting to Facebook', 'sfc'),
'content' => "HTML for help content",
) );
?>
If you ...
2
You could also trigger/simulate the help button being clicked by binding to the ready event.
Pre jQuery 1.7
<script type="text/javascript">
jQuery(document).bind( 'ready', function() {
jQuery('a#contextual-help-link').trigger('click');
});
</script>
jQuery 1.7+ (bind deprecated as of 1.7)
<script type="text/javascript">
...
2
Injecting this whereever you find suitable (or loading it as external js via wp_enqueue_script() should do it:
<script type="text/javascript">
addLoadEvent(function() {
jQuery(document).ready(function () {
jQuery('#contextual-help-wrap').show().addClass('contextual-help-open');
...
2
Ok. The answer is NOT simple, but after some try and error, reading core, etc. I found out what the problem is:
The callback (which should be used instead of the content) accepts two arguments: $current_screen and $tab.
Here's what $tab looks like, when dumped for a single tab.
Array
(
[title] => TEST ME
[id] => EXAMPLE_A
[content] => ...
1
The documentation in the Codex seems outdated.
Use the following code (see comments):
// Priority 5 allows the removal of default tabs and insertion of other plugin's tabs
add_filter( 'contextual_help', 'wpse_77308_products_help', 5, 3 );
function wpse_77308_products_help( $old_help, $screen_id, $screen )
{
// Not our screen, exit earlier
// ...
1
Maybe the Q is bordering the off-topic, but IMO interesting in WordPress context.
I've tested this directly in FireBug, in the Dashboard page (wp-admin/index.php).
var $ =jQuery.noConflict();
// Remove 'active' class from all link tabs
$('li[id^="tab-link-"]').each(function(){
$(this).removeClass('active');
});
// Hide all panels
...
1
Look at the source, there is no filter to alter the 'Help'. But it does translate the text so you can hook onto the gettext filter. Not the nicest of solutions (an alternative would be to use javascript) :
add_filter( 'gettext', 'wpse51861_change_help_text', 10, 2 );
function wpse51861_change_help_text( $translation, $text ) {
if ( $text == 'Help' )
...
1
As @Mamaduka suggested, you can hook into admin_head-{$page_hook} and add the contextual help there. admin_head fires after the default contextual help tabs have been added.
<?php
add_action( 'admin_head-options-reading.php', 'wpse45210_add_help' );
function wpse45210_add_help()
{
get_current_screen()->add_help_tab( array(
'id' ...
1
I guess you have three chances:
Use WP_Screen->$_help_tabs to reorder them manually.
Grap the existing help tabs, save them temporarily somewhere else. Then use WP_Screen->remove_help_tab( $id ) and then add them back in manually.
Use the admin_head filter to populate the help tabs or missuse one of the filters or hooks that fire before it in ...
1
You can add this code in your functions.php file.
function example_contextual_help( $contextual_help, $screen_id, $screen ) {
//echo 'Screen ID = '.$screen_id.'<br />';
switch( $screen_id ) {
case 'my_plugin_page_1' :
$contextual_help .= '<p>';
$contextual_help = __( 'Your text here.' );
...
1
Most of the jQuery UI is already built in to the WP admin and it is planned for the WP 3.3 update to include the rest of the UI.
It is not until jQuery UI 1.9 final release where tooltips will be added in so perhaps after WP 3.3, jQuery UI 1.9 will be incorporated in thus adding in-built tooltips without having to enqueue anything.
1
Do NOT edit core files! You can add to or override the default text by using a filter. Try taking a look at http://justintadlock.com/archives/2011/06/02/adding-contextual-help-to-plugin-and-theme-admin-pages
1
You can add the custom help by adding a hook to the page load e.g. page-new.php would become load-page-new.php
function custom_help_page() {
add_filter('contextual_help','custom_page_help');
}
function custom_page_help($help) {
$custom = "<h5>Custom Help</h5>
<p>Custom help content</p>";
return $custom.$help;
}
...
1
You can use Qtip to write your how to...”, simple rules to post..."
and it will show on hover for each element
$("jqueryselector").qtip({
content: 'I\'m at the top right of my target',
position: {
corner: {
target: 'topRight',
tooltip: 'bottomLeft'
}
}
})
Update:
even simpler you can use "Jquery Form Field Default ...
Only top voted, non community-wiki answers of a minimum length are eligible