从function.php
.
函数.php:
<?php
// Theme Options
require_once(TEMPLATEPATH . '/functions/admin-menu.php');
add_action('wp_head', 'theme_options', 'get_image_size');
function theme_options() {
// Initiate Theme Options
$options = get_option('plugin_options');
// If a logo image was uploaded then remove text from site title
if ($options['logo'] != NULL)
$remove_text = '-9999px';
else
$remove_text = 0;
?><style>
body {
background-color: <?php echo $options['color_scheme']; ?>
}
#header h1 a {
background: url(<?php echo $options['logo']; ?>) no-repeat scroll 0 0;
text-indent: <?php echo $remove_text; ?>;
}
</style><?php
}
function get_image_size() {
list($width, $height, $type, $attr) = getimagesize($options['logo']);
echo "Image width " .$width;
echo "<BR>";
echo "Image height " .$height;
echo "<BR>";
var_dump($width);
var_dump($heigt);
}
$options['logo']
正在返回http://localhost/wordpress/wp-content/uploads/2010/12/logo4.png
,因此正在显示图像。
我也这样做var_dump
了$width
,$height
但他们没有出现。
有什么建议么?
编辑:我粘贴了functions.php
. $options['logo']
在theme_option
函数中完美运行,所以我不知道为什么它在get_image_size
函数中不起作用。