• I’m trying to combine 2 function.php files, but I know nothing about php (except how to create errors, I’m really good at that)

    I don’t want to paste the two files here as it will be too long, but could someone be willing to help me out? I know nothing about php.

    Thanks.

    Pete

Viewing 5 replies - 1 through 5 (of 5 total)
  • Copy one function.php file and paste it at the bottom of the other function.php file. Treat it like text: if you wanted to combine text files, you’d just copy one and paste it at the bottom of the other, right? Do the same thing here and see how it works.

    Thread Starter Pete

    (@perthmetro)

    I tried that but it doesn’t work, in fact I’ve tried all sort of combination of pasting pieces here and there… no luck unfortunately. I was hoping someone who has that php knowledge could help me debug it.

    What doesn’t work? What shows you that it needs to be debuged? When you paste things, is it the pasted functions that don’t work or the functions that were originally in the file? When you paste things, do none of the functions work in the new file? Give as much detail as you can and I’ll see if I can help more.

    Thread Starter Pete

    (@perthmetro)

    nothing works, the site crashes and shows different php error messages depending on where or what I copy paste.

    ok here’s the two files… each function.php come from a different theme…

    function.php #1

    <?php
    
    // This function.php file is used to help users customise their css and website details
    // Edit this file on your own risk!
    
    add_action('admin_menu', 'portfolio_options'); // Theme Menu "Brightness Settings"
    add_action('admin_head', 'portfolio_css'); // CSS For "Brightness Settings" Page
    
    function portfolio(){ // Updates "Portfolio Theme Settings" Page Form
        if(isset($_POST['submitted']) && $_POST['submitted'] == "yes"){
            //Get form data
    
    		$headquote = stripslashes($_POST['headquote']);
    		$pflogo = stripslashes($_POST['pflogo']);
    		$bgcolor = stripslashes($_POST['bgcolor']);
    		$bgimage = stripslashes($_POST['bgimage']);
    		$bgrepeat = stripslashes($_POST['bgrepeat']);
    		$bgposition = stripslashes($_POST['bgposition']);
    		$hqbgcolor = stripslashes($_POST['hqbgcolor']);
    		$hqtxtcolor = stripslashes($_POST['hqtxtcolor']);
    		$hqhlcolor = stripslashes($_POST['hqhlcolor']);
    		$hqfontfamily = stripslashes($_POST['hqfontfamily']);
    		$hqfontsize = stripslashes($_POST['hqfontsize']);
    		$pfimgbordercolor = stripslashes($_POST['pfimgbordercolor']);
    		$pftitlecolor = stripslashes($_POST['pftitlecolor']);
    		$pftitlefontfamily = stripslashes($_POST['pftitlefontfamily']);
    		$pftitlefontsize = stripslashes($_POST['pftitlefontsize']);
    		$pftextcolor = stripslashes($_POST['pftextcolor']);
    		$pfhltextcolor = stripslashes($_POST['pfhltextcolor']);
    		$portfoliocategory = stripslashes($_POST['portfoliocategory']);
    		$pffontfamily = stripslashes($_POST['pffontfamily']);
    		$pfbottomborder = stripslashes($_POST['pfbottomborder']);
    		$pftextsize = stripslashes($_POST['pftextsize']);
    		$endword = stripslashes($_POST['endword']);
    		$describe = stripslashes($_POST['describe']);
    
    		update_option("pftextsize", $pftextsize);
    		update_option("pfbottomborder", $pfbottomborder);
    		update_option("pffontfamily", $pffontfamily);
    		update_option("headquote", $headquote);
    		update_option("pflogo", $pflogo);
    		update_option("bgcolor", $bgcolor);
    		update_option("bgimage", $bgimage);
    		update_option("bgrepeat", $bgrepeat);
    		update_option("bgposition", $bgposition);
    		update_option("hqbgcolor", $hqbgcolor);
    		update_option("hqtxtcolor", $hqtxtcolor);
    		update_option("hqhlcolor", $hqhlcolor);
    		update_option("hqfontfamily", $hqfontfamily);
    		update_option("hqfontsize", $hqfontsize);
    		update_option("pfimgbordercolor", $pfimgbordercolor);
    		update_option("pftitlecolor", $pftitlecolor);
    		update_option("pftitlefontfamily", $pftitlefontfamily);
    		update_option("pftitlefontsize", $pftitlefontsize);
    		update_option("pftextcolor", $pftextcolor);
    		update_option("pfhltextcolor", $pfhltextcolor);
    		update_option("endword", $endword);
    		update_option("describe", $describe);		
    
            echo "<div id=\"message\" class=\"updated fade\"><p><strong>Your settings have been saved.</strong></p></div>";
        }
    
    ?>
    
    <div class="wrap">
    
    	<form method="post" name="brightness" target="_self">
    
    		<div style="height: 15px; display: block; width: 100%;"></div>
    		<h2>Head Quote</h2>
    			<table class="form-table">
    			<tr>
    				<th class="row">
    					Head Quote Text
    				</th>
    				<td>
    					<p style="margin: 0px 0px 5px 0px;">
    						Use <strong></strong> for highlighted words.
    					</p>
    					<textarea name="headquote" cols="60" rows="7" id="headquote"><?php echo get_option("headquote"); ?></textarea>
    				</td>
    			</tr>
    		</table>
    
    		<div style="height: 15px; display: block; width: 100%;"></div>
    		<h2>Website Customization</h2>
    		<p>Here you can edit colors, images. Make your theme more unique!</p>
    		<table class="form-table">
    			<tr>
    				<th class="row">
    					Edit your logo!
    				</th>
    				<td>
    					<p style="margin: 0px 0px 5px 0px;">
    						<strong>Image must have: 350px width / 150px height.</strong><br />
    						Enter the image url.
    					</p>
    					<input type="text" name="pflogo" value="<?php echo get_option('pflogo'); ?>" />
    				</td>
    			</tr>
    			<tr>
    				<th class="row">
    					Edit your theme Colors!
    				</th>
    				<td>
    					<div class="themecolors">
    						<div>
    							<h3>Background Settings:</h3>
    							<p>Edit your background color, image, repeat and position.</p>
    
    							<div>
    							<strong>Background Color:</strong>
    							<input type="text" name="bgcolor" value="<?php echo get_option('bgcolor'); ?>" />
    							</div>
    							<div>
    							<strong>Background Image:</strong>
    							<input type="text" name="bgimage" value="<?php echo get_option('bgimage'); ?>" />
    							</div>
    							<div>
    							<strong>Background Repeat:</strong>
    							<select name="bgrepeat">
    								<option value="no-repeat"<?php if(get_option('bgrepeat') == "no-repeat") { echo ' selected="selected"'; } ?>>no-repeat</option>
    								<option value="repeat-x"<?php if(get_option('bgrepeat') == "repeat-x") { echo ' selected="selected"'; } ?>>repeat-x</option>
    								<option value="repeat-y"<?php if(get_option('bgrepeat') == "repeat-y") { echo ' selected="selected"'; } ?>>repeat-y</option>
    							</select>
    							</div>
    							<div>
    							<strong>Background Position:</strong>
    							<input type="text" name="bgposition" value="<?php echo get_option('bgposition'); ?>" />
    							</div>
    						</div>
    						<div>
    							<h3>Headquote Settings:</h3>
    							<p>Edit your headquote background and colors:</p>
    							<div>
    							<strong>Headquote Background Color:</strong>
    								<input type="text" name="hqbgcolor" value="<?php echo get_option('hqbgcolor'); ?>" />
    							</div>
    							<div>
    							<strong>Headquote Text Color:</strong>
    								<input type="text" name="hqtxtcolor" value="<?php echo get_option('hqtxtcolor'); ?>" />
    							</div>
    							<div>
    							<strong>Headquote Highlighted Text Color:</strong>
    								<input type="text" name="hqhlcolor" value="<?php echo get_option('hqhlcolor'); ?>" />
    							</div>
    							<div>
    							<strong>Headquote Font Family:</strong>
    								<input type="text" name="hqfontfamily" value="<?php echo get_option('hqfontfamily'); ?>" />
    							</div>
    							<div>
    							<strong>Headquote Font Size:</strong>
    								<input type="text" name="hqfontsize" value="<?php echo get_option('hqfontsize'); ?>" />
    							</div>
    						</div>
    						<div>
    							<h3>Items Settings:</h3>
    							<p>Edit image border, text colors and anything else.</p>
    							<div>
    							<strong>Image Border Color:</strong>
    								<input type="text" name="pfimgbordercolor" value="<?php echo get_option('pfimgbordercolor'); ?>" />
    							</div>
    							<div>
    								<strong>Title Color:</strong>
    								<input type="text" name="pftitlecolor" value="<?php echo get_option('pftitlecolor'); ?>" />
    							</div>
    							<div>
    								<strong>Title Font Family:</strong>
    								<input type="text" name="pftitlefontfamily" value="<?php echo get_option('pftitlefontfamily'); ?>" />
    							</div>
    							<div>
    								<strong>Title Font Size:</strong>
    								<input type="text" name="pftitlefontsize" value="<?php echo get_option('pftitlefontsize'); ?>" />
    							</div>
    							<div>
    								<strong>Text Font Family:</strong>
    								<input type="text" name="pffontfamily" value="<?php echo get_option('pffontfamily'); ?>" />
    							</div>
    							<div>
    								<strong>Text Color:</strong>
    								<input type="text" name="pftextcolor" value="<?php echo get_option('pftextcolor'); ?>" />
    							</div>
    							<div>
    								<strong>Text Size:</strong>
    								<input type="text" name="pftextsize" value="<?php echo get_option('pftextsize'); ?>" />
    							</div>
    							<div>
    								<strong>Hightlighted Text Color:</strong>
    								<input type="text" name="pfhltextcolor" value="<?php echo get_option('pfhltextcolor'); ?>" />
    							</div>
    							<div>
    								<strong>Bottom Border:</strong>
    								<input type="text" name="pfbottomborder" value="<?php echo get_option('pfbottomborder'); ?>" />
    							</div>
    						</div>
    					</div>
    				</td>
    			</tr>
    		</table>
    
    		<div style="height: 15px; display: block; width: 100%;"></div>
    		<h2>Title Here</h2>
    		<p>Something here</p>
    		<table class="form-table">
    			<tr>
    				<th class="row">
    					Something here
    				</th>
    				<td>
    					<div class="themecolors">
    						<div>
    							<h3>Description #1</h3>
    							<p>Something goes here.</p>							
    
    						</div>
    						<div>
    							<h3>Info #1</h3>
    							<p>Something goes here.</p>
    							<textarea name="describe" cols="52" rows="3"><?php echo get_option('describe'); ?></textarea>
    						</div>
    
    						<div>
    							<h3>Info #2</h3>
    							<p>Something goes here.</p>
    							<textarea name="endword" cols="52" rows="3"><?php echo get_option('endword'); ?></textarea>
    						</div>
    					</div>
    				</td>
    			</tr>
    		</table>
    		<p class="submit">
    			<input name="submitted" type="hidden" value="yes" />
    			<input type="submit" name="Submit" value="Save your changes &raquo;" />
    		</p>
    	</form>
    
    <?php
    }
    
    function portfolio_options() { // Adds Dashboard Menu Item
    	add_menu_page('Portfolio Theme Settings', 'Portfolio Theme Settings', 'edit_themes', __FILE__, 'portfolio');
    }
    
    function portfolio_css() { // Adds Dashboard Head Style
    	echo "
    		<style type=\"text/css\">
    			.themecolors div { display: block; background: #ffffff; padding: 15px; margin-bottom: 10px;}
    			.themecolors div div { padding: 0px 0px 0px 10px; border-left: solid 4px #CCD9E3; padding-bottom: 15px; }
    			.themecolors div div strong { display: block; }
    			.themecolors div h3 { margin: 0px 0px 0px 0px; font-size: 20px; }
    			.themecolors div p { margin: 3px 0px 20px 0px; }
    		</style>
    	";
    }
    
    ?>

    function.php #2 – this is the base theme I’ll need to use with my theme

    <?php
    if ( function_exists('register_sidebars') )
        register_sidebars(3);
    ?>
    <?php
    function the_content_limit($max_char, $more_link_text = '(more...)', $stripteaser = 0, $more_file = '') {
        $content = get_the_content($more_link_text, $stripteaser, $more_file);
        $content = apply_filters('the_content', $content);
        $content = str_replace(']]>', ']]>', $content);
        $content = strip_tags($content);
    
       if (strlen($_GET['p']) > 0) {
          echo "<p>";
          echo $content;
          echo "&nbsp;<a href='";
          the_permalink();
          echo "'>"."[Read more...]</a>";
          echo "</p>";
       }
       else if ((strlen($content)>$max_char) && ($espacio = strpos($content, " ", $max_char ))) {
            $content = substr($content, 0, $espacio);
            $content = $content;
            echo "<p>";
            echo $content;
            echo "...";
            echo "&nbsp;<a href='";
            the_permalink();
            echo "'>".$more_link_text."</a>";
            echo "</p>";
       }
       else {
          echo "<p>";
          echo $content;
          echo "&nbsp;<a href='";
          the_permalink();
          echo "'>"."[Read more...]</a>";
          echo "</p>";
       }
    }
    
    ?>
    <?php
    $themename = "Website";
    $shortname = "rev";
    
    $options = array (
    				array(	"name" => "General Settings",
    						"type" => "heading"),	
    
    				array(	"name" => "Feedburner ID",
    						"desc" => "Learn how to find your Feedburner ID by checking out the <a href='http://www.#'>tutorial</a> page.",
    			    		"id" => $shortname."_feedburner_id",
    			    		"std" => "Enter Feedburner Email Subscribe ID here",
    			    		"type" => "text"),					
    
    				/* array(	"name" => "468x60 AdSense ID",
    						"desc" => "This is for the 468x60 Google AdSense banner in between the single post and comments section.<br />An example of this would be: pub-4010093622692910",
    			    		"id" => $shortname."_adsense_468",
    			    		"std" => "Enter Google AdSense ID Here",
    			    		"type" => "text"),		
    
    				array(	"name" => "468x60 AdSense Link Color",
    						"desc" => "This is where you specify the link color for your 468x60 AdSense ads.<br />An example of this would be 2255AA",
    			    		"id" => $shortname."_adsense_468_link",
    			    		"std" => "Enter 6-digit Hexcode Here",
    			    		"type" => "text"),				
    
    				array(	"name" => "300x250 AdSense ID",
    						"desc" => "This is for the 300x250 Google AdSense banner in between the single post and comments section.<br />An example of this would be: pub-4010093622692910",
    			    		"id" => $shortname."_adsense_300",
    			    		"std" => "Enter Google AdSense ID Here",
    			    		"type" => "text"),		
    
    				array(	"name" => "300x250 AdSense Link Color",
    						"desc" => "This is where you specify the link color for your 300x250 AdSense ads.<br />An example of this would be 2255AA",
    			    		"id" => $shortname."_adsense_300_link",
    			    		"std" => "Enter 6-digit Hexcode Here",
    			    		"type" => "text"),		*/	
    
    array(	"name" => "Banner Settings",
    "type" => "heading"),
    
    				array(	"name" => "Banner 1 image",
    						"desc" => "This is the filename (including the extension) of the image that you want to use.",
    			    		"id" => $shortname."_ad_img",
    						"std" => "Enter the filename.ext of banner 1.",
    			    		"type" => "text"),						
    
    				array(	"name" => "Banner 1 link",
    						"desc" => "This is the destination link/url of banner (http://whatever)",
    			    		"id" => $shortname."_ad_url",
    						"std" => "Enter the destination URL.",
    						"type" => "text"),	
    
    				array(	"name" => "Banner 2 image",
    						"desc" => "This is the filename (including the extension) of the image that you want to use.",
    			    		"id" => $shortname."_ad_img2",
    						"std" => "Enter the filename.ext of banner 1.",
    			    		"type" => "text"),						
    
    				array(	"name" => "Banner 2 link",
    						"desc" => "This is the destination link/url of banner (http://whatever)",
    			    		"id" => $shortname."_ad_url2",
    						"std" => "Enter the destination URL.",
    						"type" => "text"),
    array(	"name" => "Youtube Settings",
    "type" => "heading"),
    				array(	"name" => "Youtube URL",
    						"desc" => "Learn how to find the YouTube embedded url by checking out the <a href='http://#'>tutorial</a> page.",
    						"id" => $shortname."_you_tube",
    						"std" => "Enter the URL from the embedded YouTube code.",
    						"type" => "text"),
    array(	"name" => "Season Settings",
    "type" => "heading"),
    				array(	"name" => "Homepage Summer",
    						"desc" => "This is the home.php featured Summer category URL.",
    			    		"id" => $shortname."_featured_summer",
    						"std" => "Enter the summer category ID number.",
    						"type" => "text"),	
    
    				array(	"name" => "Homepage Autumn",
    						"desc" => "This is the home.php featured Autumn category URL.",
    			    		"id" => $shortname."_featured_autumn",
    						"std" => "Enter the  autumn category ID number.",
    						"type" => "text"),	
    
    				array(	"name" => "Homepage Winter",
    						"desc" => "This is the home.php featured Winter category URL.",
    			    		"id" => $shortname."_featured_winter",
    						"std" => "Enter the winter category ID number.",
    						"type" => "text"),	
    
    				array(	"name" => "Homepage Spring",
    						"desc" => "This is the home.php featured Spring category URL.",
    			    		"id" => $shortname."_featured_spring",
    						"std" => "Enter the spring category ID number.",
    						"type" => "text"),	
    
    				array(	"name" => "Featured Post",
    						"desc" => "This is post ID",
    			    		"id" => $shortname."_post",
    						"std" => "Enter the post ID number.",
    						"type" => "text"),
    
    				array(	"name" => "Featured Category",
    						"desc" => "This is category ID",
    			    		"id" => $shortname."_cat",
    						"std" => "Enter the scategory ID number.",
    						"type" => "text"),						
    
    array(	"name" => "Contact Settings",
    "type" => "heading"),
    				array(	"name" => "Phone Number",
    						"desc" => "Contact details: Phone Number",
    			    		"id" => $shortname."_phone_number",
    						"std" => "Enter your phone number.",
    						"type" => "text"),		
    
    				array(	"name" => "Mobile Number",
    						"desc" => "Contact details: Mobile Number",
    			    		"id" => $shortname."_mobile_number",
    						"std" => "Enter your mobile number.",
    						"type" => "text"),	
    
    				array(	"name" => "Fax Number",
    						"desc" => "Contact details: Fax Number",
    			    		"id" => $shortname."_fax_number",
    						"std" => "Enter your fax number.",
    						"type" => "text"),		
    
    				array(	"name" => "Email",
    						"desc" => "Contact details: Email",
    			    		"id" => $shortname."_email",
    						"std" => "Enter your email.",
    						"type" => "text"),			
    
    				array(	"name" => "Address",
    						"desc" => "Contact details: Address",
    			    		"id" => $shortname."_address",
    						"std" => "Enter your address.",
    						"type" => "text"),
    array(	"name" => "SEO Settings",
    "type" => "heading"),	
    
    				array(	"name" => "Keywords",
    						"desc" => "separate the keywords with a comma",
    			    		"id" => $shortname."_keywords",
    						"std" => "Enter your keywords.",
    						"type" => "text"),			
    
    				array(	"name" => "Website Description",
    						"desc" => "Use up to 20 words to describe your website/business",
    			    		"id" => $shortname."_description",
    						"std" => "Website Description.",
    						"type" => "text"),	
    
    		  );
    
    function mytheme_add_admin() {
    
        global $themename, $shortname, $options;
    
        if ( $_GET['page'] == basename(__FILE__) ) {
    
            if ( 'save' == $_REQUEST['action'] ) {
    
                    foreach ($options as $value) {
    					if($value['type'] != 'multicheck'){
                        	update_option( $value['id'], $_REQUEST[ $value['id'] ] );
    					}else{
    						foreach($value['options'] as $mc_key => $mc_value){
    							$up_opt = $value['id'].'_'.$mc_key;
    							update_option($up_opt, $_REQUEST[$up_opt] );
    						}
    					}
    				}
    
                    foreach ($options as $value) {
    					if($value['type'] != 'multicheck'){
                        	if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ]  ); } else { delete_option( $value['id'] ); }
    					}else{
    						foreach($value['options'] as $mc_key => $mc_value){
    							$up_opt = $value['id'].'_'.$mc_key;
    							if( isset( $_REQUEST[ $up_opt ] ) ) { update_option( $up_opt, $_REQUEST[ $up_opt ]  ); } else { delete_option( $up_opt ); }
    						}
    					}
    				}
                    header("Location: themes.php?page=functions.php&saved=true");
                    die;
    
            } else if( 'reset' == $_REQUEST['action'] ) {
    
                foreach ($options as $value) {
    				if($value['type'] != 'multicheck'){
                    	delete_option( $value['id'] );
    				}else{
    					foreach($value['options'] as $mc_key => $mc_value){
    						$del_opt = $value['id'].'_'.$mc_key;
    						delete_option($del_opt);
    					}
    				}
    			}
                header("Location: themes.php?page=functions.php&reset=true");
                die;
    
            }
        }
    
        add_theme_page($themename." Options", "$themename Options", 'edit_themes', basename(__FILE__), 'mytheme_admin');
    
    }
    
    function mytheme_admin() {
    
        global $themename, $shortname, $options;
    
        if ( $_REQUEST['saved'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' settings saved.</strong></p></div>';
        if ( $_REQUEST['reset'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' settings reset.</strong></p></div>';
    
    ?>
    
    <div class="wrap">
    <h2><?php echo $themename; ?> options</h2>
    
    <form method="post">
    
    <table class="optiontable">
    
    <?php foreach ($options as $value) { 
    
    	switch ( $value['type'] ) {
    		case 'text':
    		option_wrapper_header($value);
    		?>
    		        <input style="width:400px;" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>" value="<?php if ( get_settings( $value['id'] ) != "") { echo get_settings( $value['id'] ); } else { echo $value['std']; } ?>" />
    		<?php
    		option_wrapper_footer($value);
    		break;
    
    		case 'select':
    		option_wrapper_header($value);
    		?>
    	            <select style="width:240px;" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>">
    	                <?php foreach ($value['options'] as $option) { ?>
    	                <option<?php if ( get_settings( $value['id'] ) == $option) { echo ' selected="selected"'; } elseif ($option == $value['std']) { echo ' selected="selected"'; } ?>><?php echo $option; ?></option>
    	                <?php } ?>
    	            </select>
    		<?php
    		option_wrapper_footer($value);
    		break;
    
    		case 'textbox':
    		option_wrapper_header($value);
    		?>
    		        <input style="width:400px;height:100px" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>" value="<?php if ( get_settings( $value['id'] ) != "") { echo get_settings( $value['id'] ); } else { echo $value['std']; } ?>" />
    		<?php
    		option_wrapper_footer($value);
    		break;
    
    		case "radio":
    		option_wrapper_header($value);
    
     		foreach ($value['options'] as $key=>$option) {
    				$radio_setting = get_settings($value['id']);
    				if($radio_setting != ''){
    		    		if ($key == get_settings($value['id']) ) {
    						$checked = "checked=\"checked\"";
    						} else {
    							$checked = "";
    						}
    				}else{
    					if($key == $value['std']){
    						$checked = "checked=\"checked\"";
    					}else{
    						$checked = "";
    					}
    				}?>
    	            <input type="radio" name="<?php echo $value['id']; ?>" value="<?php echo $key; ?>" <?php echo $checked; ?> /><?php echo $option; ?><br />
    		<?php
    		}
    
    		option_wrapper_footer($value);
    		break;
    
    		case "checkbox":
    		option_wrapper_header($value);
    						if(get_settings($value['id'])){
    							$checked = "checked=\"checked\"";
    						}else{
    							$checked = "";
    						}
    					?>
    		            <input type="checkbox" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" value="true" <?php echo $checked; ?> />
    		<?php
    		option_wrapper_footer($value);
    		break;
    
    		case "multicheck":
    		option_wrapper_header($value);
    
     		foreach ($value['options'] as $key=>$option) {
    	 			$pn_key = $value['id'] . '_' . $key;
    				$checkbox_setting = get_settings($pn_key);
    				if($checkbox_setting != ''){
    		    		if (get_settings($pn_key) ) {
    						$checked = "checked=\"checked\"";
    						} else {
    							$checked = "";
    						}
    				}else{
    					if($key == $value['std']){
    						$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><br />
    		<?php
    		}
    
    		option_wrapper_footer($value);
    		break;
    
    		case "heading":
    		?>
    		<tr valign="top">
    		    <td colspan="2" style="text-align: center;"><h3><?php echo $value['name']; ?></h3></td>
    		</tr>
    		<?php
    		break;
    
    		default:
    
    		break;
    	}
    }
    ?>
    
    </table>
    <?php echo "<h2>How do I insert these values into my template?</h2>
    <p>Learn how to insert these values by checking out the <a href='http://www.#'>tutorial</a> page.</p>";	?>
    <p class="submit">
    <input name="save" type="submit" value="Save changes" />
    <input type="hidden" name="action" value="save" />
    </p>
    </form>
    <form method="post">
    <p class="submit">
    <input name="reset" type="submit" value="Reset" />
    <input type="hidden" name="action" value="reset" />
    </p>
    </form>
    
    <?php
    }
    
    function option_wrapper_header($values){
    	?>
    	<tr valign="top">
    	    <th scope="row"><?php echo $values['name']; ?>:</th>
    	    <td>
    	<?php
    }
    
    function option_wrapper_footer($values){
    	?>
    	    </td>
    	</tr>
    	<tr valign="top">
    		<td>&nbsp;</td><td><small><?php echo $values['desc']; ?></small></td>
    	</tr>
    	<?php
    }
    
    function mytheme_wp_head() {
    	$stylesheet = get_option('revmag_alt_stylesheet');
    	if($stylesheet != ''){?>
    
    <?php }
    } 
    
    add_action('wp_head', 'mytheme_wp_head');
    add_action('admin_menu', 'mytheme_add_admin');

    I notice that function #2 doesn’t end — there’s no ?> at the end of the file. That could very easily be your problem.

    And telling what those different error messages are would help debug this. Those messages are an attempt to tell you what the problem is. What errors are you getting?

    Try searching for the errors to see what’s written about them. Something out there might help you read those error statements, so keep track of what they are.

    Next time use a pastebin for all that code. It’s pretty tough to read that in the forum.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘I’m trying to combine 2 function.php files’ is closed to new replies.