Error in child theme

Hello,

I’m seeing this error in my logs, and on my staging site it is showing the error at the top of the page:

[Fri Mar 15 15:06:00.572970 2019] [:error] [pid 27086] [client 34.202.93.213:29146] PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘my_theme_enqueue_styles’ not found or invalid function name in /nas/content/live/nwillow/wp-includes/class-wp-hook.php on line 286

Here is the staging site: http://nwillow.staging.wpengine.com/

This is the content of my child theme functions file:

    <?php

// =============================================================================
// FUNCTIONS.PHP
// -----------------------------------------------------------------------------
// Overwrite or add your own custom functions to Pro in this file.
// =============================================================================

// =============================================================================
// TABLE OF CONTENTS
// -----------------------------------------------------------------------------
//   01. Enqueue Parent Stylesheet
//   02. Additional Functions
// =============================================================================

// Enqueue Parent Stylesheet
// =============================================================================

add_filter( 'x_enqueue_parent_stylesheet', '__return_true' );



// Additional Functions
// =============================================================================

function myshortcode_title( ){
return get_the_title();
}
add_shortcode( 'page_title', 'myshortcode_title' );

add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );

add_action('gform_after_submission', 'gf_to_sherpa', 10, 2);
function gf_to_sherpa($entry, $form) {
  if ($form['id'] == 1) {
    $firstName = (isset($entry['1.3'])) ? $entry['1.3'] : '';
    $lastName = (isset($entry['1.6'])) ? $entry['1.6'] : '';
    $phone = (isset($entry['2'])) ? $entry['2'] : '';
    $email = (isset($entry['3'])) ? $entry['3'] : '';
    $note = (isset($entry['4'])) ? $entry['4'] : '';
    $address = (isset($entry['5.1'])) ? $entry['5.1'] : '';
    $city = (isset($entry['5.3'])) ? $entry['5.3'] : '';
    $state = (isset($entry['5.4'])) ? $entry['5.4'] : '';
    $zip = (isset($entry['5.5'])) ? $entry['5.5'] : '';
    $page = (isset($entry['6'])) ? $entry['6'] : '';
    $source = "Company Website - " . $page;

    //PROD VALUES
    $post_url = 'https://members.sherpacrm.com/api/lead/create';
    $company_id = '0007ebb8-6a1f-11e6-8b3f-12b98c724ab5';
    $community_id = '8875c3ce-6b02-11e6-8b3f-12b98c724ab5';


    /* TEST VALUE OVERRIDES
    $post_url = 'http://test.sherpacrm.com/api/lead/create';
    $company_id = '7ac94766-8fcd-11e5-9bbf-22000b04aac4';
    $community_id = '8875c3ce-6b02-11e6-8b3f-12b98c724ab5';
    */

    if ($email && is_email($email)) {
      $post_json = json_encode(
        array("lead"=>array(
          "VendorName"                => "Company Website",
          "SourceName"                => $source,
          "ReferralType"              => 1,
          "VendorPropertyID"          => -1,
          "ReferralDate"              => date("Y-m-d", time()),
		  "ReferralDateTime"          => date('Y-m-d \zH:i:s'),
          "PropertyName"              => "Traditions at North Willow",
          "AdvisorFirstName"          => "",
          "AdvisorLastName"           => "",
          "AdvisorEmail"              => "",
          "PrimaryContactFirstName"   => $firstName,
          "PrimaryContactLastName"    => $lastName,
          "PrimaryContactEmail"       => $email,
          "PrimaryContactHomePhone"   => $phone,
          "ResidentContactFirstName"  => "",
          "ResidentContactLastName"   => "",
          "PrimaryContactAddress1"    => $address,
          "PrimaryContactCity"   	  => $city,
          "PrimaryContactState"   	  => $state,
          "PrimaryContactPostalCode"  => $zip,
		  "PrimaryContactResidentRelationship" => "self",
          "AdvisorReferralNote"       => $note
        ))
      );
      $request = new WP_Http();
      $response = $request->post($post_url, array(
        'headers'=>array(
          'company'=>$company_id,
          'community'=>$community_id,
        ),
        'body'=>$post_json,
      ));
      if (is_wp_error($response)) {
        GFCommon::log_debug('gform_after_submission: Sherpa API response => WPERROR');
      } else {
        GFCommon::log_debug('gform_after_submission: Sherpa API response => '.print_r($response['body'], true));
      }
    } else {
      GFCommon::log_debug('gform_after_submission: Sherpa API error => no email address found');
    }
  } // if ($form['id'] == 1)
}

How can I fix this error?

Thanks!

I believe it’s this line causing the problem. Is there any reason I need to keep this line? I’m not sure what it does.

Hello Andrew,

Thanks for reaching out. :slight_smile:

You can get rid of the PHP warning message by disabling your debug mode. You can do this by opening wp-config.php and adding


define('WP_DEBUG', false);

/* That's all, stop editing! Happy blogging. */

When you revisit the page, you should no longer be seeing the PHP warning message.

Thanks.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.