Problem calling Cufon option from theme-options.php
-
I am working on a new theme with a custom theme options page (
theme-options.php
). I have the function set up withintheme-options.php
so that the options page is working, but I am struggling with setting upheader.php
correctly.Here is my code for
theme-options.php
to list the Cufon fonts://Automatically List Cufon fonts in Folder $alt_cufon_path = TEMPLATEPATH . '/scripts/'; $alt_cufon = array(); if ( is_dir($alt_cufon_path) ) { if ($alt_cufon_dir = opendir($alt_cufon_path) ) { while ( ($alt_cufon_file = readdir($alt_cufon_dir)) !== false ) { if((stristr($alt_cufon_file, ".font.js") !== false) && (stristr($alt_cufon_file, "RTS") == false)){ $alt_cufon[] = $alt_cufon_file; } } } } array_unshift($alt_cufon, "RTS.font.js");
And here is my code for the Cufon section of
theme-options.php
:array("name" => __('Cufon Fonts','V20'), "type" => "section"), array("name" => __('Choose a different Cufon font.','V20'), "type" => "section-desc"), array("type" => "open"), array( "name" => "Cufon Fonts", "desc" => "Select the Cufon font you would like to use for V20.", "id" => "alt_cufon", "type" => "select", "options" => $alt_cufon, "std" => "default"), array("type" => "close"),
And here is what I have so far in `header.php’ at the top of the page:
<?php //Retrieve Theme Options Data global $options; $options = get_option('v20_theme_options');?>
And this is within the
<head>
tag, after<?php wp_head(); ?>
:<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/scripts/cufon-yui.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/scripts/PS.font.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/scripts/Tenderness.font.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/scripts/Gotham-Lt.font.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/scripts/RTS.font.js"></script> <?php //Custon Cufon Fonts switch ($options['alt_cufon']) { case "default.font.js":?> <link rel="index" href="<?php bloginfo('template_directory'); ?>/scripts/default.font.js" type="text/javascript" media="screen" /> <?php break; ?> <?php case "Tenderness.font.js":?> <link rel="index" href="<?php bloginfo('template_directory'); ?>/scripts/Tenderness.font.js" type="text/javascript" media="screen" /> <?php break; ?> <?php case "PS.font.js":?> <link rel="index" href="<?php bloginfo('template_directory'); ?>/scripts/PS.font.js" type="text/javascript" media="screen" /> <?php break; ?> <?php }?> <script type="text/javascript"> <?php echo get_option("alt_cufon"); ?> Cufon.replace('h1, h2, .widget-title, #access, .date-home, #site-title, #site-description'); </script>
The default Cufon font is showing up and working, but when I select a different font in
theme-options.php
, nothing changes.Should I not use
get_option
for this? Or am I not echoing it out correctly? Any help or feedback would be greatly appreciated.Thanks!
- The topic ‘Problem calling Cufon option from theme-options.php’ is closed to new replies.