how to fix create_function in custom theme



If you look at you will see that the parameter is for the function to call to output the content of the admin page. If it is really an empty function, why add the menu item?
If you just left out the code to shorten your question, then it will be difficult to help you.
To remove the create_function call, simply move the code it has to its own function and put the name of the new function in where the former was.

Here is the page about create_function:
You can see what its two parameters are, so you can know how to make a named function out of it instead of an anonymous function.

Yes, I did shorten the code from the script (see below).

I’m afraid my knowledge of PHP and how it’s implemented for WP makes it difficult for me to clearly understand what you’re suggesting by moving the code it has to its own function. Frankly speaking, spelling it out for my example is what I’ll need to follow.

I do code in python and used to code html/css but this really is out of my ken. Unfortunately, we can’t go back to the original authors. Am I in over my head – by a long shot. But I’m hoping if it’s not too complex of a fix that I’ll learn something along the way. Hard for me to gauge exactly what I’m dealing with. Thanks for any help.

Here’s the rest of the code from that script. Let me know if there are other parts of the custom theme that would be needed to decipher what a fix would be.

function attach_main_options_page() {
	$title = "Theme Options";
		create_function('', '')
add_action('admin_menu', 'attach_main_options_page');

$home_slider_fade_speed = wp_option::factory('text', 'home_slider_fade_speed', 'Slideshow Speed');
$home_slider_fade_speed->help_text('Animation speed in milliseconds');

$home_slider_fade_interval = wp_option::factory('text', 'home_slider_fade_interval', 'Slideshow Interval');
$home_slider_fade_interval->help_text('Animation interval in milliseconds');

$tryout_link = wp_option::factory('text', 'tryout_link', 'Tryout Link');
$tryout_link = wp_option::factory('text', 'tryout_link', 'Tryout Link');
$tryout_link->help_text('This defines the link URL of the Try out the new Hierarchy Explorer on home page');

$inner_options = new OptionsPage(array(
	wp_option::factory('header_scripts', 'header_script'),
    wp_option::factory('footer_scripts', 'footer_script'),
$inner_options->title = 'General';
$inner_options->file = basename(__FILE__);
$inner_options->parent = "theme-options.php";




I don’t know what the theme is doing, but since the create_function parameters are empty in your second post, you should simply remove that parameter and it will use the default of ”.
By that I mean delete the part that says create_function('',''). Just remove that part.

Great. That got rid of the error. I had assumed that those empty variables were being filled in later but I guess then they would at least have variables stated within them.

Thanks! Now onto the remaining Warnings and Notices.

Source link