Skip to content

Commit 8505fb3

Browse files
author
Cosmin
authored
Merge pull request #151 from c0sm1n87/master
added attachment page
2 parents 74bdf4a + ad1e2da commit 8505fb3

File tree

3 files changed

+92
-1
lines changed

3 files changed

+92
-1
lines changed

attachment.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
/**
3+
* The template for displaying attachments posts.
4+
*
5+
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
6+
*
7+
* @package Shapely
8+
*/
9+
10+
get_header(); ?>
11+
<?php $layout_class = shapely_get_layout_class(); ?>
12+
<div class="row">
13+
<?php
14+
if ( $layout_class == 'sidebar-left' ):
15+
get_sidebar();
16+
endif;
17+
?>
18+
<div id="primary" class="col-md-8 mb-xs-24 <?php echo esc_attr( $layout_class ); ?>"><?php
19+
while ( have_posts() ) : the_post();
20+
get_template_part( 'template-parts/content', 'attachment' );
21+
22+
// If comments are open or we have at least one comment, load up the comment template.
23+
if ( comments_open() || get_comments_number() ) :
24+
comments_template();
25+
endif;
26+
27+
endwhile; // End of the loop. ?>
28+
</div><!-- #primary -->
29+
<?php
30+
if ( $layout_class == 'sidebar-right' ):
31+
get_sidebar();
32+
endif;
33+
?>
34+
</div>
35+
<?php
36+
get_footer();

style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Theme URI: https://colorlib.com/wp/themes/shapely
44
Author: colorlib
55
Author URI: https://colorlib.com/
66
Description: Shapely is a powerful and versatile one page WordPress theme with pixel perfect design and outstanding functionality. It is by far the most advanced free WordPress theme available today with loads of unmatched customization options. This theme comes with several homepage widgets that can be used to add portfolio, testimonials, parallax sections, your product or service information, call for action and much more. Shapely supports most free and premium WordPress plugins such as WooCommerce, Jetpack, Gravity Forms, Contact Form 7, Yoast SEO, Google Analytics by Yoast and much more. This theme is the best suited for business, landing page, portfolio, ecommerce, store, local business, personal websites but can be tweaked to be used as blog, magazine or any other awesome website while highlighting its unique one page setup. This is going to be the last WordPress theme you will ever want to use because it is so much better than anything you have seen. Needless to say that this theme is SEO friendly thanks to its well optimized strucutre. Shapely theme is mobile friendly and fully responsive making it your best multipurpose partnert for any project and website.
7-
Version: 1.1.1
7+
Version: 1.1.2
88
License: GNU General Public License v3
99
License URI: http://www.gnu.org/licenses/gpl-2.0.html
1010
Text Domain: shapely
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
/**
3+
* Template part for displaying attachment page
4+
*
5+
* @link https://codex.wordpress.org/Template_Hierarchy
6+
*
7+
* @package Shapely
8+
*/
9+
10+
?>
11+
12+
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
13+
<header class="entry-header">
14+
<?php
15+
if ( has_post_thumbnail() ) { ?>
16+
<a class="text-center" href="<?php the_permalink(); ?>"
17+
title="<?php the_title_attribute( array( 'echo' => false ) ); ?>"><?php
18+
the_post_thumbnail( 'shapely-featured', array( 'class' => 'mb24' ) ); ?>
19+
</a><?php
20+
}
21+
?>
22+
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
23+
</header><!-- .entry-header -->
24+
25+
<div class="entry-content">
26+
<?php
27+
$image = wp_get_attachment_image( get_the_ID(), 'full' );
28+
echo wp_kses_post( $image );
29+
30+
wp_link_pages( array(
31+
'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'shapely' ),
32+
'after' => '</div>',
33+
) );
34+
?>
35+
</div><!-- .entry-content -->
36+
<?php
37+
if ( is_single() ):
38+
$prev = get_previous_post_link();
39+
$prev = str_replace( '&laquo;', '<div class="wrapper"><span class="fa fa-angle-left"></span>', $prev );
40+
$prev = str_replace( '</a>', '</a></div>', $prev );
41+
$next = get_next_post_link();
42+
$next = str_replace( '&raquo;', '<span class="fa fa-angle-right"></span></div>', $next );
43+
$next = str_replace( '<a', '<div class="wrapper"><a', $next );
44+
?>
45+
<hr/>
46+
<div class="shapely-next-prev row">
47+
<div class="col-md-6 text-left">
48+
<?php echo wp_kses_post( $prev ) ?>
49+
</div>
50+
<div class="col-md-6 text-right">
51+
<?php echo wp_kses_post( $next ) ?>
52+
</div>
53+
</div>
54+
<?php endif; ?>
55+
</article><!-- #post-## -->

0 commit comments

Comments
 (0)