/** * Initialise the current category */ protected function _init() { if ($category = $this->_loadCategoryBasedOnUrl()) { if ($this->isFeedPage()) { $this->_forward('commentFeed'); return null; } if (!Mage::helper('wordpress')->isLegacyMagento()) { $this->_addCustomLayoutHandles(array('wordpress_category_index', 'WORDPRESS_CATEGORY_' . $category->getId())); } // Add base breacrumbs and title parent::_init(); $this->_title($category->getName()); $this->_addCrumb('category', array('link' => $category->getUrl(), 'label' => $category->getName())); $this->_addCanonicalLink($category->getUrl()); if ($seo = $this->getSeoPlugin()) { if ($seo->getPluginOption('category_noindex')) { if ($headBlock = $this->getLayout()->getBlock('head')) { $headBlock->setRobots('noindex,follow'); } } } return true; } $this->throwInvalidObjectException('category'); }
protected function _init() { if (!$this->_initPostModel()) { return false; } if ($this->isFeedPage()) { $this->_forward('commentFeed'); return false; } $this->_checkForPostedComment(); parent::_init(); if ($post = $this->_getPost()) { $this->_title($post->getPageTitle()); if ($headBlock = $this->getLayout()->getBlock('head')) { $headBlock->setDescription($post->getMetaDescription()); $headBlock->setKeywords($post->getMetaKeywords()); } $this->_addCrumb('post', array('label' => $post->getPostTitle())); $this->_addCanonicalLink($post->getPermalink()); if ($headBlock = $this->_getBlock('head')) { $feedTitle = sprintf('%s » %s Comments Feed', Mage::helper('wordpress')->getCachedWpOption('blogname'), $post->getPostTitle()); $headBlock->addItem('link_rel', $post->getCommentFeedUrl(), 'rel="alternate" type="application/rss+xml" title="' . $feedTitle . '"'); } } }
/** * Initialise the homepage * */ protected function _init() { $this->_handleHomepageRedirect(); if (!Mage::registry('wordpress_page')) { if (Mage::helper('wordpress')->getWpOption('show_on_front')) { if ($pageId = Mage::helper('wordpress')->getWpOption('page_on_front')) { $page = Mage::getModel('wordpress/page')->load($pageId); if ($page->getId()) { Mage::register('wordpress_page', $page); $this->_forward('index', 'page_view'); return null; } } } } parent::_init(); if ($page = Mage::registry('wordpress_page')) { $this->_addCanonicalLink($page->getUrl()); } else { $this->_addCanonicalLink(Mage::helper('wordpress')->getUrl()); } if ($this->getSeoPlugin()->isEnabled()) { if ($title = $this->getSeoPlugin()->getPluginOption('home_title')) { $this->_title()->_title($title); } } return true; }
/** * List all tags with associated posts * */ public function listAction() { parent::_init(); $this->_title($this->__('Tag Archives')); $this->_addCrumb('tags', array('link' => Mage::helper('wordpress/post')->getTagsUrl(), 'label' => $this->__('Tags'))); $this->_addCanonicalLink(Mage::helper('wordpress/post')->getTagsUrl()); $this->renderLayout(); }
/** * Initialise the current category */ protected function _init() { parent::_init(); if ($author = $this->_initAuthor()) { $this->_title($author->getDisplayName())->_addCrumb('author_nolink', array('label' => $this->__('Author')))->_addCrumb('author', array('link' => $author->getUrl(), 'label' => $author->getDisplayName()))->_addCanonicalLink($author->getUrl()); return true; } $this->throwInvalidObjectException('author'); }
/** * Initialise the current category */ protected function _init() { parent::_init(); if ($archive = $this->_initArchive()) { $this->_title($archive->getName()) ->_addCrumb('archive', array('link' => $archive->getUrl(), 'label' => $archive->getName())) ->_addCanonicalLink($archive->getUrl()); } else { $this->throwInvalidObjectException('author'); } }
/** * Initialise the current category */ protected function _init() { parent::_init(); $helper = Mage::helper('wordpress/search'); $routerHelper = $this->getRouterHelper(); if ($searchValue = $routerHelper->getTrimmedUri('search')) { $this->getRequest()->setParam($helper->getQueryVarName(), $searchValue); } $label = $this->__("Search results for: '%s'", $helper->getEscapedSearchString()); $this->_title($label); $this->_addCrumb('blog_search', array('link' => '', 'label' => $label)); return true; }
/** * Initialise the current category */ protected function _init() { if ($archive = $this->_initArchive()) { parent::_init(); $this->_title($archive->getName())->_addCrumb('archive', array('link' => $archive->getUrl(), 'label' => $archive->getName()))->_addCanonicalLink($archive->getUrl()); if ($seo = $this->getSeoPlugin()) { if ($seo->getPluginOption('archive_noindex')) { if ($headBlock = $this->getLayout()->getBlock('head')) { $headBlock->setRobots('noindex,follow'); } } } return true; } $this->throwInvalidObjectException('archive'); }
/** * Initialise the current category */ protected function _init() { if ($category = $this->_loadCategoryBasedOnUrl()) { if (!Mage::helper('wordpress')->isLegacyMagento()) { $this->_addCustomLayoutHandles(array('wordpress_category_index', 'WORDPRESS_CATEGORY_'.$category->getId())); } // Add base breacrumbs and title parent::_init(); $this->_title($category->getName()); $this->_addCrumb('category', array('link' => $category->getUrl(), 'label' => $category->getName())); $this->_addCanonicalLink($category->getUrl()); return $this; } else { $this->throwInvalidObjectException('category'); } }
/** * Initialise the homepage * */ protected function _init() { parent::_init(); $this->_addCanonicalLink(Mage::helper('wordpress')->getUrl()); if ($this->getSeoPlugin()->isEnabled()) { if ($headBlock = $this->getLayout()->getBlock('head')) { foreach($this->getSeoPlugin()->getMetaFields() as $field) { if ($value = $this->getSeoPlugin()->getPluginOption('home_'.$field)) { $headBlock->setData($field, $value); } } if ($title = $this->getSeoPlugin()->getPluginOption('home_title')) { $this->_title()->_title($title); } } } }
/** * Initialise the post view request * */ protected function _init() { if (!$this->_initPostModel()) { return false; } if ($this->isFeedPage()) { $this->_forward('commentFeed'); return null; } $this->_checkForPostedComment(); $this->_useOpenGraphTags = Mage::helper('wordpress/opengraph')->isEnabledForPosts(); parent::_init(); if ($post = $this->_getPost()) { $this->_title($post->getPageTitle()); if ($headBlock = $this->getLayout()->getBlock('head')) { if ($post->getMetaDescription()) { $headBlock->setDescription($post->getMetaDescription()); } if ($post->getMetaKeywords()) { $headBlock->setKeywords($post->getMetaKeywords()); } } if ($this->_useOpenGraphTags) { Mage::helper('wordpress/opengraph')->addTag('url', $post->getUrl())->addTag('type', 'article'); if ($image = $post->getFeaturedImage()) { Mage::helper('wordpress/opengraph')->addTag('image', $image->getLargeImage() ? $image->getLargeImage() : $image->getMediumImage()); } } $this->_addCrumb('post', array('label' => $post->getPostTitle())); $this->_addCanonicalLink($post->getPermalink()); if ($headBlock = $this->getLayout()->getBlock('head')) { $feedTitle = sprintf('%s » %s Comments Feed', Mage::helper('wordpress')->getWpOption('blogname'), $post->getPostTitle()); $headBlock->addItem('link_rel', $post->getCommentFeedUrl(), 'rel="alternate" type="application/rss+xml" title="' . $feedTitle . '"'); } } return true; }
protected function _init() { if ($page = $this->_getPage()) { if ($page->isBlogPage()) { $this->_forward('index', 'homepage'); return null; } parent::_init(); if ($headBlock = $this->getLayout()->getBlock('head')) { if ($page->getMetaDescription()) { $headBlock->setDescription($page->getMetaDescription()); } if ($page->getMetaKeywords()) { $headBlock->setKeywords($page->getMetaKeywords()); } } $this->_addCanonicalLink($page->getPermalink()); $pages = array(); $buffer = $page; while ($buffer) { $this->_title($buffer->getPageTitle()); $pages[] = $buffer; $buffer = $buffer->getParentPage(); } $pages = array_reverse($pages); $lastPage = array_pop($pages); foreach ($pages as $buffer) { $this->_addCrumb('page_' . $buffer->getId(), array('label' => $buffer->getPostTitle(), 'link' => $buffer->getPermalink())); } if ($lastPage) { $this->_addCrumb('page_' . $lastPage->getId(), array('label' => $lastPage->getPostTitle())); } return true; } return false; }