function to add custom header to div id or class, Its driving me crazy!
-
I have been up all night trying to do one simple thing and its making me crazy, lol. I am simply trying to work my custom header into my header div using a function that injects the css like so.
function header_style() { if(!get_header_image() ) return; ?> <style type="text/css"> #featured{ background: url(<?php header_image(); ?>) no-repeat !important; height: <?php echo HEADER_IMAGE_HEIGHT; ?>px; width: <?php echo HEADER_IMAGE_WIDTH; ?>px; } </style> <?php }
I have tried a few variations of this and I either get php screams or I get a blank background. The custom header function i am using is from the codex and Im not entirely sure if I need to edit something here or not. Im using it like this
// add support for custom header add_theme_support( 'custom-header' ); $defaults = array( 'default-image' => get_template_directory_uri() . '/images/featured-backing.png', 'random-default' => false, 'width' => 2550, 'height' =>350, 'max-width' =>2550, 'flex-height' => true, 'flex-width' => true, 'default-text-color' => '', 'header-text' => false, 'uploads' => true, 'wp-head-callback' => '', 'admin-head-callback' => '', 'admin-preview-callback' => '', ); add_theme_support( 'custom-header', $defaults );
I am hoping that someone can see where I am going wrong and give me a bit of guidance before these key board marks get too deep in my forehead.
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘function to add custom header to div id or class, Its driving me crazy!’ is closed to new replies.