/** * Filter to add options to the theme settings page */ function cfcp_options($options) { unset($options['cfct']['fields']['about']); unset($options['cfct']['fields']['credit']); $yn_options = array('yes' => __('Yes', 'favepersonal'), 'no' => __('No', 'favepersonal')); $personal_options = array('cfcp' => array('label' => '', 'description' => 'cfct_options_blank', 'fields' => array('header' => array('type' => 'cfcp_header', 'label' => __('Header Display', 'favepersonal'), 'name' => 'header_options[type]'), 'header_1' => array('type' => 'hidden', 'name' => 'header_options[posts][_1]'), 'header_2' => array('type' => 'hidden', 'name' => 'header_options[posts][_2]'), 'header_3' => array('type' => 'hidden', 'name' => 'header_options[posts][_3]'), 'social' => array('type' => 'radio', 'label' => __('Enable Social Plugin', 'favepersonal'), 'name' => 'social_enabled', 'options' => $yn_options, 'help' => '<span class="cfct-help">' . __('(Social is a plugin that allows broadcasting new post notifications to social networks and also authenticating to them for post commenting. <a href="http://crowdfavorite.com/wordpress/plugins/social/">Learn more...</a>)', 'favepersonal') . '</span>')))); // cfct_array_merge_recursive($options, $personal_options); For options display after the defaults. // Note this will have defaults override our settings. Not an issue with defining the new 'cfcp' section. $options = cfct_array_merge_recursive($personal_options, $options); return $options; }
/** * Recursively merges two arrays down overwriting values if keys match. * * @param array $array_1 Array to merge into * @param array $array_2 Array in which values are merged from * * @return array Merged array */ function cfct_array_merge_recursive($array_1, $array_2) { foreach ($array_2 as $key => $value) { if (isset($array_1[$key]) && is_array($array_1[$key]) && is_array($value)) { $array_1[$key] = cfct_array_merge_recursive($array_1[$key], $value); } else { $array_1[$key] = $value; } } return $array_1; }