Skip to content
This repository has been archived by the owner. It is now read-only.

Updating post title and name #8

Merged
merged 2 commits into from Sep 2, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions uc-people.php
Expand Up @@ -79,7 +79,7 @@ add_action( 'init', 'create_custom_custom_post_type', 0 );
add_filter('title_save_pre', 'save_title');
function save_title($my_post_title) {
if ($_POST['post_type'] == 'person') :
$new_title = $_POST['fields']['field_first_name'].' '.$_POST['fields']['field_first_name'];
$new_title = $_POST['acf']['field_first_name'].' '.$_POST['acf']['field_last_name'];
$my_post_title = $new_title;
endif;
return $my_post_title;
Expand All @@ -88,27 +88,27 @@ function save_title($my_post_title) {
add_filter('name_save_pre', 'save_name');
function save_name($my_post_name) {
if ($_POST['post_type'] == 'post_type_name') :
$new_name = strtolower($_POST['fields']['field_first_name'].' '.$_POST['fields']['field_first_name']);
$new_name = strtolower($_POST['acf']['field_first_name'].' '.$_POST['acf']['field_last_name']);
$my_post_name = $new_name;
endif;
return $my_post_name;
}
if(!function_exists('processCSV')){
function processCSV($file){
$data = array();

$fh = fopen($file, 'r');
if( $fh == false ){
return;
}
$header = fgetcsv($fh);

while( $line = fgetcsv($fh) ) {
$data[] = array_combine($header, $line);
}

fclose($fh);

return $data;
}
}
Expand Down