| 1 |
<?php |
| 2 |
|
| 3 |
/* |
| 4 |
Plugin Name: oik custom header image |
| 5 |
Plugin URI: http://www.oik-plugins.com/oik |
| 6 |
Description: custom page header image selection |
| 7 |
Version: 1.7 |
| 8 |
Author: bobbingwide |
| 9 |
Author URI: http://www.bobbingwide.com |
| 10 |
License: GPL2 |
| 11 |
|
| 12 |
Copyright 2010, 2011 Bobbing Wide (email : herb@bobbingwide.com ) |
| 13 |
|
| 14 |
This program is free software; you can redistribute it and/or modify |
| 15 |
it under the terms of the GNU General Public License version 2, |
| 16 |
as published by the Free Software Foundation. |
| 17 |
|
| 18 |
You may NOT assume that you can use any other version of the GPL. |
| 19 |
|
| 20 |
This program is distributed in the hope that it will be useful, |
| 21 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 23 |
GNU General Public License for more details. |
| 24 |
|
| 25 |
The license for this software can likely be found here: |
| 26 |
http://www.gnu.org/licenses/gpl-2.0.html |
| 27 |
|
| 28 |
*/ |
| 29 |
|
| 30 |
require_once( 'bobbfunc.inc' ); |
| 31 |
require_once( 'bobbingwide.inc' ); |
| 32 |
|
| 33 |
add_action( 'wp_footer', 'bw_page_header_style' ); |
| 34 |
|
| 35 |
/** |
| 36 |
* Dynamically add CSS for the header background image if the custom field is set |
| 37 |
* |
| 38 |
* For an artisteer theme you can change the header image by adding some extra CSS eg |
| 39 |
* body.page-id-11 div.art-header { background-image: url('images/logo7-business.jpg'); } |
| 40 |
* |
| 41 |
* Note: The selector is currently coded for Artisteer themes |
| 42 |
* We also assume that the whole of the background image is to be changed. |
| 43 |
* So we turn off the display of the div.art-headerobject as well. |
| 44 |
* |
| 45 |
* Also added support for pages with themes that use div id='header' |
| 46 |
*/ |
| 47 |
function bw_page_header_style() { |
| 48 |
$post_id = get_the_id(); |
| 49 |
$post_meta = get_post_meta( $post_id, '_bw_header_image', TRUE ); |
| 50 |
bw_trace2( $post_meta ); |
| 51 |
if ( $post_meta ) { |
| 52 |
$header_image = $post_meta ; |
| 53 |
e('<style type="text/css">'); |
| 54 |
|
| 55 |
e( "body.postid-$post_id div.art-header, body.page-id-$post_id div.art-header, body.page-id-$post_id div#header { background-image: url('$header_image'); } " ); |
| 56 |
e( "div.art-headerobject { display: none; } "); |
| 57 |
e('</style>'); |
| 58 |
echo( bw_ret()); |
| 59 |
} |
| 60 |
} |
| 61 |
|
| 62 |
if ( is_admin() ) { |
| 63 |
require_once( 'admin/oik-header.inc' ); |
| 64 |
} |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|