shaig
Forum Replies Created
-
That did the trick. Thanks a bunch!
I tried overriding the parent theme by adding this block to the functions.php in the child:
require( get_template_directory() . ‘/inc/custom-header.php’ );
}to pick up the local inc/custom-header.php and modified that file as shown below but that generates a failure
Fatal error: Cannot redeclare tinyframework_custom_header_setup() (previously declared in /home/guthar5/public_html/wp-content/themes/tiny-framework/inc/custom-header.php:21) in /home/guthar5/public_html/wp-content/themes/tiny-framework/inc/custom-header.php on line 65<?php
/**
* Custom Header functionality for Tiny Framework.
* @link https://codex.wordpress.org/Custom_Headers
*
* @package Tiny_Framework
* @since Tiny Framework 1.0
*/// Child function override
function remove_parent_theme_features() {
remove_action( ‘after_setup_theme’, ‘tinyframework_custom_header_setup’ );
add_action( ‘after_setup_theme’, ‘child_tinyframework_custom_header_setup’ );
}/**
* Set up the WordPress core custom header arguments and settings.
*
* @uses add_theme_support() to register support for 3.4 and up
* @uses tinyframework_header_style() to style front-end
*
* @since Tiny Framework 1.0
*/
function child_tinyframework_custom_header_setup() {
$args = array(
// Text color and image (empty to use none).
‘default-text-color’ => ‘515151’,
‘default-image’ => ‘%2$s/images/headers/Tiny-Framework-header-01.jpg’,// Set height and width, with a maximum value for the width.
‘height’ => 200,
‘width’ => 960,
‘max-width’ => 2000,// Support flexible height and width.
‘flex-height’ => true,
‘flex-width’ => true,// Random image rotation off by default.
‘random-default’ => false,// Callbacks for styling the header and the admin preview.
‘wp-head-callback’ => ‘tinyframework_header_style’,
);add_theme_support( ‘custom-header’, $args );
/* Default custom headers packaged with the theme.
* %s is a placeholder for the theme template directory URI.
* %2$s is a placeholder for the (child) theme stylesheet directory URI.
* I’m using %2$s to make it easy for the user to replace default header images in a child theme.
* @link https://codex.wordpress.org/Function_Reference/register_default_headers
*/
register_default_headers( array(
‘First’ => array(
‘url’ => ‘%2$s/images/headers/Tiny-Framework-header-01.jpg’,
‘thumbnail_url’ => ‘%2$s/images/headers/Tiny-Framework-header-01-thumbnail.jpg’,
‘description’ => esc_html_x( ‘First’, ‘header image description’, ‘tinyframework’ )
),
‘Second’ => array(
‘url’ => ‘%2$s/images/headers/Tiny-Framework-header-02.jpg’,
‘thumbnail_url’ => ‘%2$s/images/headers/Tiny-Framework-header-02-thumbnail.jpg’,
‘description’ => esc_html_x( ‘Second’, ‘header image description’, ‘tinyframework’ )
),
‘Third’ => array(
‘url’ => ‘%2$s/images/headers/Tiny-Framework-header-03.jpg’,
‘thumbnail_url’ => ‘%2$s/images/headers/Tiny-Framework-header-03-thumbnail.jpg’,
‘description’ => esc_html_x( ‘Third’, ‘header image description’, ‘tinyframework’ )
),
) );
}
add_action( ‘after_setup_theme’, ‘child_tinyframework_custom_header_setup’ );Thanks, but I appear stuck.
I added this to functions.php
// 3.10 – Tip07 – Add new image size for custom post/page headers and select default header image.
add_image_size( ‘custom-header-image’, 960, 150, true); // Hardcropas you suggested, but it had no effect.
I couldn’t find Tip39 anywhere in style.css, including the documentation on your site which seems to end at Tip37. I also looked for header-image entries in the css that might be relevant but all I saw were border and padding values, which won’t help.
Is there an easy way to just include the custom-header.php file, change the height value, without having to copy all of the theme contents down to the child?
I tried that earlier, but I must be missing a key step as it doesn’t seem like the child theme’s inc/custom-header.php file is getting pulled in and instead it is still using the parent theme’s files.
Key notes are that the customization widget still offers a cropping for 960×350 pixels and the displayed image is unchanged.