Simple custom theme option not being saved

I’m not a web developer and have been following a tutorial on how to add options to a simple self-written theme.

In functions.php I’ve added the following code:

Read More
<?php
$themename = "Theme Name";
$shortname = "sn";
$options = array (


    array(  "name" => "Price"),

    array(  "type" => "open"),

    array(  "name" => "Price",
            "desc" => "Enter a price to sell your item for.",
            "id" => $shortname."_price",
            "std" => "",
            "type" => "text"),

    array(  "type" => "close"),

);
?>

In index.php I have the following code

    <?php if ($sn_price) { ?>
        <h2><? echo "$" . $sn_price; ?></h2>
    <? } else { ?>
        <h2>Price on registration of interest.</h2>
    <? } ?>

The theme options are available in the back end, and I have saved the price in the theme options.

The price is saved when I return to the back end to check the options, but $sn_price displays as empty on the front end.

Any ideas why?

Edit: Here is functions.php

Related posts

Leave a Reply

1 comment