Skip to content

Commit

Permalink
issue #15
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusgimenez committed Jun 23, 2015
1 parent a1e1977 commit 253c55d
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 16 deletions.
37 changes: 28 additions & 9 deletions agenda/functions-agenda.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function content_nova_coluna_eventos ( $column_name, $id ) {
$data_explo = explode("/", $data_invert);
echo
'<span style="font-size:15px;">' .
date('d/m/Y', $data_invert)
date('d/m/Y', intval($data_invert))
. '</span>';
break;
default:
Expand All @@ -33,19 +33,38 @@ function content_nova_coluna_eventos ( $column_name, $id ) {

// Ordena automaticamente os Eventos da Agenda de forma ascendente (ASC)
function agenda_pre_get_posts( $query ) {
if (is_admin()) {

if (isset($query->query_vars['post_type'])) {
if ($query->query_vars['post_type'] == 'eventos') {
if (isset($query->query_vars['post_type'])) {
if ($query->query_vars['post_type'] == 'eventos') {

$query->set('meta_key', 'agenda-event-date');
$query->set('orderby', 'meta_value');
$query->set('order', 'DESC');
}
$query->set('meta_key', 'agenda-event-date');
$query->set('orderby', 'meta_value');
$query->set('order', 'DESC');
}
}
if(is_post_type_archive('eventos') && isset($_GET['by_year'])){
$meta_query = array(
array(
'key' => 'agenda-event-year',
'value' => $_GET['by_year'],
'compare' => '=',
),
);
$query->set('meta_query',$meta_query);
}
}
add_filter( 'pre_get_posts' , 'agenda_pre_get_posts' );
// Fim

add_action( 'save_post', 'brasa_eventos_save', 13, 2 );
function brasa_eventos_save($post_id){
if(get_post_type($post_id) != 'eventos')
return;
if(isset($_POST['agenda-event-date']) && !empty($_POST['agenda-event-date'])){
$date = explode('/', $_POST['agenda-event-date']);
update_post_meta( $post_id, 'agenda-event-year', $date[2] );
}
else{
delete_post_meta( $post_id, 'agenda-event-year' );
}
}
?>
2 changes: 1 addition & 1 deletion agenda/metaboxes-agenda.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function mytheme_show_box($post) {
if (get_post_meta($post->ID, $field['id'], true)){
if ($field['id']== 'agenda-event-date'){
$meta = get_post_meta($post->ID, $field['id'], true);
$meta = date('d/m/Y', $meta);
$meta = date('d/m/Y', intval($meta));
}
else{
$meta = get_post_meta($post->ID, $field['id'], true);
Expand Down
25 changes: 23 additions & 2 deletions archive-eventos.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,23 @@

<section id="primary" class="page-eventos single <?php echo odin_classes_page_full('row'); ?>">
<main id="main-content" class="site-main" role="main">
<div class="dropdown">
<button class="btn btn-default btn-loadmore active dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<?php _e('Filtrar por ano','odin');?>
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<?php $year = intval(date('Y')) + 2;?>
<?php for ($i = 2006; $i < $year; $i++): ?>
<?php $link = array('by_year' => $i);?>
<li>
<a href="<?php echo esc_url(add_query_arg($link,get_post_type_archive_link('eventos' )));?>">
<?php echo $i;?>
</a>
</li>
<?php endfor;?>
</ul>
</div>
<?php
// Start the Loop.
while ( have_posts() ) : the_post();
Expand All @@ -33,11 +50,15 @@

endwhile;

// Page navigation.
odin_paging_nav();


?>
<div class="text-center col-md-12">
<?php
// Page navigation.
odin_paging_nav();
?>
</div><!-- .text-center col-md-12 -->
</main><!-- #main -->
<div class="clearfix"></div>

Expand Down
2 changes: 1 addition & 1 deletion assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -6181,7 +6181,7 @@ color:black;
border: none;
box-shadow: none;
}
.midia-category .btn.active, .btn-loadmore:hover{
.midia-category .btn.active, .btn-loadmore:hover, .btn-loadmore.active{
background: #6f1112;
color:#ffffff;
border-radius:0;
Expand Down
11 changes: 11 additions & 0 deletions assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,17 @@ twitterFetcher.fetch(config1);
$(elem).parent('.sc-play').trigger('click');
}
});
$(document).on('opened.fndtn.reveal', '[data-reveal]', function () {
var element = $(this).find('.player-soundcloud-url-modal');
if(!$(element).hasClass('init')){
var _id = '#play-modal-' + element.attr('data-id');
console.log(_id);
$(_id).scPlayer({
links: [{url: element.attr('data-url'), title: element.attr('data-url')}]
});
$(_id).addClass('init');
}
});
$(".menu-item a").click(function(){
endereco = $(this).attr("href").split("#")[1];
if (endereco == 'social'){
Expand Down
2 changes: 1 addition & 1 deletion content-eventos.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
?>
</div>
<div class="texto_disco ">
<h7 class="data-evento"><?php echo date('d/m',get_post_meta( $post->ID, "agenda-event-date", true ));?></h7>
<h7 class="data-evento"><?php echo date('d/m',intval(get_post_meta( $post->ID, "agenda-event-date", true )));?></h7>
<div class="endereco-eventos">
<h7><?php echo get_post_meta( $post->ID, 'agenda_horario_inic', true );?> - </h7>
<h7><?php echo get_post_meta( $post->ID, "agenda_endereco", true );?></h7>
Expand Down
2 changes: 1 addition & 1 deletion inc/shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ function short_query_func( $atts ) {
<div class='".$class_thumb."'>".get_the_post_thumbnail($query2->post->ID, $thumb)."</div>";
$html .= '<div class="texto_disco ">
<h7>'
.date('d/m/Y',get_post_meta( $query2->post->ID, "agenda-event-date", true ))
.date('d/m/Y',intval(get_post_meta( $query2->post->ID, "agenda-event-date", true )))
.'</h7> -
<h7>'
.get_post_meta( $query2->post->ID, 'agenda_horario_inic', true )
Expand Down
8 changes: 7 additions & 1 deletion modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<div id="modal-quinta" class="row modal-<?php echo get_post_type();?>">
<div class=" imagem-modal col-md-4 "><?php the_post_thumbnail();?></div>
<div class="imagem-modal col-md-4 ">
<?php the_post_thumbnail();?>
<?php if($url = get_post_meta(get_the_ID(), 'soundcloud_url', true)):?>
<div class="player-soundcloud-url-modal" data-id="<?php echo get_the_ID();?>" data-url="<?php echo $url;?>" style="display:none;"></div><!-- #player-soundcloud-url-modal -->
<div class="player-soundcloud" id="play-modal-<?php echo get_the_ID();?>" data-url="<?php echo $url;?>"></div>
<?php endif;?>
</div>
<div id="container-modal-titulo" class="col-md-8">
<div id="fundo-modal-titulo" class="col-md-12">
<div class="col-md-6" id="tiangulo-modal"></div>
Expand Down

0 comments on commit 253c55d

Please sign in to comment.