WP Fab

Fabricating Fabulous WordPress Websites

  • Home
  • About
  • Projects
  • Contact

Fix Simple Sidebars “Illegal String Offset” error

by Laura 4 Comments   Jan 17th, 2016

After a recent WordPress and Genesis framework update on one of my sites, my site threw these errors:

Warning: Illegal string offset 'name' in /home/glutenfr/public_html/wp-content/plugins/genesis-simple-sidebars/plugin.php on line 105

Warning: Illegal string offset 'description' in /home/glutenfr/public_html/wp-content/plugins/genesis-simple-sidebars/plugin.php on line 107

If you’re experiencing the same issue, relax! The solutions is simple and relatively painless.

You’ll need to update the plugin.php file that is in the simple sidebar folder on your server. You’ll find it under wp-content/plugins/genesis-simple-sidebars.

The simplest way to correct the code is to just upload and overwrite the existing file with the corrected one. Here’s how:

1.Copy the contents of the php file at the end of this post into a text file. Save the file as “plugin.php”

2.Using FTP, upload your file to the genesis-simple-sidebars folder. Make sure to overwrite existing file.

Alternatively, you can navigate to the current plugin.php file on your server using FTP or via cPanel if you have it, open the current file, and replace all the code with the code below.

Whichever way you prefer to work, just make sure to replace the existing plugin.php file with the corrected code below.

Here is the file you’ll need:

<?php
/*
Plugin Name: Genesis Simple Sidebars
Plugin URI: http://www.studiopress.com/plugins/simple-sidebars
Description: Genesis Simple Sidebars allows you to easily create and use new sidebar widget areas.
Author: Nathan Rice
Author URI: http://www.nathanrice.net/

Text Domain: ss
Domain Path: /languages/

Version: 2.0.1

License: GNU General Public License v2.0 (or later)
License URI: http://www.opensource.org/licenses/gpl-license.php
*/

/** Define our constants */
define( 'SS_SETTINGS_FIELD', 'ss-settings' );
define( 'SS_PLUGIN_DIR', dirname( __FILE__ ) );

register_activation_hook( __FILE__, 'ss_activation_check' );
/**
 * Activation hook callback.
 *
 * This functions runs when the plugin is activated. It checks to make sure the user is running
 * a minimum Genesis version, so there are no conflicts or fatal errors.
 *
 * @since 0.9.0
 */
function ss_activation_check() {

	if ( ! defined( 'PARENT_THEME_VERSION' ) || ! version_compare( PARENT_THEME_VERSION, '2.0.0', '>=' ) )
		ss_deactivate( '2.0.0', '3.6' );

}

/**
 * Deactivate Simple Sidebars.
 *
 * This function deactivates Simple Sidebars.
 *
 * @since 1.0.0
 */
function ss_deactivate( $genesis_version = '1.8.0', $wp_version = '3.3' ) {

	deactivate_plugins( plugin_basename( __FILE__ ) );
	wp_die( sprintf( __( 'Sorry, you cannot run Simple Sidebars without WordPress %s and <a href="%s">Genesis %s</a>, or greater.', 'ss' ), $wp_version, 'http://my.studiopress.com/?download_id=91046d629e74d525b3f2978e404e7ffa', $genesis_version ) );

}

add_action( 'genesis_init', 'ss_genesis_init', 12 );
/**
 * Plugin initialization.
 *
 * Initialize the plugin, set the constants, hook callbacks to actions, and include the plugin library.
 *
 * @since 0.9.0
 */
function ss_genesis_init() {

	//* Deactivate if not running Genesis 1.8.0 or greater
	if ( ! class_exists( 'Genesis_Admin_Boxes' ) )
		add_action( 'admin_init', 'ss_deactivate', 10, 0 );

	//* Load translations
	load_plugin_textdomain( 'ss', false, 'genesis-simple-sidebars/languages' );

	//* required hooks
	add_action( 'get_header', 'ss_sidebars_init' );
	add_action( 'widgets_init', 'ss_register_sidebars' );

	//* The rest is admin stuff, so load only if we're in the admin area
	if ( ! is_admin() )
		return;

	//* Include admin files
	require_once( SS_PLUGIN_DIR . '/includes/admin.php' );
	require_once( SS_PLUGIN_DIR . '/includes/inpost.php' );
	require_once( SS_PLUGIN_DIR . '/includes/term.php' );

	//* let the child theme hook the genesis_simple_sidebars_taxonomies filter before hooking term edit
	add_action( 'init', 'ss_term_edit_init' );

}
/**
 * Register widget areas.
 *
 * This function registers the created sidebars as widget areas
 *
 * @since 0.9.0
 */
function ss_register_sidebars() {

	$_sidebars = stripslashes_deep( get_option( SS_SETTINGS_FIELD ) );

	//* If no sidebars have been created, do nothing
	if ( ! $_sidebars )
		return;

	//* Cycle through created sidebars, register them as widget areas
	foreach ( (array) $_sidebars as $id => $info ) {
		
		if( isset( $info['name'] ) ){
		
			genesis_register_sidebar( array(
				'name'        => esc_html( $info['name'] ),
				'id'          => $id,
				'description' => esc_html( $info['description'] ),
				'editable'    => 1,
			) );
		
		}

	}

}

/**
 * Use custom sidebars.
 *
 * Remove the default sidebars, run some conditional logic,
 * use alternate sidebars if necessary, else fallback on default sidebars.
 *
 * @since 0.9.0
 */
function ss_sidebars_init() {

	remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
	remove_action( 'genesis_sidebar_alt', 'genesis_do_sidebar_alt' );
	add_action( 'genesis_sidebar', 'ss_do_sidebar' );
	add_action( 'genesis_sidebar_alt', 'ss_do_sidebar_alt' );

}

/**
 * Display primary sidebar.
 *
 * Display custom sidebar if one exists, else display default primary sidebar.
 *
 * @since 0.9.0
 */
function ss_do_sidebar() {

	if ( ! ss_do_one_sidebar( '_ss_sidebar' ) )
		genesis_do_sidebar();

}

/**
 * Display secondary sidebar.
 *
 * Display custom sidebar if one exists, else display default secondary sidebar.
 *
 * @since 0.9.0
 */
function ss_do_sidebar_alt() {

	if ( ! ss_do_one_sidebar( '_ss_sidebar_alt' ) )
		genesis_do_sidebar_alt();

}

/**
 * Sidebar widget area output.
 *
 * Helper function to show widgets in a particular sidebar.
 *
 * @param string $sidebar_key sidebar id you wish to output.
 *
 * @since 0.9.0
 *
 */
function ss_do_one_sidebar( $sidebar_key = '_ss_sidebar' ) {

	static $taxonomies = null;

	if ( is_singular() && $sidebar_key = genesis_get_custom_field( $sidebar_key ) ) {
		if ( dynamic_sidebar( $sidebar_key ) ) return true;
	}

	if ( is_category() ) {
		$term = get_term( get_query_var( 'cat' ), 'category' );
		if ( isset( $term->meta[$sidebar_key] ) && dynamic_sidebar( $term->meta[$sidebar_key] ) ) return true;
	}

	if ( is_tag() ) {
		$term = get_term( get_query_var( 'tag_id' ), 'post_tag' );
		if ( isset( $term->meta[$sidebar_key] ) && dynamic_sidebar( $term->meta[$sidebar_key] ) ) return true;
	}

	if ( is_tax() ) {
		if ( null === $taxonomies )
			$taxonomies = ss_get_taxonomies();

		foreach ( $taxonomies as $tax ) {
			if ( 'post_tag' == $tax || 'category' == $tax )
				continue;

			if ( is_tax( $tax ) ) {
				$obj = get_queried_object();
				$term = get_term( $obj->term_id, $tax );
				if ( isset( $term->meta[$sidebar_key] ) && dynamic_sidebar( $term->meta[$sidebar_key] ) ) return true;
				break;
			}
		}
	}

	return false;

}

/**
 * Return taxonomy ids.
 *
 * Helper function to return the array keys from a taxonomy query.
 *
 * @since 0.9.0
 */
function ss_get_taxonomies() {

	$taxonomies = get_taxonomies( array( 'show_ui' => true, 'public' => true ) );
	return apply_filters( 'genesis_simple_sidebars_taxonomies', array_keys( $taxonomies ) );

}

/**
 * Does this Genesis install have the 3 column layouts deactivated?
 *
 * This function checks to see if the Genesis install still has active 3 column layouts. Since
 * child themes and plugins can deregister layouts, we need to know if they have deregistered the 3 column layouts.
 *
 * @since 0.9.2
 */
function ss_has_3_column_layouts() {

	$_layouts = (array) genesis_get_layouts();
	$_layouts = array_keys( $_layouts );
	$_3_column = array_intersect( $_layouts, array( 'content-sidebar-sidebar', 'sidebar-content-sidebar', 'sidebar-sidebar-content' ) );

	return ! empty( $_3_column );

}

Filed Under: How To

Comments

  1. Mary Mangold says

    March 30, 2016 at 12:03 am

    THANK YOU SO MUCH FOR PROVIDING THIS SIMPLE FIX! I cannot thank you enough. I muddled around with a standard google search but all the results were OLD. so I put 2016 in front of the warning and VOILA!! You solved the problem for me. 🙂 #veryhappy

    Reply
    • Laura says

      April 19, 2016 at 10:30 am

      Thank you Mary! Glad to be of help!

      Reply
  2. Naveen Sharma says

    May 15, 2016 at 10:10 pm

    nice blog @Laura …inspired from it …

    Reply
  3. john says

    July 23, 2016 at 3:30 am

    thanks for file, i replace it. appreciate

    Reply

Leave your comment below Cancel reply

Your email address will not be published. Required fields are marked *

CAPTCHA
Refresh

*

Let’s Connect!

Follow Us on TwitterFollow Us on LinkedIn

Recent Posts

  • Fix Simple Sidebars “Illegal String Offset” error
  • Don’t be fooled by domain renewal letters
  • I love Lightning Base WordPress hosting
  • Genesis Changes: The Essential Guide for Genesis Framework Developers
  • Clean up weird characters in your WordPress posts
privacy policy ∣  disclosure ∣  terms