Giter Site home page Giter Site logo

Comments (9)

cointilt avatar cointilt commented on August 12, 2024

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.

Wave87 avatar Wave87 commented on August 12, 2024

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.

cointilt avatar cointilt commented on August 12, 2024

Can you provide code snippets of what you are doing?

from upthemes-framework.

Wave87 avatar Wave87 commented on August 12, 2024

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.

cointilt avatar cointilt commented on August 12, 2024

How are you including this file?

from upthemes-framework.

Wave87 avatar Wave87 commented on August 12, 2024

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.

Wave87 avatar Wave87 commented on August 12, 2024

Aha! I figured it. The theme-options.php was saved as theme-options.php.txt. Sorry, my bad.

from upthemes-framework.

dovy avatar dovy commented on August 12, 2024

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.

dovy avatar dovy commented on August 12, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.