Help needed! Adding code in functions.php is breaking my site!
-
Hi guys,
I’m fairly new to php and am trying to add a theme options page to my custom theme. I found some excellent tutorials online and one in particular that works well. When i add the code from the example to my existing functions.php file the the theme options page in the admin area breaks down to a black white page indicating and error. The problem is with the php syntax in the code but i can’t quite figure out what needs to be done in order to make it work. Can anyone help to combine the 2 following bits of code into one functions file?
Thanks.
Existing functions code…
<?php //Navigation Menus add_action( 'init', 'register_my_menus' ); function register_my_menus() { register_nav_menus( array( 'home' => __( 'Home' ) ) ); } ?>
And the code i want to add..
<?php require_once ( get_stylesheet_directory() . '/theme-options.php' ); function sa_layout_view() { global $sa_options; $settings = get_option( 'sa_options', $sa_options ); if( $settings['layout_view'] == 'fluid' ) : ?> <style type="text/css"> #wrapper { width: 94%; max-width:1140px; min-width:940px; } #branding, #branding img, #access, #main, #colophon { width:100%; } </style> <?php endif; } add_action( 'wp_head', 'sa_layout_view' );
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Help needed! Adding code in functions.php is breaking my site!’ is closed to new replies.