Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- public function add_template_vars()
- {
- if ( isset($this->posts) && count($this->posts) ) {
- $post = $this->post instanceof Post ? $this->post : $this->posts[0];
- if ( $this->post instanceof Post && count($this->posts) == 1 ) {
- $this->set_title( $post->title );
- if ( $post->typename == 'entry' ) {
- $this->assign( 'next', $post->ascend() );
- $this->assign( 'previous', $post->descend() );
- }
- if ( count($post->tags) ) {
- $related = Posts::get(array(
- 'vocabulary' => $post->tags->getArrayCopy(),
- 'content_type' => $post->content_type,
- 'status' => Post::status('published'),
- 'not:id' => $post->id,
- 'limit' => 5,
- 'orderby' => 'Rand()'
- ));
- $this->assign( 'related_posts', $related );
- }
- }
- }
- elseif ( URL::get_matched_rule() == null ) {
- $this->set_title('Page Not Found');
- }
- parent::add_template_vars();
- }
- ?>
Add Comment
Please, Sign In to add comment