Notice: Only variables should be passed by reference in /home/bv5u96fbxm8x/public_html/wp-content/themes/123garden/option-tree/ot-loader.php on line 98
kindly provide me solution for this thanks!
$path = ltrim( end( @explode( get_template(), str_replace( '\\', '/', dirname( __FILE__ ) ) ) ), '/' );
define( 'OT_LANG_DIR', trailingslashit( trailingslashit( get_template_directory() ) . $path ) . trailingslashit( 'languages' ) . 'theme-mode' );
}
Notice: Only variables should be passed by reference in /home/bv5u96fbxm8x/public_html/wp-content/themes/123garden/option-tree/ot-loader.php on line 98
kindly provide me solution for this thanks!
$path = ltrim( end( @explode( get_template(), str_replace( '\\', '/', dirname( __FILE__ ) ) ) ), '/' );
define( 'OT_LANG_DIR', trailingslashit( trailingslashit( get_template_directory() ) . $path ) . trailingslashit( 'languages' ) . 'theme-mode' );
}
Share
Improve this question
edited Mar 17, 2020 at 11:18
Tanmay Patel
8111 gold badge7 silver badges11 bronze badges
asked Mar 17, 2020 at 10:34
Faisal ShafiqFaisal Shafiq
12 bronze badges
1 Answer
Reset to default 0I'd guess the problem is the end(), which accepts an array reference. Try saving the explode() result in a variable and passing that to end():
$path_components = @explode( get_template(), str_replace( '\\', '/', dirname( __FILE__ ) ) );
$path = ltrim( end( $path_components ), '/' );
define( 'OT_LANG_DIR', trailingslashit( trailingslashit( get_template_directory() ) . $path ) .
trailingslashit( 'languages' ) . 'theme-mode' );
Or there are plenty of other ways to get the last element of an array you could use instead of end().