Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Child theme functions file not mapping in custom theme. WordPress


I am using a custom "premium" theme to turn my WordPress site into a classified ads site. Since it is a theme and not a plugin, anytime a new version is released, you have to overwrite all your changes/mods. Recently, they have released the ability to use Child Themes to prevent this. I have started rebuilding my site using a Child Theme and am trying to include a functions.php file to add my own custom changes. One of the things I'm trying to do is change some text/layout around the login function. So I copied the function in its entirety from the theme functions file and pasted it into my own functions.php file, uploaded to my Child Theme directory, but the changes are not reflected. I'm at a loss how to get this file to map correctly. The premium theme is ClassiPress from the folks at and the programmer said they wouldn't be able to check my files for 5-7 days. I'd like to have it done faster. Thanks!

Edited to add a DEVELOPMENT link: ***Please note, this site is still in development so it's possible some of the pages have alignment issues. Currently I'm working on the home page and trying to get my custom functions to work properly.

Answers (1)


flashingcursor answers:

Couple things to check:

Is your child theme active?

Is your child theme directory readable by the server (ie: you upload as root and forget to chmod the directory)

Does your child theme have a proper styles.css?

Without access to the system, or code to look at, it's hard to do anything but stab in the dark. Perhaps you could post your functions.php and style.css files here.

Ramsey comments:

The entire site that you see on the dev link is using a Child Theme. I can make changes to other files (styles.css or header or index etc.) and the changes are immediately reflected, so I know that the child theme itself is working properly. I believe it's the way the theme is coded that is causing the file-mapping inconsistencies. For example, the parent theme's functions.php is as follows:

// load ClassiPress theme functions
require_once (TEMPLATEPATH . '/includes/theme-functions.php');

That file is like a 2K+ line file but the one function I want to grab is:
// display the login message in the header
if (!function_exists('cp_login_head')) {
function cp_login_head() {

if (is_user_logged_in()) :
global $current_user;
<?php _e('Welcome,','cp'); ?> <strong><?php echo $current_user->user_login; ?></strong> [ <a href="<?php echo CP_DASHBOARD_URL ?>"><?php _e('My Dashboard','cp'); ?></a> | <a href="<?php echo wp_logout_url(); ?>"><?php _e('Log out','cp'); ?></a> ]&nbsp;
<?php else : ?>
<?php _e('Welcome,','cp'); ?> <strong><?php _e('visitor!','cp'); ?></strong> [ <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=register"><?php _e('Register','cp'); ?></a> | <a href="<?php echo get_option('siteurl'); ?>/wp-login.php"><?php _e('Login','cp'); ?></a> ]&nbsp;
<?php endif;


According to their "readme" file:
/* We are beginning to allow some of our functions to use overrides from the child themes. */
/* To make it easier for you to create your functions.php file, we will list the functions */
/* here as we allow you to override them. */

/* includes/theme-functions.php functions that can be child theme modded */
// display the login message in the header
function cp_login_head()

So I copied the cp_login_head() function to my Child Theme functions.php file, made my changes, uploaded, and no changes were reflected.

flashingcursor comments:

<blockquote>if (!function_exists('cp_login_head')) {</blockquote>

I believe that might be your problem. I'm not sure how the parent theme is structured, but your running something based on the condition that the function cp_login_head does not(!) already exist. If the parent has already created the function, this will never run.

Ramsey comments:


Yes that appears to be the issue.

Just to make sure I do this right for each additional function I want, I have to make sure I don't include the "if function exists" code, right?


flashingcursor comments:

Well, it's the ! character that screws it up... ! means NOT in php. You can either remove the entire if line, or just remove the ! (since it seems the functions already exist).

I'm not sure it's exactly how it should be done in this case, as I'm not sure which parent theme your using, but for the most part, I think this should solve your problem.