2012-04-17, 22:37:17
this is great -
i was able to adapt this into a new plugin for a custom theme, and it perfectly creates the relevant xml file to store the settings...
however for some reason i can't seem to get the template function to read the xml values.
I have this code in my functions.php:
and i have this in my template footer:
i can't seem to figure out why this doesn't work...it should be as simple as the functions.php file getting the values from the xml file and then the template using those values...
I also tried using the regular Innovation Plugin on a different template, and copied the functions.php to the other theme folder and copied the code exactly from the Innovation theme, but it doesn't work there either..
would be great to solve this because it could be the beginnings of a generic theme settings plugin that could be used for other themes...
-marc
i was able to adapt this into a new plugin for a custom theme, and it perfectly creates the relevant xml file to store the settings...
however for some reason i can't seem to get the template function to read the xml values.
I have this code in my functions.php:
Code:
function Delphic_Settings() {
$file = GSDATAOTHERPATH . 'DelphicSettings.xml';
if (file_exists($file)) {
$p = getXML($file);
if ($p->facebook != '' ) define('FACEBOOK', $p->facebook);
if ($p->twitter != '' ) define('TWITTER', $p->twitter);
if ($p->linkedin != '' ) define('LINKEDIN', $p->linkedin);
if ($p->flickr != '' ) define('FLICKR', $p->flickr);
if ($p->dribbble != '' ) define('DRIBBBLE', $p->dribbble);
return true;
} else {
return false;
}
}
and i have this in my template footer:
Code:
<?php if (defined('TWITTER')) { ?>
<li><a href="<?php echo TWITTER; ?>"><img src="<?php get_theme_url(); ?>/style/images/icon-twitter.png" alt="" /></a></li>
<?php } ?>
i can't seem to figure out why this doesn't work...it should be as simple as the functions.php file getting the values from the xml file and then the template using those values...
I also tried using the regular Innovation Plugin on a different template, and copied the functions.php to the other theme folder and copied the code exactly from the Innovation theme, but it doesn't work there either..
would be great to solve this because it could be the beginnings of a generic theme settings plugin that could be used for other themes...
-marc