• Resolved judeabb

    (@judeabb)


    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.php

    Obviously 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;
           
      }
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    You will need to use an absolute path to the file you want to include:

    include_once WP_CONTENT_DIR . '/functions/leedspff-help.php';

    Thread Starter judeabb

    (@judeabb)

    Genius! Thank you!
    I knew it’d be something straightforeward.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Displaying a help page’ is closed to new replies.