1

我正在尝试做一个theme-settings.php,据我所知,它与我在任何页面教程中看到的所有内容完全相同。但由于某种原因它不起作用,这意味着我错过了一些东西。

思想馆信息

    name = Thinkrium
description = Thinkrium theme.
core=7.x

regions[content]      = Thinkrium Content
regions[left_nav_bar] = Thinkrium Main Navigation
regions[footer]       = Thinkrium Footer
regions[header]       = Thinkrium Header

stylesheets[all][] = css/style.css
stylesheets[all][] = css/overlay.css

scripts[] = js/left_nav_bar.js
scripts[] = js/overlay.js

settings[hidden_text_color]   = #0000ff
settings[hidden_background_color]  = #000000

这是theme-settings.php

$form['hidden_text_color'] = array(
    '#type' => 'hidden',
    "#attributes" => array('id' => 'hidden_text_color'),
    '#default_value' => theme_get_setting('hidden_text_color'),
);

$form['hidden_background_color'] = array(
    '#type' => 'hidden',
    "#attributes" => array('id' => 'hidden_background_color'),            
    '#default_value' => theme_get_setting('hidden_background_color'),
);

我什么也得不到。

4

1 回答 1

0

您需要在模板文件(例如 page.tpl.php)中询问您的变量。它应该是这样的:

if (theme_get_setting('hidden_background_color')): ?>
  //Do whatever you want.
endif;

if (theme_get_setting('hidden_text_color')): ?>
   //Do whatever you want.
endif;
于 2018-03-26T11:27:21.973 回答