diff --git a/controllers/dashboard/wordpress_import/import.php b/controllers/dashboard/wordpress_import/import.php index 34ca7d4..6552629 100644 --- a/controllers/dashboard/wordpress_import/import.php +++ b/controllers/dashboard/wordpress_import/import.php @@ -175,6 +175,7 @@ function import_wordpress_site(){ $dc = $item->children($namespaces['dc']); $author = (string)$dc->creator; $parentID = (int)$wp->post_parent; + $postName = (string)$wp->post_name; $out_tags = array(); $out_categories = array(); @@ -197,6 +198,7 @@ function import_wordpress_site(){ $p->setContent($content); $p->setAuthor($author); $p->setWpParentID($parentID); + $p->setPostName($postName); $p->setPostDate($postDate); $p->setPostType($postType); $p->setCategory($out_categories); @@ -305,7 +307,11 @@ function addWordpressPage(Page $p, CollectionType $ct, PageLite $pl, $xmlID){ } - $pageData = array('cName' => $pl->getTitle(),'cDatePublic'=>$pl->getPostdate(),'cDateAdded'=>$pl->getPostdate(),'cDescription' => $pl->getExcerpt(), 'uID'=> $uID); + if ( "POST" == $pl->getPostType() ){ + $pageData = array('cName' => $pl->getTitle(),'cDatePublic'=>$pl->getPostdate(),'cDateAdded'=>$pl->getPostdate(),'cDescription' => $pl->getExcerpt(), 'uID'=> $uID, 'cHandle' => $pl->getPostID()); + } else { + $pageData = array('cName' => $pl->getTitle(),'cDatePublic'=>$pl->getPostdate(),'cDateAdded'=>$pl->getPostdate(),'cDescription' => $pl->getExcerpt(), 'uID'=> $uID, 'cHandle' => $pl->getPostName()); + } $newPage = $p->add($ct,$pageData); if (is_array($pl->getCategory())){ diff --git a/models/page_lite.php b/models/page_lite.php index 8b82721..51fe3f8 100644 --- a/models/page_lite.php +++ b/models/page_lite.php @@ -11,6 +11,7 @@ class PageLite extends Object{ protected $tags; protected $postDate; protected $wpPostID; //needed to relate + protected $wpPostName; //needed to slug function setPropertiesFromArray($array){ //TODO: maybe put some preg_replace here? parent::setPropertiesFromArray($array); @@ -82,4 +83,10 @@ function setExcerpt($ex){ function getExcerpt(){ return $this->wpExcerpt; } + function setPostName($post_name){ + $this->wpPostName = $post_name; + } + function getPostName(){ + return $this->wpPostName; + } }