0

As my last (first) plugin got a bit hard to manage with 6 admin pages in 1 file, I decided to split them up for this one, but I am getting nothing but issues doing so.

In my plugins functions file (LoadPressFunctions.php) I have this:

add_action( 'admin_menu', 'my_plugin_menu' );

function my_plugin_menu() {
    add_menu_page( 'LoadPress', 'LoadPress', 'manage_options', 'LoadPressPlugin', 'LoadPress_Plugin', 'dashicons-download', 99  );
}

function LoadPress_Plugin() {
    if ( !current_user_can( 'manage_options' ) )  {
        wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
    }
    include 'LoadPressOptions-Home.php';
}

And in my LoadPressOptions-Home.php file I have this:

<?php
echo '<style>
    h1 {
        letter-spacing: 8px;
    }
    .sectionHeader {
        background-color: #E5E5E5;
        padding: 1px 10px 1px 10px;
        margin: 10px 0px 0px 0px;
        border-left: 4px solid #2A333E;
    }
    .sectionNotification {
        background-color: #E5E5E5;
        padding: 1px 10px 1px 10px;
        margin: 5px 0px 0px 0px;
        border-left: 4px solid #ffce1f;
    }
    ul#adminmenu a.wp-has-current-submenu:after, ul#adminmenu>li.current>a.current:after {
        border-right-color: #12171C;
    }
  </style>';

    echo '<div class="wrap">';
    echo '<h1>LoadPress</h1>';
    echo '<p class="description" id="tagline-description">Simplify Brilliance, Simplify Life.</p>';
    ?>
    <h2 class="nav-tab-wrapper">
            <a class="nav-tab nav-tab-active" href="<?php echo admin_url() ?>admin.php?page=LoadPressPlugin">Home</a>
            <!--<a class="nav-tab" href="<?php echo admin_url() ?>admin.php?page=LoadPressPlugin-Settings">Settings</a>-->
            <a class="nav-tab" href="<?php echo admin_url() ?>admin.php?page=LoadPressPlugin-About">About/Credits</a>
            <a class="nav-tab" style="background-color: red;">Settings (Not available in Alpha)</a>
            <a class="nav-tab" href="<?php echo admin_url() ?>admin.php?page=LoadPressPlugin-Docs">Documentation</a>
            <a class="nav-tab" style="background-color: red;">Email Editor (Coming Soon)</a>
        </h2>
        <?php
//Options
    echo '<div>';
    ?>
    <img src="<?php echo get_site_url() ?>/wp-content/plugins/LoadPress/LoadPressLogo-Banner.png" style="margin-top: 10px;"/>
<?php
    echo '</div>';
?>
    <div class="sectionNotification">
    <h3>Thank You for choosing LoadPress</h3>
    </div>

    <div class="sectionHeader">
    <h3>What is LoadPress?</h3>
    <p>LoadPress is a professional plugin that allows site community members to post downloadable files, such as modifications, save files and other community applicable files.</p>
    <p>This plugin was developed for use primarily with modding communities for video games, and other video game related products, and uses a simplistic yet robust setup with several different fallbacks in case of mistakes.</p>
    <p>At the time of writing this, LoadPress is primarily used for in-house projects developed by Kyle Briggs & Don Briggs Ltd.</p>
    </div>

    <div class="sectionHeader">
    <h3>Why LoadPress?</h3>
    <p>LoadPress is an excellent choice for targeted community functionality as it offers several things other plugins do not:</p>
    <ol>
        <li>It allows users to upload files in any format (settable by editing the plugin).</li>
        <li>It allows total administrative control over all files, but only gives regular users access to their own.</li>
        <li>It simplifies the Media section to only display a regular user's own media (admins can see all).</li>
        <li>It is the ONLY plugin currently available for Wordpress that offers this functionality tailored specifically to file-sharing, and works seamlessly with any SEO package.</li>
        <li>At the core, it runs on Wordpress' own API so the custom post type can be edited to your needs easily.</li>
    </ol>
    </div>

    </div>
    <?php

But I get a blank page now that I have moved this content from the main file to it's own one, no content loads from it.

If I replace the file content with:

<?php
echo '<h1>Hi</h1>';

Everything works fine, but I cannot see ANY syntax errors with the Home.php content as it was copied and pasted straight out the function (and added

Any ideas?

1 Answer 1

-1

Have you enabled debugging in wordpress?

Open wp-config.php in the root wordpress folder and change this line:

define('WP_DEBUG', false);

to

define('WP_DEBUG', true);

Your PHP errors will then output to the screen.

6
  • Nothing prints to the screen with this.
    – K.Briggs
    Jun 20, 2016 at 14:28
  • What happens if put a syntax error in your file? Does the syntax error show up?
    – Tex0gen
    Jun 20, 2016 at 14:38
  • Interestingly, No.
    – K.Briggs
    Jun 20, 2016 at 15:41
  • Okay, what is your hosting environment like?
    – Tex0gen
    Jun 20, 2016 at 15:42
  • Sorry, posted that prematurely. Are you hosting locally? Shared hosting or dedicated?
    – Tex0gen
    Jun 20, 2016 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.