Custom Option Panel Issue

I am using a custom option panel for a theme I am building and Im having a very specific issue.

When I try and use the option panel to get something to show up in the theme, I am using this code:

<?php echo $mytheme->option[‘setting1’] ?>

It WILL NOT show up in the sidebar, it shows up flawlessly when I put it anywhere else.

Does anyone know of the reason for this/ a workaround? Its a little weird, but its obvious Im doing somehting wrong in regards to the sidebar I just have no clue what.

I would need some code, and what option[‘setting1’] outputs.

OK, here is my code:

this is the sidebar:

 <div class="new_event">
			 <img src="<?php bloginfo('template_directory'); ?>/images/spaghetti.jpg" width="55" height="55" alt="Spaghetti" />
			<h2><?php echo $mytheme->option['setting1'] ?> </h2>
		 	 <ul>
					<li> <b>On:</b> <?php echo $mytheme->option['setting2'] ?></li>
					<li> <b>At:</b> <?php echo $mytheme->option['setting3'] ?></li> 
				</ul>
		   
			
		</div><!-- .new_event -->
		                                                                   

here is the function.php outlineing the settings:

'setting1' => 'Event Name ## This is setting one.',
    'setting2' => 'Event Date ## Enter some text',
    'setting3' => 'Event Time ## Enter some text',
    'setting4' => 'Event Location ## Enter some text',    

If I place the code such as :

<h2><?php echo $mytheme->option['setting1'] ?> </h2>

in the index.php anywehre, it will work as needed. If I place it into any “attached” document IE header.php, footer.php, sidebar.php it will not show up.

In this instance I need it in the sidebar. Its all on my localhost so no link, let me know if you need any more code man, and THANK YOU for helping me!

edit---- in case you cant tell, I am using the theme toolkit method of displaying the custom options panel. There is a debug and here is what they output:

$mytheme->option['setting1'] = "BG Spaghetti Dinner"
$mytheme->option['setting2'] = "9/9/2011"
$mytheme->option['setting3'] = "9:40 PM"
$mytheme->option['setting4'] = "BGVFC Hall"

My guess would be the $mytheme object is made and distroyed within index, so it is not alive in sidebar. Try making the object in header.php or the first line in index.

it works in index, it doesnt work in anything else like sidebar, header,etc. what would be a work around to get it to show up in the sidebar or header?

show me your full index code

<?php get_header(); ?> 				
				<div id="content-container"> 
					
					 <div id="featured-slider">
						<img class="top" src="<?php bloginfo('template_directory'); ?>/images/altest-news.png" width="147" height="87" alt="Altest News" /> 
						
							<div class="featured-post">
								 
								 <img src="<?php bloginfo('template_directory'); ?>/images/place-img.jpg" width="890" height="290" alt="Place Img" />
								<div class="featured-post-info">  								
								<h2>Post Headline</h2>
								<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec blandit erat ac sapien sagittis feugiat. Maecenas gravida sagittis gravida. Proin fermentum eleifend laoreet.<a href="#">Read More</a></p>
								</div><!-- #featured-post-info -->
								
							</div><!-- .featured-post -->
							
						</div><!-- #featured-slider -->
					<div id="homepage-content">
						
					 
						
						
						
						 
						     <h3 class="page-top">Latest News</h3>
						<div class="news-post">
							<div class="post-image">
								<img src="<?php bloginfo('template_directory'); ?>/images/post-img.jpg" width="140" height="140" alt="Post Img" />
								
							</div><!-- .post-image -->
							<div class="the-post">
								<h2>The Post Title</h2>
								<em>9/19/11</em>
								<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec blandit erat ac sapien sagittis feugiat. Maecenas gravida sagittis gravida. Proin fermentum eleifend laoreet. Cras eget orci nunc, ac adipiscing massa. Suspendisse tincidunt dolor in velit lacinia vitae adipiscing lorem sodales. Nunc auctor pharetra felis.</p>
								
							</div><!-- .the-post -->
							
						</div> 
						 <div class="news-post">
								<div class="post-image">
                 <img src="<?php bloginfo('template_directory'); ?>/images/post-img.jpg" width="140" height="140" alt="Post Img" />
								</div><!-- .post-image -->
								<div class="the-post">
									<h2>The Post Title</h2>
									<em>9/19/11</em>
									<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec blandit erat ac sapien sagittis feugiat. Maecenas gravida sagittis gravida. Proin fermentum eleifend laoreet. Cras eget orci nunc, ac adipiscing massa. Suspendisse tincidunt dolor in velit lacinia vitae adipiscing lorem sodales. Nunc auctor pharetra felis.</p>

								</div><!-- .the-post -->

							</div>
						
					</div><!-- #homepage-content -->
					
					
				
				
				
				  <?php get_sidebar(); ?> 	 
				
				</div><!-- #content-container --> 
				<?php get_footer(); ?> 	 
   

hmm…do you make it in header then?

the code doesnt work in the header, I have the code in the sidebar. for instance here is my sidebar code:

<div id="sidebar">
	<div class="widget">
		<h3>Become a Member</h3>
		  <img src="<?php bloginfo('template_directory'); ?>/images/unclesam.jpg" width="55" height="75" alt="Unclesam" />
		<ul>
			<li>Step 1:Get Application <a href="#">HERE</a></li>
			<li>Step 2: Fill it out</li> 
			<li>Step 3: Email it <a href="mailto:?subject=feedback">Here</a></li>
			<li>Step 4: Await Response!</li>
		</ul>
		
		
	</div><!-- .widget --> 
	<div class="widget">
		<h3>Holiday Hall Board</h3>
		
		<div class="new_event">
			 <img src="<?php bloginfo('template_directory'); ?>/images/spaghetti.jpg" width="55" height="55" alt="Spaghetti" />
			<h2><?php echo $mytheme->option['setting1'] ?> </h2>
		 	 <ul>
					<li> <b>On:</b> <?php echo $mytheme->option['setting2'] ?></li>
					<li> <b>At:</b> <?php echo $mytheme->option['setting3'] ?></li> 
				</ul>
		   
			
		</div><!-- .new_event -->
		
		
		
		
	</div><!-- .widget -->
	
</div><!-- #sidebar -->        

if you look at the index code I posted, where i have “The Post Title” if I replace that with this: <h2><?php echo $mytheme->option[‘setting1’] ?> </h2> the custom option shows up perfectly. As you can see though, the exact code in the sidebar doesnt work for some reason.

i get what you’re saying. <?php echo $mytheme->option[‘setting1’] ?>, tells me $mytheme is an object. That object is getting lost somewhere.

you know, Im not sure if this is what you meant when you said add it to the index, but I got rid of sidebar.php and just put the sidebar in the actual index page and the option showed up flawlessly. On this specific project, I dont believe they are going to want “custom widgets” so I can probably get away with leaving it like this, but for the future, I am curious where the object is getting lost? Its a bit weird, but I also dont have the php chops to really figure out what the issue is you know?

I have no idea why, that’s why I was asking for various files. I was hoping you had something somewhere that your scope was messed up