• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2662

Original Genesis Tutorials & 5000+ Guaranteed Code

Snippets

  • Support
  • Newsletter
  • Videos
  • Log in

Premium Member? - Request custom code

Bug Fix – Genesis Featured Content Widget – Fatal error: Call to undefined function genesis_get_option()

The Genesis sandbox featured content widget ( plugin ) by Travis Smith can only be activated when Genesis is active. However, if you have already successfully activated the plugin, after activating Genesis, you can cause a fatal error if you change to a different parent theme like Twenty Sixteen.

To fix this, the plugin needs an additional check added on line 87 of genesis-featured-content-widget/gs-featured-content-widget.php

/** require Genesis */
if ( ! function_exists( 'genesis_get_option' ) ) {
    return;
}

Now the entire function will look like this:

add_action( 'widgets_init', 'gsfc_widgets_init', 50 );
/**
 * Register GSFC for use in the Genesis theme.
 *
 * @since 1.1.0
 */
function gsfc_widgets_init() {
    if ( class_exists( 'Premise_Base' ) && !is_admin() ) {
        return;
    }
    
    /** require Genesis */
	if ( ! function_exists( 'genesis_get_option' ) ) {
		return;
	}
		
    $gfwa = genesis_get_option( 'gsfc_gfwa' );
    if ( class_exists( 'Genesis_Featured_Widget_Amplified' ) && $gfwa ) {
        unregister_widget( 'Genesis_Featured_Widget_Amplified' );
    }
    register_widget( 'GS_Featured_Content' );
}

Otherwise, you’ll get the following fatal error message:

Fatal error: Call to undefined function genesis_get_option() in genesis-featured-content-widget/gs-featured-content-widget.php on line 92

fatal-error

This bug fix relates to resolving this question on the StudioPress community forums.

You can download the latest version of the Genesis Sandbox Featured Content Widget from WordPress.org

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

PHP Code

template_include

get_body_class

if else

array

class_exists

foreach

sprintf

add_action

printf

variable

Advertise · WPEngine · Genesis · Log in

  • How Premium Membership Works
  • Sign Up
  • Support
  • Subscription Details/Invoice
  • Tagged Tutorials
  • Access-Download Problems