Artisteer Theme and Changing Header.jpg

Hi Guys,

I am new to WPMU and php, I purchased a theme product called Artisteer, it is an easy to use product and the themes work just fine.

I found the tutorial to change the header graphic:

how-to giving your users changeable custom-headers/

I have tried inserting the code for about 3 hours, but it gives an error i think that there is a tag in the wrong place, can anyone put me out of my misery, please.

Tutorial code:

<?php

// widgetize sidebar

if ( function_exists('register_sidebar') )

register_sidebar();

//make changeable header

define('HEADER_TEXTCOLOR', '');

define('HEADER_IMAGE', '%s/setta.jpg'); // %s is theme dir uri

define('HEADER_IMAGE_WIDTH', 985);

define('HEADER_IMAGE_HEIGHT', 200);

define( 'NO_HEADER_TEXT', true );

function atypxmas_admin_header_style() {

?>

<style type="text/css">

#headimg {

height: <?php echo HEADER_IMAGE_HEIGHT; ?>px;

width: <?php echo HEADER_IMAGE_WIDTH; ?>px;

}

#headimg h1, #headimg #desc {

display: none;

}

</style>

<?php

}

function header_style() {

?>

<style type="text/css">

#header{

background: url(<?php header_image() ?>) no-repeat;

}

</style>

<?php

}

add_custom_image_header('header_style', 'atypxmas_admin_header_style');

?>

This is my Artisteer functions.php:

<?php

$artThemeSettings = array(

'menu.showSubmenus' => true,

'menu.homeCaption' => "Home",

'menu.showHome' => true,

'menu.topItemBegin' => "<span class="l"></span><span class="r"></span><span class="t">",

'menu.topItemEnd' => "</span>"

);

load_theme_textdomain('kubrick');

$themename = "adeptris";

$shortname = "artisteer";

$default_footer_content = "Contact Us | Terms of Use | Trademarks | Privacy Statement
Copyright © 2009 ".get_bloginfo('name').". All Rights Reserved.";

$options = array (

array( "name" => "HTML",

"desc" => sprintf(__('XHTML: You can use these tags: %s‘, ‘kubrick’:wink:, ‘a, abbr, acronym, em, b, i, strike, strong, span’:wink:,

“id” => “art_footer_content”,

“std” => $default_footer_content,

“type” => “textarea”:wink:

);

function art_update_option($key, $value){

update_option($key, (get_magic_quotes_gpc()) ? stripslashes($value) : $value);

}

function art_add_admin() {

global $themename, $shortname, $options;

if ( $_GET == basename(__FILE__) ) {

if (‘save’ == $_REQUEST ) {

foreach ($options as $value) {

if($value != ‘multicheck’:wink:{

art_update_option( $value, $_REQUEST[ $value ] );

}else{

foreach($value as $mc_key => $mc_value){

$up_opt = $value.’_’.$mc_key;

art_update_option($up_opt, $_REQUEST[$up_opt] );

}

}

}

foreach ($options as $value) {

if($value != ‘multicheck’:wink:{

if( isset( $_REQUEST[ $value ] ) ) { art_update_option( $value, $_REQUEST[ $value ] ); } else { delete_option( $value ); }

}else{

foreach($value as $mc_key => $mc_value){

$up_opt = $value.’_’.$mc_key;

if( isset( $_REQUEST[ $up_opt ] ) ) { art_update_option( $up_opt, $_REQUEST[ $up_opt ] ); } else { delete_option( $up_opt ); }

}

}

}

header(“Location: themes.php?page=functions.php&saved=true”:wink:;

die;

}

}

add_theme_page(“Footer”, “Footer”, ‘edit_themes’, basename(__FILE__), ‘art_admin’:wink:;

}

function art_admin() {

global $themename, $shortname, $options;

if ( $_REQUEST ) echo ‘<div id=”message” class=”updated fade”><p>‘.$themename.’ settings saved.</p></div>’;

?>

<div class=”wrap”>

<h2>Footer</h2>

<form method=”post”>

<table class=”optiontable” style=”width:100%;”>

<?php foreach ($options as $value) {

switch ( $value ) {

case ‘text’:

option_wrapper_header($value);

?>

<input style=”width:100%;” name=”<?php echo $value; ?>” id=”<?php echo $value; ?>” type=”<?php echo $value; ?>” value=”<?php if ( get_settings( $value ) != “”:wink: { echo get_settings( $value ); } else { echo $value; } ?>” />

<?php

option_wrapper_footer($value);

break;

case ‘select’:

option_wrapper_header($value);

?>

<select style=”width:70%;” name=”<?php echo $value; ?>” id=”<?php echo $value; ?>”>

<?php foreach ($value as $option) { ?>

<option<?php if ( get_settings( $value ) == $option) { echo ‘ selected=”selected”‘; } elseif ($option == $value) { echo ‘ selected=”selected”‘; } ?>><?php echo $option; ?></option>

<?php } ?>

</select>

<?php

option_wrapper_footer($value);

break;

case ‘textarea’:

$ta_options = $value;

option_wrapper_header($value);

?>

<textarea name=”<?php echo $value; ?>” id=”<?php echo $value; ?>” style=”width:100%;height:100px;”><?php

if( get_settings($value) !== false) {

echo get_settings($value);

}else{

echo $value;

}?></textarea>

<?php

option_wrapper_footer($value);

break;

case “radio”:

option_wrapper_header($value);

foreach ($value as $key=>$option) {

$radio_setting = get_settings($value);

if($radio_setting != ”:wink:{

if ($key == get_settings($value) ) {

$checked = “checked=”checked””;

} else {

$checked = “”;

}

}else{

if($key == $value){

$checked = “checked=”checked””;

}else{

$checked = “”;

}

}?>

<input type=”radio” name=”<?php echo $value; ?>” value=”<?php echo $key; ?>” <?php echo $checked; ?> /><?php echo $option; ?>

<?php

}

option_wrapper_footer($value);

break;

case “checkbox”:

option_wrapper_header($value);

if(get_settings($value)){

$checked = “checked=”checked””;

}else{

$checked = “”;

}

?>

<input type=”checkbox” name=”<?php echo $value; ?>” id=”<?php echo $value; ?>” value=”true” <?php echo $checked; ?> />

<?php

option_wrapper_footer($value);

break;

case “multicheck”:

option_wrapper_header($value);

foreach ($value as $key=>$option) {

$pn_key = $value . ‘_’ . $key;

$checkbox_setting = get_settings($pn_key);

if($checkbox_setting != ”:wink:{

if (get_settings($pn_key) ) {

$checked = “checked=”checked””;

} else {

$checked = “”;

}

}else{

if($key == $value){

$checked = “checked=”checked””;

}else{

$checked = “”;

}

}?>

<input type=”checkbox” name=”<?php echo $pn_key; ?>” id=”<?php echo $pn_key; ?>” value=”true” <?php echo $checked; ?> /><label for=”<?php echo $pn_key; ?>”><?php echo $option; ?></label>

<?php

}

option_wrapper_footer($value);

break;

case “heading”:

?>

<tr valign=”top”>

<td colspan=”2″ style=”text-align: center;”><h3><?php echo $value; ?></h3></td>

</tr>

<?php

break;

default:

break;

}

}

?>

</table>

<p class=”submit”>

<input name=”save” type=”submit” value=”Save changes” />

<input type=”hidden” name=”action” value=”save” />

</p>

</form>

</div>

<?php

}

function option_wrapper_header($values){

?>

<tr valign=”top”>

<th scope=”row” style=”width:1%;white-space: nowrap;”><?php echo $values; ?>:</th>

<td>

<?php

}

function option_wrapper_footer($values){

?>

</td>

</tr>

<tr valign=”top”>

<td> </td><td><small><?php echo $values; ?></small></td>

</tr>

<?php

}

add_action(‘admin_menu’, ‘art_add_admin’:wink:;

if (!function_exists(‘get_search_form’:wink:) {

function get_search_form()

{

include (TEMPLATEPATH . “/searchform.php”:wink:;

}

}

if (!function_exists(‘get_previous_posts_link’:wink:) {

function get_previous_posts_link($label)

{

ob_start();

previous_posts_link($label);

return ob_get_clean();

}

}

if (!function_exists(‘get_next_posts_link’:wink:) {

function get_next_posts_link($label)

{

ob_start();

next_posts_link($label);

return ob_get_clean();

}

}

if (!function_exists(‘get_previous_post_link’:wink:) {

function get_previous_post_link($label)

{

ob_start();

previous_post_link($label);

return ob_get_clean();

}

}

if (!function_exists(‘get_next_post_link’:wink:) {

function get_next_post_link($label)

{

ob_start();

next_post_link($label);

return ob_get_clean();

}

}

function art_comment($comment, $args, $depth)

{

$GLOBALS = $comment; ?>

<li <?php comment_class(); ?> id=”li-comment-<?php comment_ID() ?>”>

<div id=”comment-<?php comment_ID(); ?>”>

<div class=”art-Post”>

<div class=”art-Post-tl”></div>

<div class=”art-Post-tr”></div>

<div class=”art-Post-bl”></div>

<div class=”art-Post-br”></div>

<div class=”art-Post-tc”></div>

<div class=”art-Post-bc”></div>

<div class=”art-Post-cl”></div>

<div class=”art-Post-cr”></div>

<div class=”art-Post-cc”></div>

<div class=”art-Post-body”>

<div class=”art-Post-inner art-article”>

<div class=”art-PostContent”>

<div class=”comment-author vcard”>

<?php echo get_avatar($comment,$size=’48’,$default='<path_to_url>’ ); ?>

<cite class=”fn”><?php comment_author_link(); ?>:</cite>

</div>

<?php if ($comment->comment_approved == ‘0’:wink: : ?>

<?php _e(‘Your comment is awaiting moderation.’:wink: ?>

<?php endif; ?>

<div class=”comment-meta commentmetadata”>comment_ID ) ) ?>”><?php printf(__(‘%1$s at %2$s’:wink:, get_comment_date(), get_comment_time()) ?><?php edit_comment_link(‘(‘.__(‘Edit’, ‘kubrick’:wink:.’:wink:’,’ ‘,”:wink: ?></div>

<?php comment_text() ?>

<div class=”reply”>

<?php comment_reply_link(array_merge( $args, array(‘depth’ => $depth, ‘max_depth’ => $args))) ?>

</div>

</div>

<div class=”cleared”></div>

</div>

<div class=”cleared”></div>

</div>

</div>

</div>

<?php

}

if (function_exists(‘register_sidebars’:wink:) {

register_sidebars(2, array(

‘before_widget’ => ‘<div id=”%1$s” class=”widget %2$s”>’.'<!— BEGIN Widget —>’,

‘before_title’ => ‘<!— BEGIN WidgetTitle —>’,

‘after_title’ => ‘<!— END WidgetTitle —>’,

‘after_widget’ => ‘<!— END Widget —>’.'</div>’

));

}

function art_normalize_widget_style_tokens($content) {

$bw = ‘<!— BEGIN Widget —>’;

$bwt = ‘<!— BEGIN WidgetTitle —>’;

$ewt = ‘<!— END WidgetTitle —>’;

$bwc = ‘<!— BEGIN WidgetContent —>’;

$ewc = ‘<!— END WidgetContent —>’;

$ew = ‘<!— END Widget —>’;

$result = ”;

$startBlock = 0;

$endBlock = 0;

while (true) {

$startBlock = strpos($content, $bw, $endBlock);

if (false === $startBlock) {

$result .= substr($content, $endBlock);

break;

}

$result .= substr($content, $endBlock, $startBlock – $endBlock);

$endBlock = strpos($content, $ew, $startBlock);

if (false === $endBlock) {

$result .= substr($content, $endBlock);

break;

}

$endBlock += strlen($ew);

$widgetContent = substr($content, $startBlock, $endBlock – $startBlock);

$beginTitlePos = strpos($widgetContent, $bwt);

$endTitlePos = strpos($widgetContent, $ewt);

if ((false == $beginTitlePos) xor (false == $endTitlePos)) {

$widgetContent = str_replace($bwt, ”, $widgetContent);

$widgetContent = str_replace($ewt, ”, $widgetContent);

} else {

$beginTitleText = $beginTitlePos + strlen($bwt);

$titleContent = substr($widgetContent, $beginTitleText, $endTitlePos – $beginTitleText);

if (‘ ‘ == $titleContent) {

$widgetContent = substr($widgetContent, 0, $beginTitlePos)

. substr($widgetContent, $endTitlePos + strlen($ewt));

}

}

if (false === strpos($widgetContent, $bwt)) {

$widgetContent = str_replace($bw, $bw . $bwc, $widgetContent);

} else {

$widgetContent = str_replace($ewt, $ewt . $bwc, $widgetContent);

}

$result .= str_replace($ew, $ewc . $ew, $widgetContent);

}

return $result;

}

function art_sidebar($index = 1)

{

if (!function_exists(‘dynamic_sidebar’:wink:) return false;

ob_start();

$success = dynamic_sidebar($index);

$content = ob_get_clean();

if (!$success) return false;

$content = art_normalize_widget_style_tokens($content);

$replaces = array(

‘<!— BEGIN Widget —>’ => “<div class=”art-Block”>rn <div class=”art-Block-body”>rn”,

‘<!— BEGIN WidgetTitle —>’ => “<div class=”art-BlockHeader”>rn <div class=”art-header-tag-icon”>rn <div class=”t”>”,

‘<!— END WidgetTitle —>’ => “</div>rn </div>rn</div>”,

‘<!— BEGIN WidgetContent —>’ => “<div class=”art-BlockContent”>rn <div class=”art-BlockContent-body”>rn”,

‘<!— END WidgetContent —>’ => “rn <div class=”cleared”></div>rn </div>rn</div>rn”,

‘<!— END Widget —>’ => “rn <div class=”cleared”></div>rn </div>rn</div>rn”

);

$bwt = ‘<!— BEGIN WidgetTitle —>’;

$ewt = ‘<!— END WidgetTitle —>’;

if (” == $replaces[$bwt] && ” == $replaces[$ewt]) {

$startTitle = 0;

$endTitle = 0;

$result = ”;

while (true) {

$startTitle = strpos($content, $bwt, $endTitle);

if (false == $startTitle) {

$result .= substr($content, $endTitle);

break;

}

$result .= substr($content, $endTitle, $startTitle – $endTitle);

$endTitle = strpos($content, $ewt, $startTitle);

if (false == $endTitle) {

$result .= substr($content, $startTitle);

break;

}

$endTitle += strlen($ewt);

}

$content = $result;

}

$content = str_replace(array_keys($replaces), array_values($replaces), $content);

echo $content;

return true;

}

function art_activeID($pages){

$result = null;

foreach ($pages as $index => $page){

if (is_page($page->ID)) {

$result = $page;

break;

}

}

while($result && $result->post_parent) {

foreach ($pages as $parent){

if ($parent->ID == $result->post_parent) {

$result = $parent;

breack;

}

}

}

return ($result ? $result->ID : null);

}

function art_blogID($pages){

$result = null;

if(!’page’ == get_option(‘show_on_front’:wink:) return $result;

$blogID = get_option(‘page_for_posts’:wink:;

if (!$blogID) return $result;

foreach ($pages as $index => $page){

if ($page->ID == $blogID) {

$result = $page;

break;

}

}

while($result && $result->post_parent) {

foreach ($pages as $parent){

if ($parent->ID == $result->post_parent) {

$result = $parent;

breack;

}

}

}

return ($result ? $result->ID : null);

}

function art_process_front(&$pages){

if (‘page’ != get_option(‘show_on_front’:wink:) return;

$frontID = get_option(‘page_on_front’:wink:;

if (!$frontID) return;

foreach ($pages as $index => $page)

if($page->ID == $frontID) {

unset($pages[$index]);

$page->post_parent = ‘0’;

$page->menu_order = ‘0’;

array_unshift($pages, $page);

break;

}

}

function art_topIDs($pages){

$result = array();

foreach ($pages as $index => $page)

if (!$page->post_parent) $result[]=$page->ID;

return $result;

}

function art_remove_subitems(&$pages){

foreach ($pages as $index => $page)

if ($page->post_parent) unset($pages[$index]);

}

function art_header_page_list_filter($pages)

{

global $artThemeSettings;

art_process_front($pages);

$artThemeSettings = art_topIDs($pages);

$artThemeSettings = art_activeID($pages);

$artThemeSettings = art_blogID($pages);

if (!$artThemeSettings) art_remove_subitems($pages);

return $pages;

}

function art_list_pages_filter($output)

{

global $artThemeSettings;

$pref =’page-item-‘;

if($artThemeSettings)

foreach($artThemeSettings as $id){

$output = preg_replace(‘~<li class=”([^”]*)b(‘ . $pref . $id . ‘:wink:b([^”]*)”>]+)>([^<]*)~’,

‘<li class=”$1$2$3″>‘ . $artThemeSettings

. ‘$5’ . $artThemeSettings . ‘‘, $output, 1);

}

$frontID = null;

$blogID = null;

if(‘page’ == get_option(‘show_on_front’:wink:) {

$frontID = get_option(‘page_on_front’:wink:;

$blogID = $artThemeSettings;

}

if ($frontID)

$output = preg_replace(‘~<li class=”([^”]*)b(‘ . $pref . $frontID . ‘:wink:b([^”]*)”><a href=”([^”]*)” ~’,

‘<li class=”$1$2$3″><a href=”‘. get_option(‘home’:wink: .'” ‘, $output, 1);

if ((is_home() && $blogID) || $artThemeSettings)

$output = preg_replace(‘~<li class=”([^”]*)b(‘ . $pref . (is_home() ? $blogID : $artThemeSettings) . ‘:wink:b([^”]*)”><a ~’,

‘<li class=”$1$2$3″><a class=”active” ‘, $output, 1);

return $output;

}

function art_menu_items()

{

global $artThemeSettings;

if (true === $artThemeSettings && ‘page’ != get_option(‘show_on_front’:wink:)

echo ‘

  • <a’ . (is_home() ? ‘ class=”active”‘ : ”:wink: . ‘ href=”‘ . get_option(‘home’:wink: . ‘”>’.$artThemeSettings

    . $artThemeSettings . $artThemeSettings . ‘

  • ‘;

    add_action(‘get_pages’, ‘art_header_page_list_filter’:wink:;

    add_action(‘wp_list_pages’, ‘art_list_pages_filter’:wink:;

    wp_list_pages(‘title_li=’:wink:;

    remove_action(‘wp_list_pages’, ‘art_list_pages_filter’:wink:;

    remove_action(‘get_pages’, ‘art_header_page_list_filter’:wink:;

    }

    add_filter(‘comments_template’, ‘legacy_comments’:wink:;

    function legacy_comments($file) {

    if(!function_exists(‘wp_list_comments’:wink:) : // WP 2.7-only check

    $file = TEMPLATEPATH.’/legacy.comments.php’;

    endif;

    return $file;

    }

    I have uploaded the theme as well in a zip:

    Any help as an example will mean I will be able to carry on with the other themes I am creating.

    Regards

    David