Skip to content
Permalink
Browse files

Añade página que lista actividades y el template de formato caja (box)

  • Loading branch information...
numeroteca committed Jun 5, 2014
1 parent eb4e08b commit 3949812f4f15de7ac14c1e9decbb06d540562781
Showing with 126 additions and 0 deletions.
  1. +48 −0 loop.box.php
  2. +78 −0 page-actividades.php
@@ -0,0 +1,48 @@
<?php
$categories = get_the_category();
$separator = '&nbsp;';
$output = '';
$post_id = $post->ID;
$place = get_post_meta( $post_id, '_act_place', true );
$time = get_post_meta( $post_id, '_act_time', true );
$dateinit = get_post_meta( $post_id, '_act_date-init', true );
$dateend = get_post_meta( $post_id, '_act_date-end', true );
?>

<div style="width:33%;float:left;">
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
<?php if (has_post_thumbnail()) :
echo "<div class='size-thumbnail' style='margin:0 0 10px 0;width:200px'>";
the_post_thumbnail( 'medium', array('class' => 'img-responsive') );
echo "</div>";
else:
//echo '<img width="150" src="' . get_bloginfo( 'stylesheet_directory' ) . '/images/thumbnail-default.png" />';
endif; ?>
</a>
<h4>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
</h4>
<div>
<?php
echo "Lugar: ". $place;
echo " Hora: ". $time;
echo " Fecha: ". $dateinit;
echo " Fecha cierre: ". $dateend;
?>
<span class="label ">Tipo de actividad: <?php echo get_the_term_list( $post->ID, 'tipo-actividad', ' ', ', ', '' ); ?></span>
</div>
<div class="row">
<div class="col-md-12">
<?php
if($categories){
foreach($categories as $category) {
$output .= '<a href="'.get_category_link( $category->term_id ).'"title="' . esc_attr( sprintf( __( "View all posts in %s" ), $category->name ) ) . '" ><span class="label">'.$category->cat_name.'</span></a> '; //removed the ".$separator"
}
echo trim($output, $separator);
}
?>
</div>
</div>
</div>

@@ -0,0 +1,78 @@
<?php /* Template Name: Actividades */ ?>

<?php get_header(); ?>

<?php do_action( 'spacious_before_body_content' ); ?>

<div id="primary">
<div id="content" class="clearfix">
<?php while ( have_posts() ) : the_post(); ?>

<?php // get_template_part( 'content', 'page' ); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php do_action( 'spacious_before_post_content' ); ?>
<div class="entry-content clearfix">
<?php the_content(); ?>
<?php
wp_link_pages( array(
'before' => '<div style="clear: both;"></div><div class="pagination clearfix">'.__( 'Pages:', 'spacious' ),
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>'
) );
?>
</div>
<footer class="entry-meta-bar clearfix">
<div class="entry-meta clearfix">
<?php edit_post_link( __( 'Edit', 'spacious' ), '<span class="edit-link">', '</span>' ); ?>
</div>
</footer>
<?php
do_action( 'spacious_after_post_content' );
?>
<?php //Loop though Actividades
$args = array(
'post_type' => 'actividad', //sets posts type
);
if ( $paged > 1 ) {
$args['paged'] = $paged;
}
$my_query = new WP_Query($args);
if ($my_query->have_posts() ) :
$count = 0;
while ( $my_query->have_posts()) : $my_query->the_post();
$count++;
if ( $count == 1 ) { echo "<div class='row'>"; } ?>

<?php global $wp_query;
$wp_query->in_the_loop = true;
?>
<div id="post-<?php the_ID(); ?>" <?php post_class('col-md-4'); ?> >
<?php include("loop.box.php")?>
</div>
<?php if ( $count == 3 ) { echo "</div><!-- .row --><hr>"; $count = 0; }?>
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
</article>

<?php /*
do_action( 'spacious_before_comments_template' );
// If comments are open or we have at least one comment, load up the comment template
if ( comments_open() || '0' != get_comments_number() )
comments_template();
do_action ( 'spacious_after_comments_template' ); */
?>

<?php endwhile; ?>

</div><!-- #content -->
</div><!-- #primary -->

<?php spacious_sidebar_select(); ?>

<?php do_action( 'spacious_after_body_content' ); ?>

<?php get_footer(); ?>

0 comments on commit 3949812

Please sign in to comment.
You can’t perform that action at this time.