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.
'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',
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:
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?
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.
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?