Child Theme - very strange behaviour

Hi, first of all a BIG THANK YOU for the free theme! Very good work!

Now to my issue. I followed your guide, downloaded the child theme and installed properly. All is working fine.
However, I created a functions.php with just two small modifications (which I copied from here), and it is WORKING FINE! Then all of a sudden, error 500 appears when you view a page (you were previously viewing fine).
I rename functions.php to something else, the page loads fine, and then I make the name back to functions.php, and IT WORKS FINE again… Until the next time… Any idea what might be the culprit?


FUNCTIONS.PHP:
<?php
// Add your custom functions here

add_action( ‘wp_enqueue_scripts’, ‘sparkling_enqueue_styles’, 15 );
function sparkling_enqueue_styles() {
wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ );
wp_enqueue_style( ‘child-style’,
get_stylesheet_directory_uri() . ‘/style.css’,
array(‘parent-style’)
);
}

function sparkling_footer_info() {
global $sparkling_footer_info;
echo __( ‘Theme by Colorlib’);
}


STYLE.CSS:
/*
Theme Name: Sparkling Child
Theme URI: https://colorlib.com/wp/themes/sparkling
Author: Colorlib
Author URI: https://colorlib.com/
Description: Sparkling is a clean minimal and responsive WordPress theme well suited for travel, health, business, finance, design, art, personal and any other creative websites and blogs. Developed using Bootstrap 3 that makes it mobile and tablets friendly. Theme comes with full-screen slider, social icon integration, author bio, popular posts widget and improved category widget. Sparkling incorporates latest web standards such as HTML5 and CSS3 and is SEO friendly thanks to its clean structure and codebase. It has dozens of Theme Options to change theme layout, colors, fonts, slider settings and much more. Theme is also translation and multilingual ready and is available in Spanish. Sparkling is a free WordPress theme with premium functionality and design.
Version: 2.0.0
Template: sparkling
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: sparkling
Domain Path: /languages/
Tags: green, light, white, gray, black, one-column, two-columns, right-sidebar, fluid-layout, responsive-layout, photoblogging, left-sidebar, translation-ready, custom-background, custom-colors, custom-menu, featured-images, full-width-template, post-formats, theme-options, threaded-comments

This theme, like WordPress, is licensed under the GPL.

sparkling is based on Underscores http://underscores.me/, (C) 2012-2015 Automattic, Inc.

*/

Hi Chrisvor,

Sorry to hear of the problem you are having.

I used your shared code in my child theme of Sparkling theme and it worked fine for me except the following error which was generated by sparkling_footer_info function added in your functions.php file so i just removed it.

Fatal error: Cannot redeclare sparkling_footer_info() (previously declared

The 500 Internal Server error is not always due to WordPress. It can be caused by other issues on the server as well. You will find more information about it on the following pages.

http://www.checkupdown.com/status/E500.html
http://support.hostgator.com/articles/specialized-help/technical/wordpress/how-to-fix-the-internal-server-error-in-wordpress

Best Regards,
Movin

Thank you Movin for the reply.

I checked the inc/extras.php in the “parent” theme folder and it defined this function as:

/**

  • function to show the footer info, copyright information
    */
    function sparkling_footer_info() {
    global $sparkling_footer_info;
    printf( esc_html__( ‘Theme by %1$s Powered by %2$s’, ‘sparkling’ ) , ‘Colorlib’, ‘WordPress’);
    }

So it DOES NOT CHECK for existence (in a customized child definition).

I think the original theme must be modified to:

/**

  • function to show the footer info, copyright information
    */
    if ( ! function_exists( ‘sparkling_footer_info’ ) ) {
    function sparkling_footer_info() {
    global $sparkling_footer_info;
    printf( esc_html__( ‘Theme by %1$s Powered by %2$s’, ‘sparkling’ ) , ‘Colorlib’, ‘WordPress’);
    }
    }

in order to define the function if it is not already defined (i.e. overridden) by a child theme.

Thanks again,
Christos

Hi Christos,

Thank you for your feature request.

I have created the ticket for it on the following URL so that it can be considered for future development of the theme.

Thanks,
Movin