Displaying a help page
-
A colleague gave me the following code to add a Help page to the admin menu (so that clients can add content themselves). It involves adding code to functions.php. Obviously every time I upgrade my theme I lose this bit of code. I could create a child theme but Code Snippets was recommended. So I’ve added the following code in Code Snippets:
include_once( '../../functions/leedspff-help.php' );
but the help file isn’t displaying.
This is the absolute path to the leedspff-help.php file – https://dev.leedspff.org.uk/htdocs/wp-content/functions/leedspff-help.phpObviously I’ve done something both stupid and probably quite easy to fix, so if anyone has any thoughts I’d be very very grateful!
/* Put this in functions/leedspff-help.php */
<?php add_action('admin_menu', function(){ add_menu_page( 'LeedsPFF Help', 'LeedsPFF Help', 'administrator', __FILE__, 'display_leedspff_help', '', 30 ); }); function display_leedspff_help(){?> <h2>LeedsPFF Help</h2> <?php $help_text = get_post( 176 ); // Don't apply filter so that shortcodes remain as text //$help_text = apply_filters( 'the_content', $help_text->post_content ); $help_text = wpautop( $help_text->post_content ); echo $help_text; }
- The topic ‘Displaying a help page’ is closed to new replies.