[wp-testers] WP3 RC3 -- Child theme troubles w Functions.php
Doug Joseph
pastor at cac.us.com
Sat Jun 12 15:33:04 UTC 2010
As soon as I try to use a child theme with a functions.php file and a
header.php file, I get this:
Fatal error: Call to undefined function twentyten_the_page_number() in
/home/content/d/o/u/dougjoseph/html/wvupciorg/wp-content/themes/wvupci-twent
yten-child-theme/header.php on line 25
Note that line 25 says:
twentyten_the_page_number();
Note: In my attempt, the headers.php file in the child theme was identical
to the one in the Twenty Ten theme!
Anticipating the odd reply that I should not need an identical headers file,
and "why don't you delete it?" - That does not address the issue, but
nevertheless I did delete it, and then.
When I deleted the headers.php file the above error went away. **However**,
when I tried to log out (I was logged in at that moment), I got these
errors:
Warning: Cannot modify header information - headers already sent by (output
started at
/home/content/d/o/u/dougjoseph/html/wvupciorg/wp-content/themes/wvupci-twent
yten-child-theme/functions.php:1) in
/home/content/d/o/u/dougjoseph/html/wvupciorg/wp-login.php on line 337
Warning: Cannot modify header information - headers already sent by (output
started at
/home/content/d/o/u/dougjoseph/html/wvupciorg/wp-content/themes/wvupci-twent
yten-child-theme/functions.php:1) in
/home/content/d/o/u/dougjoseph/html/wvupciorg/wp-login.php on line 349
Warning: Cannot modify header information - headers already sent by (output
started at
/home/content/d/o/u/dougjoseph/html/wvupciorg/wp-content/themes/wvupci-twent
yten-child-theme/functions.php:1) in
/home/content/d/o/u/dougjoseph/html/wvupciorg/wp-includes/pluggable.php on
line 690
Warning: Cannot modify header information - headers already sent by (output
started at
/home/content/d/o/u/dougjoseph/html/wvupciorg/wp-content/themes/wvupci-twent
yten-child-theme/functions.php:1) in
/home/content/d/o/u/dougjoseph/html/wvupciorg/wp-includes/pluggable.php on
line 691
Warning: Cannot modify header information - headers already sent by (output
started at
/home/content/d/o/u/dougjoseph/html/wvupciorg/wp-content/themes/wvupci-twent
yten-child-theme/functions.php:1) in
/home/content/d/o/u/dougjoseph/html/wvupciorg/wp-includes/pluggable.php on
line 692
Warning: Cannot modify header information - headers already sent by (output
started at
/home/content/d/o/u/dougjoseph/html/wvupciorg/wp-content/themes/wvupci-twent
yten-child-theme/functions.php:1) in
/home/content/d/o/u/dougjoseph/html/wvupciorg/wp-includes/pluggable.php on
line 890
I was not able to log out.
I was able to browse the site (while still logged in).
I tried to edit a post. I was able to view the editing form, but when I
tried to publish the changes, I got this:
Warning: Cannot modify header information - headers already sent by (output
started at
/home/content/d/o/u/dougjoseph/html/wvupciorg/wp-content/themes/wvupci-twent
yten-child-theme/functions.php:1) in
/home/content/d/o/u/dougjoseph/html/wvupciorg/wp-includes/pluggable.php on
line 890
I have had problems trying to have a functions.php file even when the file
has no code, just opening and closing tags. However, at this time I have
been trying to use the file to include code for a child theme implementation
of a favicon, some code for a default category icon, and some code to add
additional default header images. Below is the code from what I attempted to
do with functions.php:
/* Below: Favicon code (for a child theme) -- the path must be a subfolder
of the child theme */
function childtheme_favicon() { ?>
<link rel="shortcut icon" href="<?php echo
bloginfo('stylesheet_directory') ?>/images/favicon.ico">
<?php }
add_action('wp_head', 'childtheme_favicon');
/* Below: How to set a default Category Icon
(this tip is from http://www.category-icons.com/page/2/)
Suppose you have categories that don't have yet an icon assigned to. If you
want to display a default icon
instead of nothing (no icon), here is the code that you must paste in
functions.php (in your theme) */
function bm_noicon($content) {
if (empty($content)) {
$content = '<img
src="http://wvupci.com/wp-content/uploads/WV-District-Logo-0064x0064.png"
alt="default icon" />';
}
return $content;
}
add_filter('category_icons', 'bm_noicon');
/* The following is a function for my child theme. It sets up and adds
additional default header images. */
add_action( 'after_setup_theme', 'wvupci_theme_setup' );
function wvupci_theme_setup(){
/* Add additional default header images (Some photos are by Aaron Hockley of
Hockley Photography) */
$wvupci_theme_dir = get_bloginfo('stylesheet_directory');
register_default_headers( array (
'lights' => array (
'url' =>
"$wvupci_theme_dir/images/headers/lights.jpg",
'thumbnail_url' =>
"$wvupci_theme_dir/images/headers/lights-thumbnail.jpg",
'description' => __( 'Lights by Aaron
Hockley', 'wvupci-twentyten-child-theme' )
),
'train' => array (
'url' =>
"$wvupci_theme_dir/images/headers/train.jpg",
'thumbnail_url' =>
"$wvupci_theme_dir/images/headers/train-thumbnail.jpg",
'description' => __( 'Train by Aaron
Hockley', 'wvupci-twentyten-child-theme' )
),
'bridge' => array (
'url' =>
"$wvupci_theme_dir/images/headers/bridge.jpg",
'thumbnail_url' =>
"$wvupci_theme_dir/images/headers/bridge-thumbnail.jpg",
'description' => __( 'Bridge by Aaron
Hockley', 'wvupci-twentyten-child-theme' )
),
'wvupci-001-music' => array (
'url' =>
"$wvupci_theme_dir/images/headers/wvupci-001-music.jpg",
'thumbnail_url' =>
"$wvupci_theme_dir/images/headers/wvupci-001-music-thumbnail.jpg",
'description' => __( 'wvupci-001-music
by Doug Joseph', 'wvupci-twentyten-child-theme' )
),
'wvupci-002-music' => array (
'url' =>
"$wvupci_theme_dir/images/headers/wvupci-002-music.jpg",
'thumbnail_url' =>
"$wvupci_theme_dir/images/headers/wvupci-002-music-thumbnail.jpg",
'description' => __( 'wvupci-002-music
by Doug Joseph', 'wvupci-twentyten-child-theme' )
)
));
}
Sincerely,
Doug Joseph
More information about the wp-testers
mailing list