Comments (9)
That usually means you have to add at least one section to the theme options first. I'll double check that and make sure my last merge did not mess anything up.
from upthemes-framework.
I am also getting the same error and can't enable UpThemes Framework.
I used the sample code in theme-options-example.txt for theme-options.php but still getting that error.
from upthemes-framework.
Can you provide code snippets of what you are doing?
from upthemes-framework.
This is what I have for theme-options.php. It's exactly the same with the content found in the example text file.
$colors_images_tab = array(
"name" => "colors_and_images",
"title" => __("Colors and Images","upfw"),
'sections' => array(
'color_scheme' => array(
'name' => 'color_scheme',
'title' => __( 'Color Scheme', 'upfw' ),
'description' => __( 'Select your color scheme.','upfw' )
)
)
);
register_theme_option_tab($colors_images_tab);
$options = array(
'theme_color_scheme' => array(
"tab" => "colors_and_images",
"name" => "theme_color_scheme",
"title" => "Theme Color Scheme",
"description" => __( "Select a color scheme for your website", "example" ),
"section" => "color_scheme",
"since" => "1.0",
"id" => "color_scheme",
"type" => "select",
"default" => "light",
"valid_options" => array(
"light" => array(
"name" => "light",
"title" => __( "Light", "example" )
),
"dark" => array(
"name" => "dark",
"title" => __( "Dark", "example" )
)
)
),
"theme_footertext" => array(
"tab" => "colors_and_images",
"name" => "theme_footertext",
"title" => "Theme Footer Text",
"description" => __( "Enter text to be displayed in your footer", "example" ),
"section" => "color_scheme",
"since" => "1.0",
"id" => "color_scheme",
"type" => "text",
"default" => "Copyright 2012 UpThemes"
),
"font_color" => array(
"tab" => "colors_and_images",
"name" => "font_color",
"title" => "Font Color",
"description" => __( "Select a font color for your theme", "example" ),
"section" => "color_scheme",
"since" => "1.0",
"id" => "color_scheme",
"type" => "color",
"default" => "#ffffff"
)
);
register_theme_options($options);
from upthemes-framework.
How are you including this file?
from upthemes-framework.
In my template file header.php, I have this:
if( file_exists(get_template_directory().'/theme-options.php') ) {
include_once(get_template_directory().'/theme-options.php');
}
Then I have theme-options.php in the same directory where header.php is located.
from upthemes-framework.
Aha! I figured it. The theme-options.php was saved as theme-options.php.txt. Sorry, my bad.
from upthemes-framework.
I too get an error. Was all excited to give it a try too.
Warning: Invalid argument supplied for foreach() in ~/wordpress/wp-content/themes/options/library/custom.php on line 135
Call Stack:
0.0012 877200 1. {main}() ~/wordpress/wp-admin/themes.php:0
0.0020 1002920 2. require_once('~/wordpress/wp-admin/themes.php:10
0.2719 38413864 3. do_action() ~/wordpress/wp-admin/admin.php:149
0.2719 38416064 4. call_user_func_array() ~/wordpress/wp-includes/plugin.php:406
0.2719 38416120 5. upfw_admin_options_page() ~/wordpress/wp-includes/plugin.php:406
0.2719 38416344 6. upfw_get_page_tab_markup() ~/wordpress/wp-content/themes/roots-grunt/options/options.php:218
from upthemes-framework.
Well, that was easy to fix!
First, change lines 134-144 of ~/options/library/custom.php
if (!empty($tabs)) {
foreach( $tabs as $tab ) {
if( isset($tab['name']) )
$tabname = $tab['name'];
if( isset($tab['title']) )
$tabtitle = $tab['title'];
if ( $tabname == $current ) {
$links[] = "<a class='nav-tab nav-tab-active' href='?page=$page&tab=$tabname'>$tabtitle</a>";
} else {
$links[] = "<a class='nav-tab' href='?page=$page&tab=$tabname'>$tabtitle</a>";
}
}
}
Then update your example theme-options.php to have proper comments. You have a ton of /'s missing. Here's the correct code:
<?php
/*
* Theme Colors and Images Settings Functions file
*
* Below is an example of creating a new tab for your Theme Options page:
*/
$colors_images_tab = array(
"name" => "colors_and_images",
"title" => __("Colors and Images","upfw"),
'sections' => array(
'color_scheme' => array(
'name' => 'color_scheme',
'title' => __( 'Color Scheme', 'upfw' ),
'description' => __( 'Select your color scheme.','upfw' )
)
)
);
register_theme_option_tab($colors_images_tab);
/*
*
* The following example shows you how to register theme options and assign them to tabs:
*/
$options = array(
'theme_color_scheme' => array(
"tab" => "colors_and_images",
"name" => "theme_color_scheme",
"title" => "Theme Color Scheme",
"description" => __( "Select a color scheme for your website", "example" ),
"section" => "color_scheme",
"since" => "1.0",
"id" => "color_scheme",
"type" => "select",
"default" => "light",
"valid_options" => array(
"light" => array(
"name" => "light",
"title" => __( "Light", "example" )
),
"dark" => array(
"name" => "dark",
"title" => __( "Dark", "example" )
)
)
),
"theme_footertext" => array(
"tab" => "colors_and_images",
"name" => "theme_footertext",
"title" => "Theme Footer Text",
"description" => __( "Enter text to be displayed in your footer", "example" ),
"section" => "color_scheme",
"since" => "1.0",
"id" => "color_scheme",
"type" => "text",
"default" => "Copyright 2012 UpThemes"
),
"font_color" => array(
"tab" => "colors_and_images",
"name" => "font_color",
"title" => "Font Color",
"description" => __( "Select a font color for your theme", "example" ),
"section" => "color_scheme",
"since" => "1.0",
"id" => "color_scheme",
"type" => "color",
"default" => "#ffffff"
)
);
register_theme_options($options);
/*
* The different types of options you can define are: text, color, image, select, list, multiple, textarea, page, pages, category, categories
*
*/
?>
Voila. FIXED.
from upthemes-framework.
Related Issues (20)
- Change CSS HOT 2
- Live Preview Not Working ( Invalid argument foreach() options-register.php ) HOT 2
- Gallery Theme and UpTheme Framework
- get_option to get_theme_mod HOT 1
- Multiple color fields HOT 4
- Misc... HOT 1
- Add options page to custom post type HOT 1
- Add options page to custom post type
- Notice: Undefined index: sanitize When Trying to Save Settings HOT 7
- Image path not saved HOT 3
- Invalid argument supplied for foreach() in options-sanitize.php HOT 1
- Options always automatically reset HOT 11
- How to display items in the theme? HOT 1
- Color Picker JavaScript error
- Display Remove button after uploading images
- Call to undefined function register_setting() HOT 1
- register_settings() error
- Image Upload button not working.
- Its still working?
- UpThemes-Framework
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from upthemes-framework.