I'm trying to load a file via require_once() to handle some enhanced functionality in my theme. I could place all the code directly inside functions.php, but I'm trying to isolate this code into its own script.
The file is widget_context.php (see code below) and right now I'm just trying to echo some text back to each widget. It works fine when I do the echo directly from the function that calls the file.
However, I can't get the echo or return (from the widget_context.php file) to show up in the widget.
What am I missing?
This function is inside functions.php
add_filter('in_widget_form', 'widget_context');
function widget_context(){
//echo works here:
//echo 'in widget form';
$widgets_context_file = TEMPLATEPATH . "/widget_context.php";
require_once($widgets_context_file);
}
Here is the contents of widget_context.php
<?php
echo 'place the checkboxes here';
return 'place the checkboxes here';
?>