Commit b4d324f9 authored by Andrius Mickus's avatar Andrius Mickus

Set custom uri for post

parent 81eb3603
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
<file pinned="false" current-in-tab="true"> <file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/wp-content/plugins/jobs-importer/JobsImporter.php"> <entry file="file://$PROJECT_DIR$/wp-content/plugins/jobs-importer/JobsImporter.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="546"> <state relative-caret-position="483">
<caret line="275" column="38" lean-forward="true" selection-start-line="275" selection-start-column="38" selection-end-line="275" selection-end-column="38" /> <caret line="137" column="66" selection-start-line="137" selection-start-column="66" selection-end-line="137" selection-end-column="66" />
</state> </state>
</provider> </provider>
</entry> </entry>
...@@ -137,7 +137,7 @@ ...@@ -137,7 +137,7 @@
<servers /> <servers />
</component> </component>
<component name="TimeTrackingManager"> <component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="61176000" /> <option name="totallyTimeSpent" value="65934000" />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="-8" y="-8" width="1858" height="1096" extended-state="6" /> <frame x="-8" y="-8" width="1858" height="1096" extended-state="6" />
...@@ -216,15 +216,15 @@ ...@@ -216,15 +216,15 @@
</entry> </entry>
<entry file="file://$PROJECT_DIR$/wp-content/plugins/jobs-importer/JsonDataCollector.php"> <entry file="file://$PROJECT_DIR$/wp-content/plugins/jobs-importer/JsonDataCollector.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1008"> <state relative-caret-position="273">
<caret line="51" column="27" selection-start-line="51" selection-start-column="14" selection-end-line="51" selection-end-column="27" /> <caret line="13" column="19" selection-start-line="13" selection-start-column="19" selection-end-line="13" selection-end-column="19" />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/wp-content/plugins/jobs-importer/JobsImporter.php"> <entry file="file://$PROJECT_DIR$/wp-content/plugins/jobs-importer/JobsImporter.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="546"> <state relative-caret-position="483">
<caret line="275" column="38" lean-forward="true" selection-start-line="275" selection-start-column="38" selection-end-line="275" selection-end-column="38" /> <caret line="137" column="66" selection-start-line="137" selection-start-column="66" selection-end-line="137" selection-end-column="66" />
</state> </state>
</provider> </provider>
</entry> </entry>
......
...@@ -70,6 +70,8 @@ class JobsImporter ...@@ -70,6 +70,8 @@ class JobsImporter
*/ */
public function import() public function import()
{ {
global $permalink_manager_uris;
foreach ($this->data as $ad) { foreach ($this->data as $ad) {
// Set language code // Set language code
...@@ -81,6 +83,11 @@ class JobsImporter ...@@ -81,6 +83,11 @@ class JobsImporter
// Set related custom posts // Set related custom posts
$posts = $this->getPosts($ad['posts'], $lang); $posts = $this->getPosts($ad['posts'], $lang);
if (isset($ad['properties']['custom_uri'])) {
$custom_uri = $ad['properties']['custom_uri'];
unset($ad['properties']['custom_uri']);
}
// Collect and prepare job's data // Collect and prepare job's data
$adData = $this->mapRelations(array_merge( $adData = $this->mapRelations(array_merge(
$ad['properties'], $ad['properties'],
...@@ -125,6 +132,11 @@ class JobsImporter ...@@ -125,6 +132,11 @@ class JobsImporter
// Set post language // Set post language
$this->setPostLang($podId, $ad['lang']); $this->setPostLang($podId, $ad['lang']);
if (isset($custom_uri)) {
$permalink_manager_uris[$podId] = $custom_uri;
update_option('permalink-manager-uris', $permalink_manager_uris);
}
} }
} }
} }
......
...@@ -11,6 +11,7 @@ class JsonDataCollector ...@@ -11,6 +11,7 @@ class JsonDataCollector
'post_modified' => 'atnaujinta', 'post_modified' => 'atnaujinta',
'title' => 'pareigos', 'title' => 'pareigos',
'post_content' => 'aprasymas', 'post_content' => 'aprasymas',
'custom_uri' => 'seo_url',
// 'email' => 'email', // 'email' => 'email',
// 'work_time' => 'darbo_laikas', // 'work_time' => 'darbo_laikas',
// 'contact' => 'kontaktai', // 'contact' => 'kontaktai',
...@@ -149,8 +150,9 @@ class JsonDataCollector ...@@ -149,8 +150,9 @@ class JsonDataCollector
$result = []; $result = [];
foreach ($this->properties as $propertyKey => $propertyValue) { foreach ($this->properties as $propertyKey => $propertyValue) {
if (isset($ad->{$propertyValue})) if (isset($ad->{$propertyValue})) {
$dataValue = $ad->{$propertyValue}; $dataValue = $ad->{$propertyValue};
}
$result[$propertyKey] = $this->getValue($dataValue); $result[$propertyKey] = $this->getValue($dataValue);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment