Welcome! To use this support forum, please Login or Join Today!

   

Woocommerce - Localhost

{name}
RankRankRank

Total Posts: 99

Joined 2012-11-23

PM

 

Hi, I’m getting this error message with woocommerce, I’m running the site in my localhost environment.

Warning: call_user_func_array() expects parameter 1 to be a valid callback, no array or string given in C:\wamp64\www\basewebsite\wp-includes\plugin.php on line 235
Call Stack
# Time Memory Function Location
1 0.0003 239280 {main}( ) ...\index.php:0
2 0.0004 242384 require( ‘C:\wamp64\www\basewebsite\wp-blog-header.php’ ) ...\index.php:17
3 0.4293 45487048 require_once( ‘C:\wamp64\www\basewebsite\wp-includes\template-loader.php’ ) ...\wp-blog-header.php:19
4 0.4330 45652384 include( ‘C:\wamp64\www\basewebsite\wp-content\themes\mobius-child\woocommerce.php’ ) ...\template-loader.php:75
5 0.4781 45411176 woocommerce_content( ) ...\woocommerce.php:13
6 0.4781 45411320 apply_filters( ) ...\wc-template-functions.php:364
7 0.4782 45413072 call_user_func_array:{C:\wamp64\www\basewebsite\wp-includes\plugin.php:235} ( ) ...\plugin.php:235

{name}
RankRankRank

Total Posts: 99

Joined 2012-11-23

PM

 

BUMP

{name}
RankRankRankRank

Total Posts: 3667

Joined 2011-04-27

PM

 

The Call Stack just shows the order in which the files were processed, however this is a development warning message related to WooCommerce - not an error. It looks like you have your local dev environment error reporting settings up too high.

Unless you’re debugging something, you can suppress these messages in wp-config.php:

define( 'WP_DEBUG', false );
define( 'WP_DEBUG_LOG', false ); // Stored in wp-content/debug.log
define( 'WP_DEBUG_DISPLAY', false );
{name}
RankRankRank

Total Posts: 99

Joined 2012-11-23

PM

 

Tried that with no luck, when using other themes there’s no errors.

{name}
RankRankRankRank

Total Posts: 3667

Joined 2011-04-27

PM

 

If you disabled wp_debug and are still seeing warning messages, then you probably have it re-declared as true further down the file or your PHP settings are up too high.

If you can provide the WP version, WC version and how (which page) to reproduce the error, I can try but I was unable to on WP Version 4.5.3 with WC Version: 2.5.5

{name}
RankRankRank

Total Posts: 99

Joined 2012-11-23

PM

 

WP Version 4.5.3 WC Version 2.6.2 php5.4.12 I’ve uninstalled and reinstalled Wampserver these specs have also tried it on Xampp and it stall has the error.

This is my wp-config.php

<?php
/**
 * The base configuration for WordPress
 *
 * The wp-config.php creation script uses this file during the
 * installation. You don't have to use the web site, you can
 * copy this file to "wp-config.php" and fill in the values.
 *
 * This file contains the following configurations:
 *
 * * MySQL settings
 * * Secret keys
 * * Database table prefix
 * * ABSPATH
 *
 * @link https://codex.wordpress.org/Editing_wp-config.php
 *
 * @package WordPress
 */

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'basesite');

/** MySQL database username */
define('DB_USER', 'root');

/** MySQL database password */
define('DB_PASSWORD', '');

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8mb4');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

/**#@+
 * Authentication Unique Keys and Salts.
 *
 * Change these to different unique phrases!
 * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
 * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
 *
 * @since 2.6.0
 */
define('AUTH_KEY',         'BAGZ0nrGv]ub=QpZyMvAe>7ca|*XI>y05{Y)d]/xh*r/nun?)<MUuw<cFRo$t74y');
define('SECURE_AUTH_KEY',  'K{0xq#8]7!4{&T-+`eCH=4;Uhd3U=U0OUkV+|a8^vb]me=6<jS;>bs9{tkT)/>{<');
define('LOGGED_IN_KEY',    'HAm^s1~oHM_L8nNiAzND-1yf`Pl1f:JYI/W}8|3GEp|n.XK3_x!wZE?Ybv[PcO');
define('NONCE_KEY',        '>X7h=B6:5r%D)wh4t,-;G0CCO6BMJ?sWsY/T}11.e|?Vs%%^[AAy[s-5l[B-QHD3');
define('AUTH_SALT',        ':^sK_SP>eBSK_3  ]-zctir*pd(qB.WZK1qN+%JC2U5;t*6j?lkl3$*,DU[-6UMA');
define('SECURE_AUTH_SALT', 'LkNK9^^I`:648H-S2Z+@SwDQ6^RLRwQV#/KcGezEF&FR;=#rw29b!n1:}nse}sSFs');
define('LOGGED_IN_SALT',   '6<_Y /rmfW`Os0NV|]da!3hB3`XlQ8avB<);I 9(si[U+VyRnK0%b>Lq[[!G1Tth');
define('NONCE_SALT',       'T{OVo<3&3@VNn@W4N>Z!uBTM TD->%oMi(vEA<txpKO<%zIe7gWQCLg-P<X$C1(L');

/**#@-*/

/**
 * WordPress Database Table prefix.
 *
 * You can have multiple installations in one database if you give each
 * a unique prefix. Only numbers, letters, and underscores please!
 */
$table_prefix  = 'wp_';

/**
 * For developers: WordPress debugging mode.
 *
 * Change this to true to enable the display of notices during development.
 * It is strongly recommended that plugin and theme developers use WP_DEBUG
 * in their development environments.
 *
 * For information on other constants that can be used for debugging,
 * visit the Codex.
 *
 * @link https://codex.wordpress.org/Debugging_in_WordPress
 */
define( 'WP_DEBUG', false );
define( 'WP_DEBUG_LOG', false ); // Stored in wp-content/debug.log
define( 'WP_DEBUG_DISPLAY', false );

/* That's all, stop editing! Happy blogging. */

/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
 define('ABSPATH', dirname(__FILE__) . '/');

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');

This error only comes up on your theme, when using other themes it’s fine.

 

{name}
RankRankRank

Total Posts: 99

Joined 2012-11-23

PM

 

I tried the main theme, not the child theme! and works with no errors, I also added the two compatibility woocommerce files to the main theme, but when I add this to the bottom of the functions file I get the same error.

/*—————————————————————————————————————————-*/
// WooCommerce Compatibility
/*—————————————————————————————————————————-*/

// Add Theme Support for WC
add_theme_support( 'woocommerce' );

// Wrap WC in native theme functions
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);

add_action('woocommerce_before_main_content', 'st_content_wrap', 10);
add_action('woocommerce_after_main_content', 'st_content_wrap_close', 10);



// Disable WC styles

function st_dequeue_woo_styles( $enqueue_styles ) {
 unset( $enqueue_styles['woocommerce-general'] );
 return $enqueue_styles;
}
add_filter( 'woocommerce_enqueue_styles', 'st_dequeue_woo_styles' );



// Add custom theme styles to WC

function st_woocommmerce_styles() {
    wp_register_style('woocommerce', get_bloginfo('stylesheet_directory').'/woocommerce.css', array('style'), $version, 'screen, projection');
    wp_enqueue_style( 'woocommerce');
}
add_filter ('add_stylesheets','st_woocommmerce_styles');



// Adds a unique WooCommerce 'Shop' widget location

function st_woocommerce_sidebar() {
    register_sidebar( array(
        'name' => __( 'Shop', 'smpl' ),
        'id' => 'shop',
        'description' => __( 'WooCommerce Sidebar', 'smpl' ),
        'before_widget' => '<div id="%1$s" class="widget-container %2$s">',
        'after_widget' => '</div>',
        'before_title' => '<h3 class="widget-title">',
        'after_title' => '</h3>',
        )
    );
}
add_action( 'init', 'st_woocommerce_sidebar' );


// 3 products per row

function loop_columns() {
 return 3;
}
add_filter('loop_shop_columns', 'loop_columns');

/**
* Optional:
* If you need to change the content ans sidebar widths for any reason, uncomment the functions below:
*/

// Set the column width
// function woocommerce_filter_content_width() {
//  if ( is_shop() || is_woocommerce() ) {
//   return 'eleven';
//  }
// }
// Set the sidebar width
// function woocommerce_filter_sidebar_width() {
//  if ( is_shop() || is_woocommerce() ) {
//   return 'five';
//  }
// }
// Apply the content width
// function set_woocommerce_filter_content_width() {
//  if ( is_shop() || is_woocommerce() ) {
//   add_filter('st_filter_content_width', 'woocommerce_filter_content_width');
//  }
// }
// Apply the sidebar width
// function set_woocommerce_filter_sidebar_width() {
//  if ( is_shop() || is_woocommerce() ) {
//   add_filter('st_sidebar_width', 'woocommerce_filter_sidebar_width');
//  }
// }
// add_action('wp', 'set_woocommerce_filter_content_width');
// add_action('wp', 'set_woocommerce_filter_sidebar_width');
// Removes showing results
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );

remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
add_filter('woocommerce_show_page_title',false);
// Display 9 products per page. Goes in functions.php
add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 9;' ), 20 );
remove_filter( 'the_content', 'wpautop' );
add_filter( 'the_content', 'wpautop' , 99);
add_filter( 'the_content', 'shortcode_unautop',100 ); 
function woocommerce_remove_related_products(){
    remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20);
}
add_action('woocommerce_after_single_product_summary', 'woocommerce_remove_related_products');
function st_top_bar() {
 echo '<div id="wrap">';
 if ( is_active_sidebar( 'top_bar' ) ) {
  echo '<div id="st_topbar">';
  echo '<div class="container">';
  echo '<div class="sixteen columns">';
  dynamic_sidebar('Top Bar');
  // begin custom social menu
  echo '&lt;style type="text/css"&gt;.social_menu {list-style:none;text-align:right;margin:0;padding-top:10px;}.social_menu li {display:inline;padding:0px 3px;}&lt;/style&gt;';
  echo '<ul class="social_menu">';
  echo '<li><a href="#"><img src="'.get_stylesheet_directory_uri().'/images/icons/widget_facebook.png"/></a></li>';
  echo '<li><a href="#"><img src="'.get_stylesheet_directory_uri().'/images/icons/widget_twitter.png"/></a></li>';
  echo '<li><a href="#"><img src="'.get_stylesheet_directory_uri().'/images/icons/youtube.png"/></a></li>';
  echo '<li><a href="#"><img src="'.get_stylesheet_directory_uri().'/images/icons/widget_linkedin.png"/></a></li>';
  echo '</ul>';
  // end custom social me

			

			

			

		
{name}
RankRankRank

Total Posts: 99

Joined 2012-11-23

PM

 

SOLVED

add_filter(‘woocommerce_show_page_title’,false);

SHOULD HAVE BEEN

add_filter( ‘woocommerce_show_page_title’, ‘__return_false’ );

{name}
RankRankRankRank

Total Posts: 3667

Joined 2011-04-27

PM

 

Was that something you added? Should I correct it? I don’t see it in the original:
https://github.com/simplethemes/mobius-woocommerce/blob/master/functions.php

That’s correct though,

_return_false 

is a self-contained function variable. I’ve been snagged by that one before as well.
https://codex.wordpress.org/Function_Reference/_return_false

{name}
RankRankRank

Total Posts: 99

Joined 2012-11-23

PM

 

I changed the code when the site was on a live server which worked, The error highlighted itself when running on my local wampserver setup.

This is what I’m running now! For anyone wanting to know

// Display 9 products per page. Goes in functions.php
add_filter( ‘loop_shop_per_page’, create_function( ‘$cols’, ‘return 9;’ ), 20 );
ADDS 9 PRODUCTS PER PAGE NOT 10

// Removes showing results
remove_action( ‘woocommerce_before_shop_loop’, ‘woocommerce_result_count’, 20 );
REMOVES NUMBER OF ITEM RESELTS TOP LEFT

remove_action( ‘woocommerce_before_shop_loop’, ‘woocommerce_catalog_ordering’, 30 );
REMOVES PRODUCT ORDERING TOP RIGHT

add_filter( ‘woocommerce_show_page_title’, ‘__return_false’ );
REMOVES SHOP FROM STORE PAGE TITLE

ADD IT TO THE BOTTOM OF YOUR functions.php FILE LOCATED IN THE MOBIUS CHILD FOLDER
COMMENT OUT WHAT YOU DON’T WANT.

ADD CODE LIKE SO

// Display 9 products per page. Goes in functions.php
add_filter( ‘loop_shop_per_page’, create_function( ‘$cols’, ‘return 9;’ ), 20 );
// Removes showing results
remove_action( ‘woocommerce_before_shop_loop’, ‘woocommerce_result_count’, 20 );
remove_action( ‘woocommerce_before_shop_loop’, ‘woocommerce_catalog_ordering’, 30 );
add_filter( ‘woocommerce_show_page_title’, ‘__return_false’ );

Thanks Casey, The Mobius theme still beats all other Wordpress themes hands down.