Viewing 2 reply threads
You must be logged in to reply to this topic.
Hello,
I’m trying to make my customizations in a child theme. To test, I tried to override the codeless_images_sizes() function. I copied the function from specular to my child theme folder. The functions.php in my child theme looks like this:
<?php
function child_enqueue_scripts() {
wp_register_style( ‘childtheme_style’, get_stylesheet_directory_uri() . ‘/style.css’ );
wp_enqueue_style( ‘childtheme_style’ );
}
add_action( ‘wp_enqueue_scripts’, ‘child_enqueue_scripts’);
function codeless_images_sizes(){
add_image_size( ‘port3’, 600, 600, true );
add_image_size( ‘port3_grayscale’, 627, 470, true );
add_image_size( ‘port2’, 460, 275, true );
add_image_size( ‘port2_grayscale’, 940, 470, true );
add_image_size( ‘port4’, 600, 600, true );
add_image_size( ‘blog’, 825, 340, true );
add_image_size( ‘alternate_blog’, 440, 195, true );
add_image_size( ‘alternate_blog_side’, 355, 235, true );
add_image_size( ‘blog_grid’, 350, 350, true );
add_image_size( ‘staff’, 400, 270, true );
add_image_size( ‘staff_full’, 500, 340, true );
}
?>
When I try to access the site, I get this error message:
Fatal error: Cannot redeclare codeless_images_sizes() …
Please advise what else I need to do to override specular theme functions in my child theme. Thanks.
Hello,
Please follow the instructions of this article for more: https://code.tutsplus.com/tutorials/a-guide-to-overriding-parent-theme-functions-in-your-child-theme–cms-22623
Let us know.
Best regards!
You must be logged in to reply to this topic.