Post by mimjannat109 on Jan 9, 2024 6:30:52 GMT
The hook needs to be added to the functions.php file for themes Figure and to the main PHP file for a plugin. Functions.php file can be found in Dashboard Appearance Editor Figure . wordpress theme editor wordpress contextual help Figure wordpress theme editor functions.php wordpress contextual help Figure Adding WordPress Contextual Help Screens to All Admin Areas The Contextual Help Tab can be added to all pages at once. There are two different ways to do this: Use content definition inline: Define the content inline and pass it to the addhelptab method.
Function addcontextmenuhelp This is a Test Help p'; echo content; Note that the third parameter to the addhelptab function specifies whether we use inline content or content callback method. We need to register the action hook for Email Marketing List the Admin menu this can be included in the functions.php file alongwith the function as shown in figure : addaction 'adminhead', 'addcontextmenuhelp' ; Selectively Adding Contextual Help for Specific screen We can also selectively display the help screen by detecting the current screen.
For example, if we are viewing items from a custom ‘Comments’ post type then the code will change as below: function addcontextmenuhelpcomments get the current screen object currentscreen getcurrentscreen ; show only on comments page if currentscreen-posttype 'Comments' && currentscreen-base 'edit' content 'pThis is a Test Help p'; currentscreen-addhelptab array 'id' 'Commentshelptab', 'title' 'Comment Help Tab' , 'content' content ; We now register the action hook for the Admin menu: addaction 'adminhead', 'addcontextmenuhelpcomments.
Function addcontextmenuhelp This is a Test Help p'; echo content; Note that the third parameter to the addhelptab function specifies whether we use inline content or content callback method. We need to register the action hook for Email Marketing List the Admin menu this can be included in the functions.php file alongwith the function as shown in figure : addaction 'adminhead', 'addcontextmenuhelp' ; Selectively Adding Contextual Help for Specific screen We can also selectively display the help screen by detecting the current screen.
For example, if we are viewing items from a custom ‘Comments’ post type then the code will change as below: function addcontextmenuhelpcomments get the current screen object currentscreen getcurrentscreen ; show only on comments page if currentscreen-posttype 'Comments' && currentscreen-base 'edit' content 'pThis is a Test Help p'; currentscreen-addhelptab array 'id' 'Commentshelptab', 'title' 'Comment Help Tab' , 'content' content ; We now register the action hook for the Admin menu: addaction 'adminhead', 'addcontextmenuhelpcomments.