I'd like to better understand - when I place the below into my functions.php file:
add_action('customize_register', 'boat_annualReport_customize_register');
function boat_annualReport_customize_register($wp_customize) {
$wp_customize->add_section('boat-annualreport-callout', array ('title' => 'Annual Reports',
// 'priority' => 1,
// 'default' => 'testing',
'title' => __('Annual Report', 'boat')
));
$wp_customize->add_setting('boat-annualreport-callout-headline', array(
'default' => 'Annual Report'
));
$wp_customize->add_control( new WP_Customize_Control($wp_customize, 'boat-annualreport-callout-headline-control', array (
'label' => 'Text',
'section' => 'boat-annualreport-callout',
'settings' => 'boat-annualreport-callout-headline',
'type' => 'textarea',
// 'active_callback' => 'boat_annualreport_callout_image_on_condition',
)));
$wp_customize->add_setting('boat-annualreport-callout-image', array(
'type' => 'theme_mod', // or 'option'
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'sanitize_callback' => '',
'sanitize_js_callback' => '' // Basically to_json.
));
$wp_customize->add_control( new WP_Customize_Cropped_Image_Control($wp_customize, 'boat-annualreport-callout-image', array (
'label' => 'Hero Image',
'section' => 'boat-annualreport-callout',
'settings' => 'boat-annualreport-callout-image',
'type' => 'image',
// 'active_callback' => 'boat_annualreport_callout_image_on_condition',
'height' => 590,
'width' => 1920
)));
}
It loads in the wp-admin customize section perfectly.
But when I place the code above from my functions.php file into my annualReportFunctions.php file and then modify my functions.php to the code below it does not load the custom_register function in the annualReportFunctions.php file. It does open the annualReportFunctions.php file, and it will fire other functions in it - but it will not fire any custom_register functions.
Please help me understand this. My functions.php file is going to be huge if I have to include every pages functions into one file - I would like to be able to split them up to load as needed :/
function boatTheBusForOutdoorAccess_register_scripts() {
global $stringTmp;
global $themeIncPath;
echo $stringTmp;
if ( $stringTmp === "" ) {
require_once dirname( __FILE__ ) . '/inc/homeFunctions.php';
// boat_homehero_customize_register($wp_customize);
} elseif ( $stringTmp === 'find-your-trip' ) {
require_once dirname( __FILE__ ) . '/inc/findYourTripFunctions.php';
} elseif ( $stringTmp === 'who-we-are' ) {
require_once dirname( __FILE__ ) . '/inc/whoWeAreFunctions.php';
} elseif ( $stringTmp === 'what-we-do' ) {
require_once dirname( __FILE__ ) . '/inc/whatWeDoFunctions.php';
} elseif ( $stringTmp === 'support-our-mission' ) {
require_once dirname( __FILE__ ) . '/inc/supportOurMissionFunctions.php';
} elseif ( $stringTmp === 'plan-a-trip' ) {
require_once dirname( __FILE__ ) . '/inc/planATripFunctions.php';
} elseif ( $stringTmp === 'annual-report' ) {
echo " 1";
// global $stringTmp;
require_once dirname( __FILE__ ) . '/inc/annualReportFunctions.php';
echo " 4";
} else {
echo "Page template slug is not an array or is not set.";
}
}
function boatTheBusForOutdoorAccess_register_url() {
global $url;
global $path;
global $stringTmp;
global $wp;
if (isset($url) && is_array($url)) {
echo " First hooray. This is an array and it is set ";
$stringTmp = implode($url);
$path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$stringTmp = basename($path, ".php"); // Will remove `.php` suffix
}
boatTheBusForOutdoorAccess_register_scripts();
}
add_action( 'wp_enqueue_scripts', 'boatTheBusForOutdoorAccess_register_url');
add_action( 'wp_enqueue_scripts', 'boatTheBusForOutdoorAccess_register_url');
but since you mentioned that is probably the issue and not the way best way to call it so it fires in order......will test some stuff. Thank you so much!!