Call to a member function main() on a non-object
-
I’m trying to use wordpress for my site, however I just want to use the back end for users to edit my content and completely customize the front end. Rather than editing templates, I want to include wordpress in one of my classes and basically remove the wordpress header/footer.
I’m new to wordpress, so anyone else’s experience or feedback on how I’m doing this would be greatly appreciated.
<?php class GamerSourceApplicationSiteArticleView extends GamerSourceApplicationSitePage { /*===========================================*/ /* Public Functions /*===========================================*/ function authenticate () { return true; } function show () { /** * Front to the WordPress application. This file doesn't do anything, but loads * wp-blog-header.php which does and tells WordPress to load the theme. * * @package WordPress */ /** * Tells WordPress to load the WordPress theme and output it. * * @var bool */ define('WP_USE_THEMES', true); /** Loads the WordPress Environment and Template */ require($this->tru->config->get("root.path")."/author/wp-blog-header.php"); // end word press } //..... class continues, but this is the only function that "shows" content
Through doing that, I originally had an error with set_prefix because $wpdb was not global. So I changed my wp-settings.php to global it and it works. However I”m now receiving the following error:
Fatal error: Call to a member function main() on a non-object in C:\wamp\www\gamer-source\author\wp-includes\functions.php on line 1111
Line 1111 is `function wp( $query_vars = ” ) {
global $wp, $wp_query, $wp_the_query;
$wp->main( $query_vars ); //line 1111if( !isset($wp_the_query) )
$wp_the_query = $wp_query;
}`Any thoughts?
- The topic ‘Call to a member function main() on a non-object’ is closed to new replies.