Jump to content

Recommended Posts

I took over a couple of website from a former webdesigner who wanted to quit and now I am transitioning the websites from Joomla to Wordpress. She sent me all the templates that I should be able to import in WP. When I do import a theme, I break all of WP. I checked everything and it is indeed the theme. With WP recovery mode I was able to determine the specific file and lines that are causing the trouble. 

The file is functions.php and the problem is this piece of code:

function theme_get_option($name) {
    global $theme_default_options;
    $result = get_option($name);
    if ($result === false) {
        $result = theme_get_array_value($theme_default_options, $name);
    }
    return $result;
}

The bolded function is undefined and causes trouble. I tried to change it into array_values which WP should be able to read, but it didn't work.

I am hoping that one of you cool people could help me.

Link to comment
https://forums.phpfreaks.com/topic/316038-problem-with-wordpress-template/
Share on other sites

Thanks for your quick response. I tried to fix it, but it seems like it didn't work. I now found out about the debugging mode of Wordpress and it gave some guidance on where to look. I fixed the theme issues, but now I get a different error that makes me think my Wordpress install isn't good anymore. This is the current error:

[25-Mar-2023 21:28:36 UTC] PHP Fatal error:  Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, function "theme_widget_process_control" not found or invalid function name in /wp-includes/class-wp-hook.php:308
Stack trace:
#0 wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array)
#1 wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#2 wp-includes/class-wp-customize-widgets.php(342): do_action('sidebar_admin_s...')
#3 wp-includes/class-wp-hook.php(308): WP_Customize_Widgets->customize_controls_init('')
#4 wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array)
#5 wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#6 wp-admin/customize.php(112): do_action('customize_contr...')
#7 {main}
  thrown in wp-includes/class-wp-hook.php on line 308

Which refers to this function:

public function apply_filters( $value, $args ) {
        if ( ! $this->callbacks ) {
            return $value;
        }

        $nesting_level = $this->nesting_level++;

        $this->iterations[ $nesting_level ] = array_keys( $this->callbacks );
        $num_args                           = count( $args );

        do {
            $this->current_priority[ $nesting_level ] = current( $this->iterations[ $nesting_level ] );
            $priority                                 = $this->current_priority[ $nesting_level ];

            foreach ( $this->callbacks[ $priority ] as $the_ ) {
                if ( ! $this->doing_action ) {
                    $args[0] = $value;
                }

                // Avoid the array_slice() if possible.
                if ( 0 == $the_['accepted_args'] ) {
                    $value = call_user_func( $the_['function'] );
                } elseif ( $the_['accepted_args'] >= $num_args ) {
                    $value = call_user_func_array( $the_['function'], $args );
                } else {
                    $value = call_user_func_array( $the_['function'], array_slice( $args, 0, (int) $the_['accepted_args'] ) );
                }
            }
        } while ( false !== next( $this->iterations[ $nesting_level ] ) );

        unset( $this->iterations[ $nesting_level ] );
        unset( $this->current_priority[ $nesting_level ] );

        $this->nesting_level--;

        return $value;
    }

The highlighted part is line 308. It seems fine to me, but I am in no way a PHP expert.

The previous webdesigner didn't change themes recently. She basically converted her Joomla theme to a Wordpress theme and set them to me. I already transitioned one of the websites without any trouble. But this one seems to be a bit different. She used the same template for all of the sites and changed the styling. 

Is it a child theme, perhaps? The error you're getting says the function `theme_widget_process_control` isn't found; that's not a function in the WP base code. Not actually sure where the `theme_get_array_value` error is that you pointed out in your first post as that doesn't appear in the error message you quoted later, but I don't recognize that as a WP core function either. Admittedly, it's been a bit since I've been deep into WP.

I have found the a fix for my problem. I had to change a line in the Wordpress Base code to make my theme compatible again. https://wordpress.stackexchange.com/questions/406260/wordpress-6-0-class-wp-widget-php-fatal-errors-in-php-8-1-6 This is the fix I applied and all of the sudden the theme worked again.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.