public function render() { // pages & categories $post = get_post(); $isSingular = is_singular(KT_WP_POST_KEY); if (is_page()) { if ($this->isPages()) { $currentId = $post->ID; echo "\n<div class=\"widget\">"; echo "<h2 class=\"widgettitle\">" . __("Stránky", "ZZZ_DOMAIN") . "</h2>"; echo "<ul class=\"nav nav-pills nav-stacked\">"; foreach ($this->getPages() as $page) { $postModel = new KT_WP_Post_Base_Model($page); $classAttribute = $postModel->getPostId() == $currentId ? " class=\"active\"" : ""; echo "<li{$classAttribute}><a href=\"{$postModel->getPermalink()}\" title=\"{$postModel->getTitleAttribute()}\">{$postModel->getTitle()}</a></li>"; } echo "</ul></div>\n"; } } elseif (is_category() || $isSingular) { $currentId = get_queried_object_id(); $postModel = new KT_WP_Post_Base_Model($post); $categoriesIds = $postModel->getCategoriesIds() ?: array(); echo "\n<div class=\"widget\">"; echo "<h2 class=\"widgettitle\">" . __("Kategorie", "ZZZ_DOMAIN") . "</h2>"; echo "<ul class=\"nav nav-pills nav-stacked\">"; foreach ($this->getCategories() as $term) { $termModel = new KT_WP_Term_Base_Model($term); if ($isSingular) { $classAttribute = in_array($termModel->getId(), $categoriesIds) ? " class=\"active\"" : ""; } else { $classAttribute = $termModel->getId() == $currentId ? " class=\"active\"" : ""; } echo "<li{$classAttribute}><a href=\"{$termModel->getPermalink()}\" title=\"{$termModel->getName()}\">{$termModel->getName()}</a></li>"; } echo "</ul></div>\n"; } // dynamic sidebar if (is_active_sidebar($this->getCurrentSidebarKey())) { dynamic_sidebar($this->getCurrentSidebarKey()); } }
<h2 class="text-center hidden-xs"><?php echo $termModel->getDescription(); ?> </h2> <?php } ?> </header> <?php if ($postsPresenter->isPosts()) { ?> <div id="posts-container" class="row" data-offset="<?php echo $postsPresenter->getInitialOffset(); ?> " data-category-id="<?php echo $termModel->getId(); ?> "> <?php $postsPresenter->thePosts(); ?> </div> <?php if ($postsPresenter->getPostsCount() == $postsPresenter->getMaxCount()) { ?> <div class="text-center"> <span id="load-more-posts" class="btn btn-default"><?php _e("Načíst další", "ZZZ_DOMAIN"); ?> </span> </div>