1. Home
  2. Docs
  3. WordPress Studio Framework
  4. Getting Started

Getting Started

The fastest way to get started with the WordPress Studio Framework (WPSF) is to utilize the code as a stand-alone activated WordPress plugin on a WordPress site. Then all your customization and construction of different options for your site (client’s site) can be placed in the active theme’s functions.php file.

Note: You can also embed/include the WordPress Studio Framework code library as an addon for your plugins or themes you distribute to clients or customers. More on this deeper in the documentation.

// First check to see if the class exists (is the WordPress Studio Framework already loaded on your site.
if ( class_exists( 'WPSF' ) ) {
    //Set a unique ID/Prefix
    $prefix = 'my_first_framework';

    // Create Options
    WPSF::createOptions( $prefix, array(
        'menu_title' => 'My First Framework',
        'menu_slug' => 'my-first-framework',
    ) );

    // Create Section
    WPSF::createSection( $prefix, array(
        'title' => 'Title Number One',
        'fields' => array(
          // text field
          array(
            'id' => 'text-one',
            'type' => 'text',
            'title' => 'First Text Field',
          ),
        )
    ) );

    // Create Another Section
    WPSF::createSection( $prefix, array(
        'title' => 'Title Number Two',
        'fields' => array(
          // textarea field
          array(
            'id' => 'text-two',
            'type' => 'textarea',
            'title' => 'Textfield Area',
          ),
        )
    ) );
}

Don’t worry, we will go over all of the above in additional documentation. But you might also be wondering how difficult it is to get saved values out of the WordPress database so that you can utilize the values in themes and plugin code? It is actually very easy.

// Get Options out of the WordPress Studio Framework 
$options = get_option( 'my_first_framework' );

echo $options['text-one'];
echo $options['text-two'];

It is really that simple.

Over the course of the rest of the documentation and examples, you will see that the WordPress Studio Framework can be used for simple solutions as well as complex customization solutions.

Was this article helpful to you? Yes No

How can we help?