Make WordPress Core

Ticket #3465: functions.php

File functions.php, 1.6 KB (added by ryan, 19 years ago)

Sample theme functions.php

Line 
1<?php
2
3define('HEADER_TEXTCOLOR', 'B5C09D');
4define('HEADER_IMAGE', '%s/img/just-train.jpg'); // %s is theme dir uri
5define('HEADER_IMAGE_WIDTH', 741);
6define('HEADER_IMAGE_HEIGHT', 142);
7
8function header_style() {
9?>
10<style type="text/css">
11#headimg {
12        background:#7d8b5a url(<?php header_image() ?>) center repeat-y;
13}
14<?php if ( 'blank' == get_theme_mod('header_textcolor', HEADER_TEXTCOLOR) ) { ?>
15#headimg h1 a, #headimg #desc {
16        display: none;
17}
18<?php } else { ?>
19#headimg h1 a, #headimg h1 a:hover, #headimg #desc {
20        color: #<?php header_textcolor() ?>;
21}       
22<?php } ?>
23</style>
24<?php
25}
26
27function admin_header_style() {
28?>
29<style type="text/css">
30#headimg {
31        height: <?php echo HEADER_IMAGE_HEIGHT; ?>px;
32        width: <?php echo HEADER_IMAGE_WIDTH; ?>px;
33}
34#headimg h1
35{
36        margin: 0;
37        font-size: 1.6em;
38        padding:10px 20px 0 0;
39        text-align:right;
40}
41#headimg h1 a {
42        color:#<?php header_textcolor() ?>;
43        border: none;
44        font-family: Georgia, "Lucida Sans Unicode", lucida, Verdana, sans-serif;
45        font-weight: normal;
46        letter-spacing: 1px;
47        text-decoration: none;
48}
49#headimg a:hover
50{
51        text-decoration:underline;
52}
53#headimg #desc
54{
55        font-weight:normal;
56        font-style:italic;
57        font-size:1em;
58        color:#<?php header_textcolor() ?>;
59        text-align:right;
60        margin:0;
61        padding:0 20px 0 0;
62}
63
64<?php if ( 'blank' == get_theme_mod('header_textcolor', HEADER_TEXTCOLOR) ) { ?>
65#headerimg h1, #headerimg #desc {
66        display: none;
67}
68#headimg h1 a, #headimg #desc {
69        color:#<?php echo HEADER_TEXTCOLOR ?>;
70}
71<?php } ?>
72
73</style>
74<?php
75}
76
77
78add_custom_header_admin_page('admin_header_style');
79
80add_action('wp_head', 'header_style');
81
82if ( function_exists('register_sidebars') )
83        register_sidebars(1);
84
85?>