wordpress - unexpected T_FUNCTION with php 5.2.17 but fine on localhost and php 5.3.10 -


i"m getting unexpected t_function php error after uploading wordpress files server running php version 5.2.17.

the theme works fine on localhost (with mamp) , there no errors on own server runs php version 5.3.10.

what can wrong or can done solve error?

this line causes error:

add_action('init', function() use($name, $args) {    

and entire functions.php file looks this:

<?php   /* add post type */ function add_post_type($name, $args = array() ) {        if ( !isset($name) ) return;      $name = strtolower(str_replace(' ', '_', $name));      add_action('init', function() use($name, $args) {            $args = array_merge(             array(                 'label' => 'members ' . ucwords($name) . '',                 'labels' => array('add_new_item' => "add new $name"),                 'singular_name' => $name,                 'public' => true,                 'supports' => array('title', 'editor', 'comments'),             ),             $args         );          register_post_type( $name, $args);     }); }   add_post_type('netherlands', array(     'supports' => array('title', 'editor', 'thumbnail', 'comments') ));   add_post_type('belgium', array(     'supports' => array('title', 'editor', 'thumbnail', 'comments') ));      add_post_type('germany', array(     'supports' => array('title', 'editor', 'thumbnail', 'comments') ));      add_post_type('france', array(     'supports' => array('title', 'editor', 'thumbnail', 'comments') ));      add_post_type('united-kingdom', array(     'supports' => array('title', 'editor', 'thumbnail', 'comments') ));      add_post_type('ireland', array(     'supports' => array('title', 'editor', 'thumbnail', 'comments') ));      add_post_type('spain', array(     'supports' => array('title', 'editor', 'thumbnail', 'comments') ));      add_post_type('portugal', array(     'supports' => array('title', 'editor', 'thumbnail', 'comments') ));      add_post_type('italy', array(     'supports' => array('title', 'editor', 'thumbnail', 'comments') )); 

i'm new php , use wordpress theming. appreciated.

you cannot have anonymous functions in php less 5.3

rework code not involve anonymous functions , should work on older server.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -