Solved

Wordpress error: strips() expects parameter 1 to be string... What's the mean and how do I fix it?

Posted on 2016-09-10
7
66 Views
Last Modified: 2016-09-16
Here’s what’s going on:

I’m the webmaster for our local Rotary who sponsors a 5k. I’m a PHP developer by trade and, but I’m by no means a WordPress ninja.

Recently, an automatic upgrade was done to our server which made certain parts of our antiquated Enfold theme obsolete. I purchased a new theme and installed the “theme only” content into the “themes” directory.

Immediately, I saw a big difference in terms of the front page as the rotating carousel is now back so we’re cooking with grease. However, I still have these errors and I don’t know what they mean or how to fix them. They’re all coming from the header.php file in the child directory.

Warning: strpos() expects parameter 1 to be string, array given in /home4/grey5k/public_html/wp-content/themes/greyghost5k_child/header.php on line 165

Warning: strpos() expects parameter 1 to be string, array given in /home4/grey5k/public_html/wp-content/themes/greyghost5k_child/header.php on line 287

Warning: strpos() expects parameter 1 to be string, array given in /home4/grey5k/public_html/wp-content/themes/greyghost5k_child/header.php on line 301

I’ve got the code for the header.php below. Any idea as to what these errors are and how to fix them?

<?php

	global $avia_config;



	$style 		= $avia_config['box_class'];

	$responsive	= avia_get_option('responsive_layout','responsive');

	$blank 		= isset($avia_config['template']) ? $avia_config['template'] : "";

	$headerS	= !$blank ? avia_header_setting() : "";

	$headerMenu = $responsive ? avia_get_option('header_menu','mobile_drop_down') : "";



?>



<!DOCTYPE html>

<html <?php language_attributes(); ?> class="<?php echo " html_$style ".$responsive." ".$headerS;?> ">

<head>

<meta charset="<?php bloginfo( 'charset' ); ?>" />

<?php



	/*

	 * outputs a rel=follow or nofollow tag to circumvent google duplicate content for archives

	 * located in framework/php/function-set-avia-frontend.php

	 */

	 if (function_exists('avia_set_follow')) { echo avia_set_follow(); }





	 /*

	 * outputs a favicon if defined

	 */

	 if (function_exists('avia_favicon'))    { echo avia_favicon(avia_get_option('favicon')); }



?>





<!-- page title, displayed in your browser bar -->

<title><?php if(function_exists('avia_set_title_tag')) { echo avia_set_title_tag(); } ?></title>





<!-- add feeds, pingback and stuff-->

<link rel="profile" href="http://gmpg.org/xfn/11" />

<link rel="alternate" type="application/rss+xml" title="<?php echo get_bloginfo('name'); ?> RSS2 Feed" href="<?php avia_option('feedburner',get_bloginfo('rss2_url')); ?>" />

<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />





<!-- mobile setting -->

<?php



if( strpos($responsive, 'responsive') !== false ) echo '<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">';



?>





<?php



	/* Always have wp_head() just before the closing </head>

	 * tag of your theme, or you will break many plugins, which

	 * generally use this hook to add elements to <head> such

	 * as styles, scripts, and meta tags.

	 */



	wp_head();

?>









</head>









<body id="top" <?php body_class($style." ".$avia_config['font_stack']." ".$blank); ?>>



	<div id='wrap_all'>



		<?php if(!$blank){ ?>



        <div id='header' class=' header_color <?php avia_is_dark_bg('header_color'); echo " ".$headerMenu; ?>'>



		<?php



		$social_args = array('outside'=>'ul', 'inside'=>'li', 'append' => '');



		//subheader, only display when the user chooses a social header

		if(strpos($headerS,'social_header') !== false)

		{

		?>

		<div id='header_meta' class='container_wrap container_wrap_meta'>



		      <div class='container'>

		      <?php

            		/*

            		*	display the themes social media icons, defined in the wordpress backend

            		*   the avia_social_media_icons function is located in includes/helper-social-media-php

            		*/



            		if(strpos($headerS,'bottom_nav_header') === false) avia_social_media_icons($social_args);



            		//display the small submenu

					echo "<div class='sub_menu'>";



					$args = array('theme_location'=>'avia2', 'fallback_cb' => '', 'container'=>'', 'echo' =>false);

					$nav  = wp_nav_menu($args);

					echo $nav;



					$phone = avia_get_option('phone');

					$phone_class = !empty($nav) ? "with_nav" : "";

					if($phone) echo "<div class='phone-info {$phone_class}'><span>{$phone}</span></div>";





					/*

					* Hook that can be used for plugins and theme extensions (currently: the wpml language selector)

					*/

		      		do_action('avia_meta_header');



					echo "</div>";



            	?>

		      </div>

		</div>



		<?php } ?>

		

		

					

		<div  id='header_main' class='container_wrap container_wrap_logo'>

				

				<?php 

				/*

				* Hook that can be used for plugins and theme extensions (currently:  the woocommerce shopping cart)

				*/

				do_action('ava_main_header'); 

				

				?>

				

				<div class='container'>

				

					<?php 

					/*

					*	display the theme logo by checking if the default logo was overwritten in the backend.

					*   the function is located at framework/php/function-set-avia-frontend-functions.php in case you need to edit the output

					*/

					echo avia_logo(AVIA_BASE_URL.'images/layout/logo.png', false, 'strong');

					

					

						if(strpos($headerS,'social_header') !== false && strpos($headerS,'bottom_nav_header') !== false) avia_social_media_icons($social_args);

						

					/*

					*	display the main navigation menu

					*   modify the output in your wordpress admin backend at appearance->menus

					*/	

						$extraOpen = $extraClose = "";

						if(strpos($headerS,'bottom_nav_header') !== false){ $extraClose = "</div></div><div id='header_main_alternate' class='container_wrap'><div class='container'>";  }

					 

					 	echo $extraClose;

    					echo "<div class='main_menu' data-selectname='".__('Select a page','avia_framework')."'>";

    					$args = array('theme_location'=>'avia', 'fallback_cb' => 'avia_fallback_menu', 'walker' => new avia_responsive_mega_menu());

    					wp_nav_menu($args); 

    					

    					echo "</div>";

    					

    					/*

						* Hook that can be used for plugins and theme extensions

						*/

    					do_action('ava_after_main_menu');

				    ?>

				<!-- end container-->

				</div>

		<span class="anniversary">8<span class="sub">th</span> Annual</span>

                <span class="dates">October 1, 2016</span>

                <a href="https://greyghost.itsyourrace.com/register/" target="_blank" class="registerButton"><!-- <img src="images/pm12/stopwatch.png" /> --> Register Now</a>

				</div>

				

		

		<!-- end container_wrap-->		

		</div>

		

		<div class='header_bg'></div>



			

	<!-- end header -->		

    </div>



	<?php } //end blank check ?>	

	<div id='main'>	

		

Open in new window


The URL for the site, by the way, is http://greyghost5k.com
0
Comment
Question by:brucegust
  • 4
  • 2
7 Comments
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 41792949
All of the lines of code seem to reference $headerS.  $headerS is defined on line 13.  I would add var_dump($headerS) immediately after line 13 so you can show us what is in that variable.
0
 

Author Comment

by:brucegust
ID: 41792951
Hey, Ray!

I've got it on the site now. Here's what it says:

array(30) { ["header_position"]=> string(10) "header_top" ["header_layout"]=> string(20) "logo_left menu_right" ["header_size"]=> string(5) "large" ["header_custom_size"]=> string(0) "" ["header_sticky"]=> string(13) "header_sticky" ["header_shrinking"]=> string(16) "header_shrinking" ["header_title_bar"]=> string(16) "hidden_title_bar" ["header_social"]=> string(36) "icon_active_left extra_header_active" ["header_unstick_top"]=> string(0) "" ["header_secondary_menu"]=> string(35) "secondary_right extra_header_active" ["header_stretch"]=> string(0) "" ["header_phone_active"]=> string(0) "" ["header_replacement_logo"]=> string(0) "" ["header_replacement_menu"]=> string(0) "" ["header_mobile_behavior"]=> string(0) "" ["header_searchicon"]=> string(26) "header_searchicon_disabled" ["header_mobile_activation"]=> string(17) "mobile_menu_phone" ["phone"]=> string(0) "" ["sidebarmenu_sticky"]=> string(18) "conditional_sticky" ["layout_align_content"]=> string(20) "content_align_center" ["sidebarmenu_widgets"]=> string(0) "" ["sidebarmenu_social"]=> string(8) "disabled" ["header_menu_border"]=> string(0) "" ["header_style"]=> string(0) "" ["blog_global_style"]=> string(0) "" ["header_scroll_offset"]=> int(116) ["header_transparency"]=> string(0) "" ["header_class"]=> string(188) " av_header_top av_logo_left av_menu_right av_large av_header_sticky av_header_shrinking av_mobile_menu_phone av_header_searchicon_disabled av_bottom_nav_disabled av_header_border_disabled" ["header_topbar"]=> string(20) "header_topbar_active" ["bottom_menu"]=> bool(false) }

Open in new window

0
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 400 total points
ID: 41792965
I should have probably mentioned that those outputs are much easier to read if you echo '<pre>'; right before var_dump().  Or use "view source."  Since it's an array of strings, is there an array key you want to use to find the string you want to use in strpos()?
array(30) {
["header_position"]=> string(10) "header_top"
["header_layout"]=> string(20) "logo_left menu_right"
["header_size"]=> string(5) "large"
["header_custom_size"]=> string(0) ""
["header_sticky"]=> string(13) "header_sticky"
["header_shrinking"]=> string(16) "header_shrinking"
["header_title_bar"]=> string(16) "hidden_title_bar"
["header_social"]=> string(36) "icon_active_left extra_header_active"
["header_unstick_top"]=> string(0) ""
["header_secondary_menu"]=> string(35) "secondary_right extra_header_active"
["header_stretch"]=> string(0) ""
["header_phone_active"]=> string(0) ""
["header_replacement_logo"]=> string(0) ""
["header_replacement_menu"]=> string(0) ""
["header_mobile_behavior"]=> string(0) ""
["header_searchicon"]=> string(26) "header_searchicon_disabled"
["header_mobile_activation"]=> string(17) "mobile_menu_phone"
["phone"]=> string(0) ""
["sidebarmenu_sticky"]=> string(18) "conditional_sticky"
["layout_align_content"]=> string(20) "content_align_center"
["sidebarmenu_widgets"]=> string(0) ""
["sidebarmenu_social"]=> string(8) "disabled"
["header_menu_border"]=> string(0) ""
["header_style"]=> string(0) ""
["blog_global_style"]=> string(0) ""
["header_scroll_offset"]=> int(116)
["header_transparency"]=> string(0) ""
["header_class"]=> string(188) " av_header_top av_logo_left av_menu_right av_large av_header_sticky av_header_shrinking av_mobile_menu_phone av_header_searchicon_disabled av_bottom_nav_disabled av_header_border_disabled"
["header_topbar"]=> string(20) "header_topbar_active"
["bottom_menu"]=> bool(false) 
}

Open in new window

0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:brucegust
ID: 41792966
Short answer: I don't know and I know that doesn't help you. I've reached out to the manufacturer. Hopefully they'll see what constitutes the deal breaker, but I'll tell you this: The starting point for most of these problems, based what I've seen online, has always been to deactivate the plugins. With your insight, I think I'm going to be able to get a much more streamlined / effective response.

Stand by...
0
 
LVL 28

Assisted Solution

by:chilternPC
chilternPC earned 100 total points
ID: 41794260
the warning could be normal.  yes I know in the ideal world there would be no warnings.

but you may be "seeing" the warning because you have the parameter "WP_DEBUG" set to true in your  wp-config.php file which is in the wordpress root folder

if so,  edit the file and set it to FALSE:   i.e.

define('WP_DEBUG', false);
0
 

Author Comment

by:brucegust
ID: 41794593
Thanks, chiltern, but it's set to FALSE, currently.
0
 

Author Comment

by:brucegust
ID: 41801776
Gentlemen,

I've decided that there's more to this issue than the warnings and discrepancies that I've notated. After kicking the tires for a bit, I've decided to start from scratch and not worry about the Wordpress dynamic for now. I think by starting with a clean slate, I'm saving both the client and myself some grief.

For anyone else who happens upon this thread, don't be put off by the issues I was having. I think between the update of the server and an antiquated theme, anything less than a clean slate is an exercise in futility. Backup your database and your files and update things from the ground up, rather than trying to piece meal things incrementally. A greater mind than my own may be able to pull it off, but the devil is in the details and sometimes those things aren't always as obvious as they should be.
1

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

In order to have all security and back ups taken care of, WordPress users can sign up for services with WP Engine.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now