Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 116 additions & 0 deletions web/app/themes/mitlib-news/archive-bibliotech.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<?php
/**
* The template for displaying Archive pages.
*
* Used to display archive-type pages if nothing more specific matches a query.
* For example, puts together date-based pages if no date.php file exists.
*
* If you'd like to further customize these archive views, you may create a
* new template file for each specific one. For example, Twenty Twelve already
* has tag.php for Tag archives, category.php for Category archives, and
* author.php for Author archives.
*
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package MITLibraries-News
* @since 1.0
*/

get_header();
$date = DateTime::createFromFormat( 'Ymd', get_field( 'event_date' ) );

/**
* Trim a post excerpt at a provided length.
*
* @param int $charlength The length of desired excerpt.
*/
function the_excerpt_max_charlength( $charlength ) {
$excerpt = get_the_excerpt();
$charlength++;

if ( mb_strlen( $excerpt ) > $charlength ) {
$subex = mb_substr( $excerpt, 0, $charlength - 5 );
$exwords = explode( ' ', $subex );
$excut = - ( mb_strlen( $exwords[ count( $exwords ) - 1 ] ) );
if ( $excut < 0 ) {
echo mb_substr( $subex, 0, $excut );
} else {
return $subex;
}
echo '[...]' ;
} else {
return $excerpt;
}
}


?>
<?php get_template_part( 'inc/sub-header' ); ?>

<section id="primary" class="site-content">
<div id="content" role="main">
<?php if ( have_posts() ) : ?>
<header class="archive-header">
<h2>
<?php
if ( is_day() ) :
printf( __( 'Daily Archives: %s', 'twentytwelve' ), '<span>' . get_the_date() . '</span>' );
elseif ( is_month() ) :
printf( __( 'Monthly Archives: %s', 'twentytwelve' ), '<span>' . get_the_date( _x( 'F Y', 'monthly archives date format', 'twentytwelve' ) ) . '</span>' );
elseif ( is_year() ) :
printf( __( 'Yearly Archives: %s', 'twentytwelve' ), '<span>' . get_the_date( _x( 'Y', 'yearly archives date format', 'twentytwelve' ) ) . '</span>' );
else :
_e( 'Archives', 'twentytwelve' );
endif;
?>
</h2>
</header>
<!-- .archive-header -->
<div class="mit-container">
<?php while ( have_posts() ) : the_post(); ?>
<div class="flex-item blueTop eventsBox <?php echo esc_attr( check_image() ); ?>"
onClick='location.href="<?php echo get_post_permalink(); ?>"'>
<?php if ( get_field( 'mark_as_new' ) === true ) : ?>
<?php endif; ?>
<?php if ( has_post_thumbnail() ) {
$thumb_id = get_post_thumbnail_id();
$thumb_url_array = wp_get_attachment_image_src( $thumb_id, 'thumbnail-size', true );
$thumb_url = $thumb_url_array[0];

?>
<img src="<?php echo $thumb_url; ?>" width="100%" height="200" />
<?php } ?>
<h2 class="title-post">
<?php the_title(); ?>
</h2>
<br />
<div class="excerpt-post">
<?php the_excerpt_max_charlength( 140 ); ?>
</div>
<div class="category-post">
<?php
$category = get_the_category();
if ( $category[0] ) {
echo '<a href="' . get_category_link( $category[0]->term_id ) . '">' . $category[0]->cat_name . '</a>';
}
?>
<span class="mitDate">&nbsp;&nbsp;<?php echo get_the_date(); ?></span>
<!--echo all the cat -->

</div>
</div>
<!-- eventsBox -->
<?php endwhile; ?>
<?php else : ?>
<?php get_template_part( 'content', 'none' ); ?>
<?php endif; ?>
</div>
<!-- MITContainer -->

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

<?php get_sidebar(); ?>
<?php get_footer(); ?>
159 changes: 159 additions & 0 deletions web/app/themes/mitlib-news/archive.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
<?php
/**
* The template for displaying Archive pages.
* also bibliotech cat pages
*
* Used to display archive-type pages if nothing more specific matches a query.
* For example, puts together date-based pages if no date.php file exists.
*
* If you'd like to further customize these archive views, you may create a
* new template file for each specific one. For example, Twenty Twelve already
* has tag.php for Tag archives, category.php for Category archives, and
* author.php for Author archives.
*
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package MITLibraries-News
* @since Twenty Twelve 1.0
*/

get_header();
$date = DateTime::createFromFormat( 'Ymd', get_field( 'event_date' ) );


?>
<?php get_template_part( 'inc/sub-header' ); ?>
<?php
if ( (get_post_type( get_the_ID() ) == 'bibliotech') || (cat_is_ancestor_of( 73, $cat ) or is_category( 73 )) ) { ?>
<?php get_template_part( 'inc/bib-header' ); ?>
<?php } ?>



<section id="" class="site-content">
<div id="content" role="main">
<?php if ( have_posts() ) : ?>

<!-- .archive-header -->
<div class="container">
<div class="row">


<?php
$i = -1;


while ( have_posts() ) : the_post();

$i++;


?>

<div class="<?php if ( 0 == $i % 3 ) { echo 'third '; } ?> col-xs-12 col-xs-B-6 col-sm-4 col-md-4 no-padding-left-mobile">
<div class="hentry flex-item blueTop eventsBox <?php echo esc_attr( check_image() ); ?>"
onClick='location.href="<?php if ( ( '' != get_field( 'external_link' ) ) && 'spotlights' == $post->post_type ) { the_field( 'external_link' );
} else { echo get_post_permalink();} ?>"'>




<?php get_template_part( 'inc/spotlights' ); ?>

<?php
if ( get_field( 'listImg' ) != '' ) { ?>
<img src="<?php the_field( 'listImg' ); ?>" width="100%" height="111" class="img-responsive" alt="<?php the_title(); ?>"/>
<?php } ?>


<?php if ( 'spotlights' == $post->post_type ) { ?>
<h2 class="entry-title title-post spotlights">
<a href="<?php the_field( 'external_link' ); ?>"><?php the_title();?></a>
</h2>
<?php } else { ?>
<h2 class="entry-title title-post">
<a href="<?php the_permalink(); ?>"><?php the_title();?></a>
</h2>
<?php } ?>

<?php get_template_part( 'inc/events' ); ?>

<?php get_template_part( 'inc/entry' ); ?>

<!--final **** else-->
<?php { ?>
<!--EVENT -->
<?php } ?>





<div class="category-post">
<?php
$category = get_the_category(); if ( $category[0] ) {
echo '<a title="' . $category[0]->cat_name . '" title="' . $category[0]->cat_name . '" href="' . get_category_link( $category[0]->term_id ) . '">' . $category[0]->cat_name . '</a>';
}
?>
<span class="mitDate">
<time class="updated" datetime="<?php echo get_the_date(); ?>">&nbsp;&nbsp;<?php echo get_the_date(); ?></time>
</span>
</div>
</div>
</div>
<!-- eventsBox -->
<?php endwhile; ?>
<?php else : ?>
<?php get_template_part( 'content', 'none' ); ?>
<?php endif; ?>
</div>
<!-- MITContainer -->
</div><!--closes row-->
</div>
<!-- #content -->
</section>
<!-- #primary -->




<?php

if ( $i > 7 ) {

get_template_part( 'inc/more-posts' );

}
?>


</div>
<!-- wrap -->
<script>
$(document).ready(function() {
var offset = 11;
var limit = 9;
//$("#postContainer").load("/news/add-bibliotech-posts/");
$("#another").click(function(){
limit = limit+9;
offset = offset+11;
$("#postContainer")
//.slideUp()
.load("/news/more-archives/?offset="+offset+"&limit="+limit, function() {
//.load("/news/test/?offset="+offset, function() {
$(this).slideDown();




});



return false;
});

});
</script>
<div class="container">
<?php get_footer(); ?>
Loading