Last active
December 2, 2017 01:39
-
-
Save Tusko/893b6c8822c74d44c4002ca37bb31b69 to your computer and use it in GitHub Desktop.
Parse CSV by line (acf repeater)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$file = file_get_contents('/wp-content/themes/themename/analyzers.csv'); | |
$lines = explode(PHP_EOL, $file); | |
$array = array(); | |
foreach ($lines as $line) { | |
$l = str_getcsv($line); | |
$array[] = array( | |
'brand' => $l[1], | |
'model' => $l[0], | |
); | |
} | |
update_field('analyzers_list', $array, $post->ID); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment