php error instead of custom 404 page

Hi,

I set up a custom 404 page using the built-in 404 page in the theme settings. It was working perfectly for a while, but now, it has started displaying a php error instead of the error page itself.

Here is what I get now instead of the error page.

"


Fatal error: Uncaught Error: Call to undefined function
mfn_builder_print() in
/hermes/walnaweb06a/b2072/moo.jmhoffman/advancedir/wp-content/themes/betheme-child/404.php:61
Stack trace:
#0
/hermes/walnaweb06a/b2072/moo.jmhoffman/advancedir/wp-includes/template-loader.php(77):
include()
#1
/hermes/walnaweb06a/b2072/moo.jmhoffman/advancedir/wp-blog-header.php(19):
require_once('/hermes/walnawe...')
#2 /hermes/walnaweb06a/b2072/moo.jmhoffman/advancedir/index.php(17):
require('/hermes/walnawe...')
#3 {main}
thrown in
/hermes/walnaweb06a/b2072/moo.jmhoffman/advancedir/wp-content/themes/betheme-child/404.php
on line 61
"

Can you please help me get my 404 error page working again?

Here is the link to the site:
and here is the link that caused the error code to appear (although it appears for any incorrect page url)

Thanks.

Comments

  • Hi,
    Is your php version 7 or higher?
    Did you test it with all of the plugins disabled? (and cleared the cache after disabling the plugins?)
    Is your BeTheme and WordPress up to date?
    Thanks
  • Hi Pablo,

    My server is using php version 7.1.

    WordPress and the BeTheme are both up-to-date.

    I have disabled all plugins and cleared the cache and the problem persists.

    Any other thoughts?
    It was working when I first set the 404 page up, but then at some point in the few weeks since the site was completed, it stopped working.
  • Hello,
    those might be recent code changes for the theme, that impact the child theme.
    Please switch to the parent theme and see if this issue persists.
    thanks
  • Yes!!! That was the problem. Now, how do I fix it?


  • edited April 2019
    Hi,
    Some time ago, we released the update for the Child Theme

    Now, if you will make some changes in your child theme, you don't have to
    provide the informations in functions.php which files you changed - now,
    it's automatically apply these changes.
    To make your Child Theme work again, you have to find and replace the 'mfn_opts_show()' to 'echo mfn_opts_get()' in files which were modified.
    After that, everything should be working fine, we had to make that change because of the new envato rules, more about it here: https://help.author.envato.com/hc/en-us/articles/360000481243#h_674316188621522302914837
    Thanks
  • Thanks for the update. Is the code above supposed to be in the functions.php file? I am not finding anything that looks like that in my functions.php file for my child theme or in the main Betheme functions file. Please let me know where I need to look for that code, or let me know where I can find the child theme update that you refer to.
  • To make your Child Theme work again, you have to find and replace the
    'mfn_opts_show()' to 'echo mfn_opts_get()' in files which were modified.
    Thanks
  • edited April 2019
    I haven't modified any files except for the functions.php and the 404.php. I don't see the lines of code you are referring to in the functions.php file.

    In the 404.php this is the code that I have. I don't see any instances of the 'mfn_opts_show()'. I'm not a coder so I may be misunderstanding what I'm supposed to do. 

    //Code hidden by support team
    <?php
    /**
     * 404 page.
     *
     * @package Betheme
     * @author Muffin group
     * @link https://muffingroup.com
     */

    $translate['404-title'] = mfn_opts_get('translate') ? mfn_opts_get('translate-404-title', 'Ooops... Error 404') : __('Ooops... Error 404', 'betheme');
    $translate['404-subtitle'] = mfn_opts_get('translate') ? mfn_opts_get('translate-404-subtitle', 'We are sorry, but the page you are looking for does not exist') : __('We are sorry, but the page you are looking for does not exist', 'betheme');
    $translate['404-text'] = mfn_opts_get('translate') ? mfn_opts_get('translate-404-text', 'Please check entered address and try again or') : __('Please check entered address and try again or ', 'betheme');
    $translate['404-btn'] = mfn_opts_get('translate') ? mfn_opts_get('translate-404-btn', 'go to homepage') : __('go to homepage', 'betheme');
    ?><!DOCTYPE html>
    <html <?php language_attributes(); ?> class="no-js<?php echo esc_attr(mfn_user_os()); ?>">

    <head>

    <meta charset="<?php bloginfo('charset'); ?>" />
    <?php
        if (mfn_opts_get('responsive')) {
            if (mfn_opts_get('responsive-zoom')) {
                echo '<meta name="viewport" content="width=device-width, initial-scale=1" />';
            } else {
                echo '<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />';
            }
        }
    ?>

    <?php do_action('wp_seo'); ?>

    <link rel="shortcut icon" href="<?php echo esc_url(mfn_opts_get('favicon-img', get_theme_file_uri('/images/favicon.ico'))); ?>" type="image/x-icon" />

    <?php wp_head();?>

    </head>

    <?php
        $customID = mfn_opts_get('error404-page');
        $body_class = '';
        if ($customID) {
            $body_class .= 'custom-404';
        }
    ?>




    <body <?php body_class($body_class); ?>>


        <?php if ($customID): ?>
    <?php
        get_header();
    ?>

            <div id="Content">
                <div class="content_wrapper clearfix">

                    <div class="sections_group">
                        <?php mfn_builder_print($customID, true); ?>
                    </div>

                    <?php get_sidebar(); ?>

                </div>
            </div>

        <?php else: ?>

            <div id="Error_404">
                <div class="container">
                    <div class="column one">

                        <div class="error_pic">
                            <i class="<?php echo esc_attr(mfn_opts_get('error404-icon', 'icon-traffic-cone')); ?>"></i>
                        </div>

                        <div class="error_desk">
                            <h2><?php echo esc_html($translate['404-title']); ?></h2>
                            <h4><?php echo esc_html($translate['404-subtitle']); ?></h4>
                            <p><span class="check"><?php echo wp_kses_post($translate['404-text']); ?></span> <a class="button button_filled" href="<?php echo esc_url(site_url()); ?>"><?php echo esc_html($translate['404-btn']); ?></a></p>
                        </div>

                    </div>
                </div>
            </div>

        <?php endif; ?>

        <?php wp_footer(); ?>

    </body>
    </html>

    I did create a custom page to use for the 404 page and selected to use it as the 404 page.
  • Sorry, your problem is not related with the "mfn_opts_show()" - I didn't read the whole error at the beginning.

    To solve your problem, you have to change the old function 'mfn_builder_print' to 'Mfn_Builder_Front'.
    See screen:

    Change the red rectangle to green rectangle, code below:

    $mfn_builder = new Mfn_Builder_Front($customID, true);
    $mfn_builder->show();
    Thanks
  • Thank you so much! That worked.
Sign In or Register to comment.