php - Dynamically create callback functions in the loop in wordpress settings API -


i created wordpress setting page suppose add sub setting pages code same each new page , works fine.

than loop through sections , settings fields , concatenate name of subpage , strings in order create custom properties.

when loop through callbacks im having problem. since changing names of functions inside loop not possible in php wonder how that?

  function initialize(){          $mylist = get_option('listofmaps');         $mylist = explode(",", $mylist);          if(count($mylist)>1){           ($x = 0; $x < count($mylist)-1; $x++) {            $pagename = str_replace(" ","",$mylist[$x]);             add_settings_section(                     "googlemapssection",                             "google maps options section",                     $pagename."_google_maps_section",                            "maps".$pagename                                         );    .....     }    add_action("admin_init","initialize"); 

that part not work.

$mylist = get_option('listofmaps'); $mylist = explode(",", $mylist);  if(count($mylist)>1){     ($x = 0; $x < count($mylist)-1; $x++) {         $pagename = str_replace(" ","",$mylist[$x]);        function $pagename."_google_maps_section"(){                 echo "here can adjust manually google map options";        }     } } 

thank you.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -