Skip to content

Commit

Permalink
#74 Add autor_traduccio and project relationship fields
Browse files Browse the repository at this point in the history
  • Loading branch information
paugnu committed Mar 25, 2016
1 parent 69b1d03 commit e68e3bf
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
8 changes: 6 additions & 2 deletions single-programa.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,14 @@
$args = get_post_query_args( 'page', SearchQueryType::PagePrograma, $query );
query_posts($args);
$context['related_pages'] = Timber::get_posts($args);
$context['projecte_relacionat_url'] = false; //Aquí posarem l'url del projecte relacionat per enllaçar-ho des de la pàgina del programa
$project_id = wpcf_pr_post_get_belongs($post->ID, 'projecte');
if( $project_id ) {
$context['projecte_relacionat_url'] = get_permalink($project_id);
$context['projecte_relacionat_name'] = get_the_title($project_id);
}

if ( post_password_required( $post->ID ) ) {
Timber::render( 'single-password.twig', $context );
} else {
Timber::render( array( 'single-' . $post->ID . '.twig', 'single-' . $post->post_type . '.twig', 'single.twig' ), $context );
}
}
2 changes: 1 addition & 1 deletion static/css/main.min.css

Large diffs are not rendered by default.

20 changes: 13 additions & 7 deletions templates/capcalera_programa.twig
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,19 @@
<h1>{{ post.title }}</h1>
<h2>{{ post.subtitle_programa }}</h2>
<ul>
<li>{{ post.autor_programa }}</li>
<li>{% if post.terms('llicencia') %}
{% for term in post.terms('llicencia') %}
{{term.name}}{% if not loop.last %}, {% endif %}
{% endfor %}
{% endif %}</li>
<li><a href="{{ post.lloc_web_programa }}">{{ post.lloc_web_programa }}</a></li>
<li><strong>Autor:</strong> {{ post.autor_programa }}</li>
{% if post.terms('llicencia') %}
<li>
<strong>Llicència:</strong>
{% for term in post.terms('llicencia') %}
{{term.name}}{% if not loop.last %}, {% endif %}
{% endfor %}
</li>
{% endif %}
<li><strong>Lloc web:</strong> <a href="{{ post.lloc_web_programa }}">{{ post.lloc_web_programa }}</a></li>
<li></li>
{% if post.autor_traduccio %}<li><strong>Autor de la traducció:</strong> {{ post.autor_traduccio }}</li>{% endif %}
{% if projecte_relacionat_url %}<li><strong>Projecte de traducció:</strong> <a href="{{ projecte_relacionat_url }}" title="{{ projecte_relacionat_name }}">{{ projecte_relacionat_name }}</a></li>{% endif %}
</ul>


Expand Down

0 comments on commit e68e3bf

Please sign in to comment.