Skip to content

Instantly share code, notes, and snippets.

@TanvirAmi
Created September 15, 2017 21:54
Show Gist options
  • Save TanvirAmi/9e37ddafc3cfea9515cc14bb8d040d89 to your computer and use it in GitHub Desktop.
Save TanvirAmi/9e37ddafc3cfea9515cc14bb8d040d89 to your computer and use it in GitHub Desktop.
<div class="classic">
<article id="post-<?php the_ID(); ?>" <?php post_class( 'clearfix' ); ?> <?php hybrid_attr( 'post' ); ?>>
<?php if ( has_post_thumbnail() ) : ?>
<div class="classic-thumbnail" itemprop="image" itemscope itemtype="https://schema.org/ImageObject">
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail( 'supernews-classic', array( 'class' => 'entry-thumbnail', 'alt' => esc_attr( get_the_title() ) ) ); ?></a>
<?php
// Get the image attributes
$attr = wp_get_attachment_image_src( get_post_thumbnail_id(), 'supernews-classic' );
?>
<meta itemprop="url" content="<?php echo esc_url( $attr[0] ); ?>">
<meta itemprop="width" content="<?php echo absint( $attr[1] ); ?>">
<meta itemprop="height" content="<?php echo absint( $attr[2] ); ?>">
</div>
<?php endif; ?>
<?php the_title( sprintf( '<h2 class="entry-title" ' . hybrid_get_attr( 'entry-title' ) . '><a href="%s" rel="bookmark" itemprop="url">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>
<?php if ( 'post' == get_post_type() ) : ?>
<div class="entry-meta">
<span class="entry-date updated"><time class="entry-date published" datetime="<?php echo esc_attr( get_the_date( 'c' ) ); ?>" <?php hybrid_attr( 'entry-published' ); ?>><?php echo esc_html( get_the_date() )?></time></span>
<?php if ( ! post_password_required() && ( comments_open() || '0' != get_comments_number() ) ) : ?>
<span class="entry-comment"><?php comments_popup_link( __( '0 Comment', 'supernews' ), __( '1 Comment', 'supernews' ), __( '% Comments', 'supernews' ) ); ?></span>
<?php endif; ?>
<?php supernews_author(); ?>
<?php supernews_entry_publisher(); ?>
</div><!-- .entry-meta -->
<?php endif; ?>
<div class="entry-content" <?php hybrid_attr( 'entry-summary' ); ?>>
<?php echo wp_trim_words( get_the_excerpt(), 24 ); ?>
<div class="more-link">
<a href="<?php the_permalink(); ?>"><?php _e( 'Read the rest of this entry', 'supernews' ); ?></a>
</div><!-- .more-link -->
</div><!-- .entry-content -->
</article><!-- #post-## -->
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment