• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Extending Admin Class Error

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Extending Admin Class Error

This topic is: not resolved

Tagged: child class, extend, genesis_admin, plugin

  • This topic has 1 reply, 2 voices, and was last updated 13 years, 6 months ago by Gary Jones.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • March 16, 2013 at 7:16 pm #28389
    somweb
    Member

    I wrote a theme where I extended the Admin class successfully. Doing it now for a plugin, I am getting the following error on the first line of the new extended class:

    class UVASOMNAVBAR_Settings extends Genesis_Admin_Boxes {

    When in debug mode, here is the error I get on the line above:

    Fatal error: Class 'Genesis_Admin_Boxes' not found

    I am running Genesis 1.9 and am installing the plugin on the child theme where I also extended the class. On the child theme, the name of the new child class is different, so I know it's not conflicting.

    So, my question is, do you use a different class or syntax if you are extending the admin class in a plugin rather than in a child theme?

    April 12, 2013 at 1:54 pm #35072
    Gary Jones
    Member

    Plugins get set up by WP before themes do, so at the moment your plugin runs and the class gets parsed, none of the Genesis_Admin_* classes exist.

    What you need to do is to put your class into a different file, then wrap a function around the require() call, which is hooked into genesis_admin_init. You'll see that hook fires at the end of genesis/lib/classes/admin.php.

    // my-plugin/class-uvasomnavbar.php
    
    class UVASOMNAVBAR_Settings extends Genesis_Admin_Boxes {
    ...
    }
    
    // my-plugin/my-plugin.php
    
    add_action( 'genesis_admin_init', 'myplugin_admin_init' );
    /**
     * Include admin class, now Genesis admin classes exist, then instantiate it.
     */
    function myplugin_admin_init() {
        require( 'path/to/class-uvasomnavbar.php' );
        new UVASOMNAVBAR_Settings();
    }
    

    WordPress Engineer, and key contributor the Genesis Framework | @GaryJ

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble