Created
September 6, 2013 13:41
-
-
Save danielkmariam/6463955 to your computer and use it in GitHub Desktop.
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
/** | |
* Returns the collection of posts | |
* | |
* @param array $categorySlugs Slug value of categories | |
* @param array $tagSlugs Slug value of tags | |
* | |
* @return Fishpig_Wordpress_Model_Mysql4_Post_Collection | |
*/ | |
public function getPosts($categorySlugs = array(), $tagSlugs = array(), $filter=false) | |
{ | |
return $this->_getPostCollection($categorySlugs, $tagSlugs, $filter); | |
} | |
/** | |
* Generates and returns the collection of posts | |
* | |
* @return Fishpig_Wordpress_Model_Mysql4_Post_Collection | |
*/ | |
protected function _getPostCollection($categorySlugs = array(), $tagSlugs = array(), $filter=false) | |
{ | |
if (is_null($this->_postCollection)) { | |
if (is_null($this->getWrapperBlock()) === false) { | |
$this->_postCollection = $this->getWrapperBlock()->getPostCollection(); | |
if (count($categorySlugs) > 0 && $filter) { | |
var_dump('>>> fter'); | |
$this->getWrapperBlock()->setPostListTemplate('wordpress/post/list.phtml'); | |
$this->_postCollection->addExcludeCategoryAndTagSlugFilter($categorySlugs, $tagSlugs); | |
} | |
if ($this->getPagerBlock() && $this->_postCollection) { | |
$this->getPagerBlock()->setCollection($this->_postCollection); | |
} | |
} | |
} | |
return $this->_postCollection; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment