fartnuts Posted July 8, 2012 Share Posted July 8, 2012 Hey guys! This is driving me insane and I've done this dozens of times before and I know it's simple, but I can't seem to figure it out I have the following piece of code in my WordPress theme set right now that when I add a custom background image to a post, it overrides the set custom image for the home page and rest of the site. I need to fix it so that when I can set a background custom image for each post and it doesn't override any other set custom backgrounds. Here's the code: /* Add a custom bg if it exists */ <?php $homepage_bg = get_option_tree("default_bg"); if(get_custom_field('custom_background_image')) { ?> body {background: url('<?php echo get_custom_field('custom_background_image',true); ?>') top left fixed repeat;} <?php } elseif (isset($homepage_bg[0])) { ?> body {background: url('<?php echo get_option_tree("default_bg"); ?>') top left fixed repeat;} <?php } else {} ?> <?php global $theme_options; ?> Any thoughts? Thanks to everyone in advance! Quote Link to comment Share on other sites More sharing options...
NomadicJosh Posted July 11, 2012 Share Posted July 11, 2012 I am not sure I understand what you are trying to accomplish. If you are trying to set a different custom background image per post, then you might need to include code that pulls in the post id. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.