I am trying to add a shortcode to my theme file and when I do it, I get this on the front end:
Warning: strpos() expects parameter 1 to be string, array given in /home2/wafg440adhss/public_html/wp-includes/shortcodes.php on line 205
Warning: preg_match_all() expects parameter 2 to be string, array given in /home2/wafg440adhss/public_html/wp-includes/shortcodes.php on line 213
Warning: array_intersect(): Argument #2 is not an array in /home2/wafg440adhss/public_html/wp-includes/shortcodes.php on line 214
This is the code I used in my theme file:
<?php echo do_shortcode([‘avatar_upload’]); ?>
This code is placed in my form-edit-account.php file within my theme which is in wp-content/themes/mytheme/woocommerce/myaccount folder. I figured that the place to put the code because when I am on the "my-account.php" generated page by WooCommerce, my theme makes a navigation and a page called "account details" that shows on the my-account.php and ultimate ends up being mydomain.com/my-account/edit-account when viewing live. Low and behold, I was right and it shows exactly where I want it to....but it shows the error!
The shortcode I am trying to pull is from the WP User Avatar plugin (free version, can be downloaded from the Wordpress plugins, add new and searching for it) so users can upload their own photo. The plugin says to use the following code to add it to a theme:
<?php do_action('edit_user_avatar', $current_user); ?>
but when I use that code, there is nothing to submit and save the avatar. When I use the shortcode on a page, it works perfectly and allows me to submit and save the avatar, but it can only be placed at the end of my woocommerce shortcode on the my-account page and it doesn't fall under the "account details" navigation and I dont likee it there. So since the shortcode funtions, I want to try to add the shortcode to the theme file vs the given php code, but I get that error.