Я работаю над сайтом wordpress, и мне нужно назначить значение функции для значения внутри массива, но оно продолжает давать мне ошибки. В массиве customFields мне нужно вставить значение get_option ('contact_email', 'no one') в некоторый вспомогательный текст. В нижеприведенном фрагменте кода мне нужно заменить {CONTACT_EMAIL} значением get_option, но не могу понять это.Назначение переменной внутри массива
...
var $customFields = array(
array(
"name" => "ContactPerson-name",
"title" => "Contact Name",
"description" => "Enter the first and last name of the page contact. If left blank, the site default of {CONTACT_PERSON} will be used.",
"type" => "textinput",
"scope" => array("page"),
"capability" => "edit_pages"
),
array(
"name" => "ContactPerson-email",
"title" => "Contact Email",
"description" => "Enter the email address of the page contact. If left blank, the site default of {CONTACT_EMAIL} will be used.",
"type" => "textinput",
"scope" => array("page"),
"capability" => "edit_pages"
),
array(
"name" => "ContactPerson-phone",
"title" => "Contact Phone (XXX) XXX-XXXX",
"description" => "Enter the phone number of the page contact. If left blank, the site default of {CONTACT_PHONE} will be used.",
"type" => "textinput",
"scope" => array("page"),
"capability" => "edit_pages"
),
array(
"name" => "ContactPerson-address",
"title" => "Contact Room Number & Building",
"description" => "Enter the room number and building of the page contact. Click <a href=\"http://www.engin.umich.edu/buildingabbreviations\">here</a> for building abbreviations. If left blank, the site default of {CONTACT_ADDRESS} will be used.",
"type" => "textinput",
"scope" => array("page"),
"capability" => "edit_pages"
),
...
...
Я попытался закрыть текст и CONCAT функции, я попытался сделать строку замены и ничего не работает. Спасибо за любую помощь, которую любой может предоставить.
Что ошибка ?! – deceze
Вы пытались использовать что-то вроде: $ contactEmail = get_option ('contact_email', 'no one'); array (.... "title" => $ contactEmail), – cptnk
Включили ли вы файлы, необходимые для использования этой функции? – Aleeeeee