This repository has been archived by the owner on Feb 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathimage.php
87 lines (73 loc) · 3.2 KB
/
image.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
/**
* The template for displaying all attachment images.
*
* @package nano-progga
*/
get_header(); ?>
<?php $class = is_active_sidebar('right_sidebar') ? ' col-sm-9' : ' col-md-12'; ?>
<div id="primary" class="content-area <?php echo esc_attr( $class ); ?>">
<main id="main" class="site-main" role="main">
<?php
// If the image is attached to an article
$main_article = $post->post_parent;
if( $main_article != '' ) { ?>
<div class="row image-to-article-link">
<div class="col-xs-6">
<a class="back-to-article" href="<?php echo get_permalink($post->post_parent); ?>">
<span class="np-left"></span><?php _e('Get to Main Article', 'nano-progga'); ?>
</a>
</div>
<div class="col-xs-6 text-right">
<div class="block-text">
<?php _e('This is an image of an article', 'nano-progga'); ?>
<span class="np-format-aside"></span>
</div>
</div>
</div>
<?php } ?>
<?php while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
<div class="entry-meta">
<?php nano_progga_posted_on(); ?>
</div><!-- .entry-meta -->
</header><!-- .entry-header -->
<div class="entry-content">
<?php if( wp_attachment_is_image( $post->id ) ) {
$att_image = wp_get_attachment_image_src( $post->id, "full"); ?>
<div class="attachment">
<a href="<?php echo wp_get_attachment_url($post->id); ?>" title="<?php the_title(); ?>" rel="attachment">
<img src="<?php echo $att_image[0];?>" width="<?php echo $att_image[1];?>" height="<?php echo $att_image[2];?>" class="attachment-full" alt="<?php $post->post_excerpt; ?>" />
</a>
<?php if( !empty($post->post_excerpt) ) { ?>
<div class="wp-caption attachment-caption">
<span class="wp-caption-text"><?php the_excerpt(); ?></span>
</div>
<?php } ?>
</div>
<?php } else { ?>
<a href="<?php echo wp_get_attachment_url($post->ID) ?>" title="<?php echo esc_html( get_the_title($post->ID), 1 ) ?>" rel="attachment"><?php echo basename($post->guid) ?></a>
<?php } //endif( wp_attachment_is_image( $post->id ) ) ?>
<?php the_content(); ?>
<?php
wp_link_pages( array(
'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'nano-progga' ),
'after' => '</div>',
) );
?>
</div><!-- .entry-content -->
</article><!-- #post-## -->
<?php nano_progga_pagination(); ?>
<?php
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
?>
<?php endwhile; // End of the loop. ?>
</main><!-- #main -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>