-
Notifications
You must be signed in to change notification settings - Fork 3
Configuration
Wireframe Theme is pre-configured with default config data for the most common use cases. Wireframe Theme performs the heavy lifting via objects (PHP class files). Your objects power-up when you wire config data through them. The quickest way to custom configure Wireframe Theme is simply by adjusting each config file.
Each config file is comprised of a single function which returns an array of arguments you define. Below is a list of the current config files packaged with Wireframe Theme. Every config file has a cfg-
prefix in its filename to make it easily identifiable.
- cfg-admin.php
- cfg-constants.php
- cfg-customizer.php
- cfg-editor.php
- cfg-features.php
- cfg-language.php
- cfg-navigation.php
- cfg-notices.php
- cfg-ui.php
- cfg-widgets.php
- wireframe_theme_cfg_admin()
- wireframe_theme_cfg_customizer()
- wireframe_theme_cfg_editor()
- wireframe_theme_cfg_features()
- wireframe_theme_cfg_language()
- wireframe_theme_cfg_navigation()
- wireframe_theme_cfg_notices()
- wireframe_theme_cfg_ui()
- wireframe_theme_cfg_widgets()
The shared arguments below will be used in every config function because every object needs these properties to be declared.
Variable | Type | Description |
---|---|---|
$wired | (bool) | Wires actions & filters via __construct() magic method, e.g. when object instantiates. |
$prefix | (string) | Prefix for various strings, handles, scripts, etc. |
$actions | (array) | Actions to be hoooked. |
$filters | (array) | Filters to be hooked. |
Config functions return data that can be passed into objects. Every object needs some form of data in order to work. Generally, every time you instantiate your objects, you should pass-in a config function as an object parameter. To see what happens when you pass data to your objects, you should view the __construct() magic method of an object.
Example of a Services closure instantiating a Module_Features object with a config function being passed in:
$wireframe_theme_container->features = function () {
return new Module_Features( wireframe_theme_cfg_features() );
};
Example of your config data passed through an object's constructor:
public function __construct( $config ) {
$this->_custom_header = $config['custom_header'];
$this->_content_width = $config['content_width'];
$this->_post_thumbnails = $config['post_thumbnails'];
$this->_post_thumbnails_size = $config['post_thumbnails_size'];
$this->_feed_links = $config['feed_links'];
$this->_nav_menus = $config['nav_menus'];
$this->_post_formats = $config['post_formats'];
$this->_custom_background = $config['custom_background'];
$this->_html5 = $config['html5'];
$this->_title_tag = $config['title_tag'];
$this->_custom_logo = $config['custom_logo'];
$this->_selective_refresh = $config['selective_refresh'];
$this->_starter_content = $config['starter_content'];
parent::__construct( $config );
}
You should reference each argument inside your config functions to see what they do. Also, you can reference some example code below for each config function to view the proper array syntax you should use.
This function returns config data for the Module_Admin object.
Parameters
Parameter | Type | Description |
---|---|---|
None | None | This function does not have parameters. |
Custom Arguments
Variable | Type | Description |
---|---|---|
$styles | (array) | Styles to be hooked. |
$scripts | (array) | Scripts to be hooked. |
$mediamodal | (bool) | True will load the Media Modal script. |
$enqueue | (object) | Instantiate Core_Enqueue with $prefix, $styles, $scripts, $mediamodal. |
$theme_page | (array) | Theme pages to register. |
$menu_pages | (array) | Menu pages to register. |
$submenu_pages | (array) | Sub menu pages to register. |
Return
Return | Type | Description |
---|---|---|
return | (array) | Holds arguments to be passed into the Module_Admin object. |
Examples
Example array for $menu_pages:
$menu_pages = array(
'menu_pages' => array(
'page_title' => WIREFRAME_THEME_PRODUCT,
'menu_title' => WIREFRAME_THEME_PRODUCT,
'capability' => 'manage_options',
'menu_slug' => sanitize_title( WIREFRAME_THEME_TEXTDOMAIN ),
'function' => 'wireframe_theme_admin_page_callback_quickstart',
'icon_url' => esc_url( '' ),
'position' => 8888,
),
);
Example array for $submenu_pages:
$submenu_pages = array(
'quickstart' => array(
'parent_slug' => sanitize_title( WIREFRAME_THEME_TEXTDOMAIN ),
'page_title' => 'Quickstart',
'menu_title' => 'Quickstart',
'capability' => 'manage_options',
'menu_slug' => sanitize_title( WIREFRAME_THEME_TEXTDOMAIN ),
'function' => 'wireframe_theme_admin_page_callback_quickstart',
),
);
See
Source
This function returns config data for the Module_Customizer object.
Parameters
Parameter | Type | Description |
---|---|---|
None | None | This function does not have parameters. |
Custom Arguments
Variable | Type | Description |
---|---|---|
$styles | (array) | Styles to be hooked. |
$scripts | (array) | Scripts to be hooked. |
$settings | (array) | Registers new Customizer settings. |
$partials | (array) | Registers new Customizer partials. |
$controls | (array) | Registers new Customizer controls (not custom controls). |
$panels | (array) | Registers new Customizer panels. |
$sections | (array) | Registers new Customizer sections. |
$enqueue | (object) | Instantiate Core_Enqueue with $prefix, $styles, $scripts, $mediamodal. |
$inline | (array) | Inline styles to . |
Return
Return | Type | Description |
---|---|---|
return | (array) | Holds arguments to be passed into the Module_Customizer object. |
Examples
Example array for $settings:
$settings = array(
'example_setting',
array(
'default' => '#2ba6cb',
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'sanitize_hex_color',
),
);
Example array for $partials:
$partials = array(
'blogname',
array(
'selector' => '.site-title a',
'render_callback' => function() {
bloginfo( 'name' );
},
'container_inclusive' => false,
),
);
Example array for $controls:
$controls = array(
'example_control',
array(
'section' => 'example_section',
'settings' => 'example_setting',
'priority' => 1,
'type' => 'radio',
'choices' => array(
'eenie' => __( 'Eenie', 'wireframe-theme' ),
'meenie' => __( 'Meenie', 'wireframe-theme' ),
'mynee' => __( 'Mynee', 'wireframe-theme' ),
'mo' => __( 'Mo', 'wireframe-theme' ),
),
'label' => __( 'Example Control', 'wireframe-theme' ),
'description' => __( 'Just an example custom control. To modify $controls, see the Customizer section in your functions.php file.', 'wireframe-theme' ),
'active_callback' => '',
'control_class' => null,
),
'link_color',
array(
'section' => 'colors',
'settings' => 'link_color',
'priority' => 10,
'label' => __( 'Link Color', 'wireframe-theme' ),
'description' => __( 'Descriptions goes here...', 'wireframe-theme' ),
'active_callback' => '',
'control_class' => 'WP_Customize_Color_Control',
),
);
Example array for $panels:
$panels = array(
'example_panel',
array(
'priority' => 1,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( 'Example Panel', 'wireframe-theme' ),
'description' => __( 'Just an example of a custom panel. To modify $panels, see the Customizer section in your functions.php file.', 'wireframe-theme' ),
),
);
Example array for $secions:
$sections = array(
'example_section',
array(
'priority' => 1,
'panel' => 'example_panel',
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( 'Example Section', 'wireframe-theme' ),
'description' => __( 'Just an example of a custom section. To modify $sections, see the Customizer section in your functions.php file.', 'wireframe-theme' ),
),
);
Example $enqueue object instantiation:
$enqueue = new Core_Enqueue( $prefix, $styles, $scripts );
Example array for $inline:
$inline = array(
'body',
array(
'style' => 'background-color',
'mod_name' => 'background_color',
'prefix' => '#',
'postfix' => '',
'echo' => true,
),
);
See
Source
This function returns config data for the Module_Editor object.
Parameters
Parameter | Type | Description |
---|---|---|
None | None | This function does not have parameters. |
Custom Arguments
Variable | Type | Description |
---|---|---|
$editor_style | (array) | Path to the TinyMCE editor custom stylesheet. |
$style_formats | (array) | Add Style Formats arrays to the TinyMCE editor. |
Return
Return | Type | Description |
---|---|---|
return | (array) | Holds arguments to be passed into the Module_Editor object. |
Examples
Example string for $editor_style:
$editor_style = WIREFRAME_THEME_CSS . 'editor-style-min';
See
Source
This function returns config data for the Module_Features object.
Parameters
Parameter | Type | Description |
---|---|---|
None | None | This function does not have parameters. |
Custom Arguments
Variable | Type | Description |
---|---|---|
$custom_header | (array) | Image for the theme top header section. |
$content_width | (array) | Maximum allowed width for any content. |
$post_thumbnails | (array) | Enable Post Thumbnails on certain post types. |
$post_thumbnails_size | (array) | Size of the Post Thumbnails. |
$feed_links | (array) | Enables Automatic Feed Links. |
$nav_menus | (array) | Registers navigation menu locations for your theme. |
$post_formats | (array) | Enables Post Formats support. |
$custom_background | (array) | Enables custom backgrounds and colors. |
$html5 | (array) | Enables HTML5 markup for search & comment forms. |
$title_tag | (array) | Enables management of the document title tag. |
$custom_logo | (array) | Enables custom logos. |
$selective_refresh | (array) | Enables selective refresh in the Customizer. |
$starter_content | (array) | To be determined. |
Return
Return | Type | Description |
---|---|---|
return | (array) | Holds arguments to be passed into the Module_Features object. |
Examples
Example array for $custom_header:
$custom_header = array(
'default-image' => '',
'random-default' => true,
'width' => 2000,
'height' => 400,
'flex-height' => true,
'flex-width' => true,
'default-text-color' => '000000',
'header-text' => true,
'uploads' => true,
'wp-head-callback' => 'wireframe_theme_custom_header_css',
'admin-head-callback' => '',
'admin-preview-callback' => '',
);
Example array for $post_formats:
$post_formats = array(
'aside',
'image',
'video',
'quote',
'link',
'gallery',
'status',
'audio',
'chat',
);
Exammple array for $custom_background:
$custom_background = array(
'default-color' => 'ffffff',
'default-image' => '',
'wp-head-callback' => '_custom_background_cb',
'admin-head-callback' => '',
'admin-preview-callback' => '',
);
Example array for $custom_logo:
$custom_logo = array(
'height' => 100,
'width' => 400,
'flex-height' => true,
'flex-width' => true,
'header-text' => array(
'site-title',
'site-description',
),
);
See
Source
This function returns config data for the Core_Language object.
Parameters
Parameter | Type | Description |
---|---|---|
None | None | This function does not have parameters. |
Custom Arguments
Variable | Type | Description |
---|---|---|
$module | (string) | Is this module for a theme or a plugin? |
$deprecated | (bool) | Use the $plugin_rel_path parameter instead? |
$path | (string) | Path to language .mo file. |
Return
Return | Type | Description |
---|---|---|
return | (array) | Holds arguments to be passed into the Core_Language object. |
Examples
$path = WIREFRAME_THEME_LANG;
See
Source
This function returns config data for the Module_Navigation object.
Parameters
Parameter | Type | Description |
---|---|---|
None | None | This function does not have parameters. |
Custom Arguments
Variable | Type | Description |
---|---|---|
$primary_menu | (array) | Registers the primary menu for your theme. |
$secondary_menu | (array) | Registers the secondary menu for your theme. |
$tertiary_menu | (array) | Registers the tertiary menu for your theme. |
Return
Return | Type | Description |
---|---|---|
return | (array) | Holds arguments to be passed into the Module_Navigation object. |
Examples
$args = array(
'primary_menu' => array(
'menu' => '',
'menu_class' => 'menu nav-menu',
'menu_id' => 'primary-menu',
'container' => 'div',
'container_class' => 'menu-all-pages-container',
'container_id' => '',
'fallback_cb' => '',
'before' => '',
'after' => '',
'link_before' => '',
'link_after' => '',
'echo' => true,
'depth' => 0,
'walker' => $walker,
'theme_location' => 'primary',
'items_wrap' => '<div><ul id="%1$s" class="%2$s">%3$s</ul></div>',
),
'secondary_menu' => array(),
'tertiary_menu' => array(),
);
See
Source
This function returns config data for the Module_Notices object.
Parameters
Parameter | Type | Description |
---|---|---|
None | None | This function does not have parameters. |
Custom Arguments
Variable | Type | Description |
---|---|---|
$notices | (array) | Registers notices to be hooked. |
Return
Return | Type | Description |
---|---|---|
return | (array) | Holds arguments to be passed into the Module_Notices object. |
Examples
$notices = array(
'error_init' => array(
'selectors' => 'notice notice-warning is-dismissible',
'subject' => '<strong>Wireframe Theme:</strong>',
'message' => WIREFRAME_THEME_PRODUCT . ' failed to initialize. Please verify your setup.',
),
'warn_activated' => array(
'selectors' => 'notice notice-warning is-dismissible',
'subject' => '<strong>Wireframe Theme:</strong>',
'message' => 'This parent theme is intended for <em>Theme Developers</em> and <strong>does not have any styling</strong>. Did you know Wireframe also has a <a href="/mixatheme/wireframe-child">child theme</a> with default styling? We recommend only Developers modify the parent theme. In most cases, creating unique and inspiring <a href="/mixatheme/wireframe-child">child themes</a> is best practice.',
),
);
See
Source
This function returns config data for the Module_UI object.
Parameters
Parameter | Type | Description |
---|---|---|
None | None | This function does not have parameters. |
Custom Arguments
Variable | Type | Description |
---|---|---|
$enqueue | (object) | Instantiate Core_Enqueue with $prefix, $styles, $scripts, $mediamodal. |
Return
Return | Type | Description |
---|---|---|
return | (array) | Holds arguments to be passed into the Module_UI object. |
Examples
$enqueue = new Core_Enqueue( $prefix, $styles, $scripts, $mediamodal, $stylecss, $commentjs );
See
Source
This function returns config data for the Module_Widgets object.
Parameters
Parameter | Type | Description |
---|---|---|
None | None | This function does not have parameters. |
Custom Arguments
Variable | Type | Description |
---|---|---|
$registered | (array) | Widgets to register. |
$unregistered | (array) | Widgets to unregister (in development). |
Return
Return | Type | Description |
---|---|---|
return | (array) | Holds arguments to be passed into the Module_Widgets object. |
Examples
$registered = array(
'primary' => array(
'name' => __( 'Primary', 'wireframe-theme' ),
'id' => 'sidebar-1',
'description' => __( 'Add important widgets here.', 'wireframe-theme' ),
'before_widget' => '<section id="%1$s" class="widget %2$s clearfix">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
),
'secondary' => array(
'name' => __( 'Secondary', 'wireframe-theme' ),
'id' => 'sidebar-2',
'description' => __( 'Add secondary widgets here.', 'wireframe-theme' ),
'before_widget' => '<section id="%1$s" class="widget %2$s clearfix">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
),
'tertiary' => array(
'name' => __( 'Tertiary', 'wireframe-theme' ),
'id' => 'sidebar-3',
'description' => __( 'Add tertiary widgets here.', 'wireframe-theme' ),
'before_widget' => '<section id="%1$s" class="widget %2$s clearfix">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
),
);
See
Source
Copyright © 2016 MixaTheme. All rights reserved. Wireframe Theme is licensed GPL-2.0.
🐞 Found a Bug, Typo, Error? Help the community by reporting an Issue.
❌ Report a Vulnerability? Please privately message us via our Website.
❤️ Thanks for using MixaTheme products! Follow us? Twitter | Facebook