예제 #1
0
function nuts_logo($a = "home")
{
    if (nuts_option_registered("nuts_logo")) {
        if (nuts_get_image("nuts_logo") != '') {
            if ($a == "home") {
                echo '<a href="' . get_bloginfo('url') . '">' . nuts_get_image("nuts_logo", nuts_get_image_size("nuts_logo"), "nuts-logo") . '</a>';
            }
            if ($a == "img") {
                echo nuts_get_image("nuts_logo", nuts_get_image_size("nuts_logo"), "nuts-logo");
            }
        } else {
            if ($a == "home") {
                echo '<h1 class="nuts-logo"><a href="' . get_bloginfo('url') . '">' . get_bloginfo("name") . '</a></h1>';
            }
            if ($a == "img") {
                echo '<h1 class="nuts-logo">' . get_bloginfo("name") . '</h1>';
            }
        }
    } else {
        nuts_error("Please register a logo first before calling the nuts_logo() function.");
    }
}
예제 #2
0
파일: nuts.php 프로젝트: destynova2001/nuts
function nuts_inner_custom_box($post, $metabox)
{
    // Add an nonce field so we can check for it later.
    wp_nonce_field('nuts_inner_custom_box', 'nuts_inner_custom_box_nonce');
    if ($metabox["args"]["description"] != '') {
        echo $metabox["args"]["description"];
    }
    // Selects all options from $nuts_options_array which are in the current section
    $options = nuts_options_by_section($metabox["args"]["section"]);
    foreach ($options as $option) {
        if ($option["type"] == "") {
            nuts_error(__('No data type was set up for option: ', 'nuts') . $option["name"]);
        } elseif (!nuts_type_registered($option["type"])) {
            nuts_error('Invalid data type (' . $option["type"] . ') for option: ' . $option["name"]);
        } else {
            $meta_key = '_' . nuts_get_section($option["name"]);
            if (get_post_meta($post->ID, $meta_key) == "") {
                $values = array();
            } else {
                $values = get_post_meta($post->ID, $meta_key);
            }
            if (!isset($values[0][$option["name"]])) {
                $values[0][$option["name"]] = "";
            }
            echo '<div class="clearfix meta-option">';
            echo '<span class="meta-option-label">' . $option["title"] . '</span>';
            $type_func = "nuts_type_" . $option["type"] . "_field";
            $type_func($option["name"], $values[0][$option["name"]]);
            echo '</div><p class="optiondesc">' . $option["description"] . '</p><div class="clearfix"></div>';
        }
    }
    echo '<div class="clearfix"></div>';
}