Skip to content

Commit b1e2ce0

Browse files
committed
#147 fix program search on add program form
1 parent b1eeaba commit b1e2ce0

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

inc/ajax_operations.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -298,13 +298,9 @@ function sc_search_program() {
298298

299299
$result = array();
300300
if( ! empty ( $nom_programa ) ) {
301-
$args = array(
302-
's' => $nom_programa,
303-
'orders' => 'DESC',
304-
'post_status' => 'publish',
305-
'post_type' => 'programa',
306-
);
307-
$result_full = get_posts( $args );
301+
$query['s'] = $nom_programa;
302+
$args = get_post_query_args( 'programa', SearchQueryType::Programa, $query );
303+
$result_full = query_posts( $args );
308304
}
309305

310306
$programs = array_map( 'generate_post_url_link', $result_full );

templates/ajax/programs-list.twig

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<ul class="cont-llista">
22
{% for program in programs %}
3-
<li><i class="fa fa-chevron-right"></i>{{ program }}</li>
3+
{% if loop.index == 5 %}
4+
<div id="mesprogrames" class="collapse">
5+
{% endif %}
6+
<li><i class="fa fa-chevron-right"></i>{{ program }}</li>
7+
{% if loop.last %}
8+
</div>
9+
<br/>
10+
<button data-toggle="collapse" class="bt-basic bt-mes intern-center" type="button" href="#mesprogrames">més<i class="fa fa-angle-down"></i></button>
11+
{% endif %}
412
{% endfor %}
513
</ul>

templates/archive-programa.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
<i style="font-size: 115px" class="fa fa-cogs"></i>
8686
{% endif %}
8787
<div class="caption">
88-
<h3>{{ post.title }}</h3>
88+
<h3>{{ post.title|truncate(8) }}</h3>
8989
<div class="cont-rating">
9090
<input id="input-id" value="{{ post.valoracio }}" class="rating" data-glyphicon="false" data-symbol="&#xf006;" data-rating-class="rating-fa" data-show-caption="false" data-show-clear="false" disabled="disabled" data-readonly/>
9191
{% if post.total_baixades_programa %}<em>({{ post.total_baixades_programa }})</em>{% endif %}

0 commit comments

Comments
 (0)