Skip to:
Content

BuddyPress.org

Changeset 2671


Ignore:
Timestamp:
02/11/2010 01:31:17 PM (15 years ago)
Author:
apeatling
Message:

Allow child themes to completely remove custom image header settings in bp-default by using remove_action( 'template_redirect', 'bp_dtheme_add_custom_header_support' ); in their functions.php file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-themes/bp-default/functions.php

    r2664 r2671  
    136136add_action( 'pre_get_posts', 'bp_dtheme_fix_get_posts_on_activity_front' );
    137137
    138 /* Set the defaults for the custom header image (http://ryan.boren.me/2007/01/07/custom-image-header-api/) */
    139 define( 'HEADER_TEXTCOLOR', 'FFFFFF' );
    140 define( 'HEADER_IMAGE', '%s/_inc/images/default_header.jpg' ); // %s is theme dir uri
    141 define( 'HEADER_IMAGE_WIDTH', 1250 );
    142 define( 'HEADER_IMAGE_HEIGHT', 125 );
    143 
    144 function bp_dtheme_header_style() { ?>
    145     <style type="text/css">
    146         #header { background-image: url(<?php header_image() ?>); }
    147         <?php if ( 'blank' == get_header_textcolor() ) { ?>
    148         #header h1, #header #desc { display: none; }
    149         <?php } else { ?>
    150         #header h1 a, #desc { color:#<?php header_textcolor() ?>; }
    151         <?php } ?>
    152     </style>
    153 <?php
    154 }
    155 
    156 function bp_dtheme_admin_header_style() { ?>
    157     <style type="text/css">
    158         #headimg {
    159             position: relative;
    160             color: #fff;
    161             background: url(<?php header_image() ?>);
    162             -moz-border-radius-bottomleft: 6px;
    163             -webkit-border-bottom-left-radius: 6px;
    164             -moz-border-radius-bottomright: 6px;
    165             -webkit-border-bottom-right-radius: 6px;
    166             margin-bottom: 20px;
    167             height: 100px;
    168             padding-top: 25px;
    169         }
    170 
    171         #headimg h1{
    172             position: absolute;
    173             bottom: 15px;
    174             left: 15px;
    175             width: 44%;
    176             margin: 0;
    177             font-family: Arial, Tahoma, sans-serif;
    178         }
    179         #headimg h1 a{
    180             color:#<?php header_textcolor() ?>;
    181             text-decoration: none;
    182             border-bottom: none;
    183         }
    184         #headimg #desc{
    185             color:#<?php header_textcolor() ?>;
    186             font-size:1em;
    187             margin-top:-0.5em;
    188         }
    189 
    190         #desc {
    191             display: none;
    192         }
    193 
    194         <?php if ( 'blank' == get_header_textcolor() ) { ?>
    195         #headimg h1, #headimg #desc {
    196             display: none;
    197         }
    198         #headimg h1 a, #headimg #desc {
    199             color:#<?php echo HEADER_TEXTCOLOR ?>;
    200         }
    201         <?php } ?>
    202     </style>
    203 <?php
    204 }
    205 add_custom_image_header( 'bp_dtheme_header_style', 'bp_dtheme_admin_header_style' );
     138/****
     139 * Custom header image support. You can remove this entirely in a child theme by adding this line
     140 * to your functions.php: remove_action( 'template_redirect', 'bp_dtheme_add_custom_header_support' );
     141 */
     142function bp_dtheme_add_custom_header_support() {
     143    /* Set the defaults for the custom header image (http://ryan.boren.me/2007/01/07/custom-image-header-api/) */
     144    define( 'HEADER_TEXTCOLOR', 'FFFFFF' );
     145    define( 'HEADER_IMAGE', '%s/_inc/images/default_header.jpg' ); // %s is theme dir uri
     146    define( 'HEADER_IMAGE_WIDTH', 1250 );
     147    define( 'HEADER_IMAGE_HEIGHT', 125 );
     148
     149    function bp_dtheme_header_style() { ?>
     150        <style type="text/css">
     151            #header { background-image: url(<?php header_image() ?>); }
     152            <?php if ( 'blank' == get_header_textcolor() ) { ?>
     153            #header h1, #header #desc { display: none; }
     154            <?php } else { ?>
     155            #header h1 a, #desc { color:#<?php header_textcolor() ?>; }
     156            <?php } ?>
     157        </style>
     158    <?php
     159    }
     160
     161    function bp_dtheme_admin_header_style() { ?>
     162        <style type="text/css">
     163            #headimg {
     164                position: relative;
     165                color: #fff;
     166                background: url(<?php header_image() ?>);
     167                -moz-border-radius-bottomleft: 6px;
     168                -webkit-border-bottom-left-radius: 6px;
     169                -moz-border-radius-bottomright: 6px;
     170                -webkit-border-bottom-right-radius: 6px;
     171                margin-bottom: 20px;
     172                height: 100px;
     173                padding-top: 25px;
     174            }
     175
     176            #headimg h1{
     177                position: absolute;
     178                bottom: 15px;
     179                left: 15px;
     180                width: 44%;
     181                margin: 0;
     182                font-family: Arial, Tahoma, sans-serif;
     183            }
     184            #headimg h1 a{
     185                color:#<?php header_textcolor() ?>;
     186                text-decoration: none;
     187                border-bottom: none;
     188            }
     189            #headimg #desc{
     190                color:#<?php header_textcolor() ?>;
     191                font-size:1em;
     192                margin-top:-0.5em;
     193            }
     194
     195            #desc {
     196                display: none;
     197            }
     198
     199            <?php if ( 'blank' == get_header_textcolor() ) { ?>
     200            #headimg h1, #headimg #desc {
     201                display: none;
     202            }
     203            #headimg h1 a, #headimg #desc {
     204                color:#<?php echo HEADER_TEXTCOLOR ?>;
     205            }
     206            <?php } ?>
     207        </style>
     208    <?php
     209    }
     210    add_custom_image_header( 'bp_dtheme_header_style', 'bp_dtheme_admin_header_style' );
     211}
     212add_action( 'template_redirect', 'bp_dtheme_add_custom_header_support' );
    206213
    207214function bp_dtheme_remove_redundant() {
     
    246253}
    247254
     255
    248256?>
Note: See TracChangeset for help on using the changeset viewer.