Skip to content

Commit

Permalink
Merge pull request #84 from Softcatala/aparells
Browse files Browse the repository at this point in the history
Aparells
  • Loading branch information
paugnu committed Jan 14, 2016
2 parents 152eded + 0858c1d commit 6c7e448
Show file tree
Hide file tree
Showing 13 changed files with 574 additions and 218 deletions.
35 changes: 35 additions & 0 deletions aparell.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* Template Name: Aparells
*
* @package wp-softcatala
*/
$context = Timber::get_context();

$search = get_query_var('cerca');
$sistema_operatiu = get_query_var( 'sistema_operatiu' );
$tipus_aparell = get_query_var( 'tipus_aparell' );
if( ! empty( $search ) || ! empty( $sistema_operatiu ) || ! empty( $tipus_aparell ) ) {
$query_aparell['s'] = $search;
$query_aparell['sistema_operatiu_aparell'] = $sistema_operatiu;
$query_aparell['tipus_aparell'] = $tipus_aparell;
$args = get_post_query_args( 'aparell', SearchQueryType::Aparell, $query_aparell );
$context['cerca'] = $search;
$context['selected_filter_so'] = ( isset ( $args['filter_so'] ) ? $args['filter_so'] : '' );
$context['selected_filter_tipus'] = ( isset ( $args['filter_tipus'] ) ? $args['filter_tipus'] : '' );
} else {
$args = array( 'post_type' => 'aparell' );
}

$post = new TimberPost();
$parent_data = get_page_parent_title( $post );
$context['categories']['sistemesoperatius'] = Timber::get_terms('sistema_operatiu_aparell');
$context['categories']['tipus'] = Timber::get_terms('tipus_aparell');
$context['parent_title'] = $parent_data['title'];
$context['page_hierarchy'] = get_parent_page_hierarchy($parent_data['id'], 'DESC');
query_posts($args);
$context['post'] = $post;
$context['sidebar_elements'] = array( 'static/suggeriment.twig', 'baixades.twig', 'links.twig' );
$context['links'] = $post->get_field( 'link' );
$context['aparells'] = Timber::get_posts($args);
Timber::render( array( 'aparells.twig' ), $context );
2 changes: 1 addition & 1 deletion archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
//Get the posts depending on the parameters
if( isset( $filter ) ) {
$context['selected_filter'] = $filter;
$args = get_post_query_args( SearchQueryType::FilteredDate, $filterdate );
$args = get_post_query_args( 'esdeveniment', SearchQueryType::FilteredDate, $filterdate );
query_posts($args);
$context['posts'] = Timber::get_posts($args);
} else {
Expand Down
Loading

0 comments on commit 6c7e448

Please sign in to comment.