Skip to content

Commit

Permalink
single page view and page templates
Browse files Browse the repository at this point in the history
  • Loading branch information
hasinhayder committed May 23, 2018
1 parent a790277 commit ad3d5de
Show file tree
Hide file tree
Showing 7 changed files with 199 additions and 17 deletions.
72 changes: 72 additions & 0 deletions about-page-template.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php
/*
* Template Name: About Page Template
*/
get_header();
?>
<body <?php body_class(); ?>>
<?php get_template_part( "hero-page" ); ?>

<div class="posts">
<?php
while ( have_posts() ) :
the_post();
?>
<div class="post" <?php post_class(); ?>>
<div class="container">
<div class="row">
<div class="col-md-10 offset-md-1">
<h2 class="post-title text-center">
<?php the_title(); ?>
</h2>
<p class="text-center">
<em><?php the_author(); ?></em><br/>
<?php echo get_the_date(); ?>
</p>
</div>
</div>
<div class="row">
<div class="col-md-10 offset-md-1">
<p>
<?php
if ( has_post_thumbnail() ) {
$thumbnail_url = get_the_post_thumbnail_url( null, "large" );
printf( '<a class="popup" href="%s" data-featherlight="image">', $thumbnail_url );
the_post_thumbnail( "large", array( "class" => "img-fluid" ) );
echo '</a>';
}

the_content();

/*next_post_link();
echo "<br/>";
previous_post_link();*/

?>
</p>
</div>
</div>
</div>
</div>
<?php
endwhile;
?>

<div class="container post-pagination">
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-8">
<?php
the_posts_pagination( array(
"screen_reader_text" => ' ',
"prev_text" => "New Posts",
"next_text" => "Old Posts"
) );
?>
</div>
</div>
</div>
</div>


<?php get_footer(); ?>
4 changes: 2 additions & 2 deletions assets/js/main.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
; (function($){
$(document).ready(function(){
$(".popup").each(function(){
/*$(".popup").each(function(){
var image = $(this).find("img").attr("src");
$(this).attr("href",image);
});
});*/
});
})(jQuery);
34 changes: 34 additions & 0 deletions hero-page.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
$alpha_feat_image = get_the_post_thumbnail_url(null,"large");
?>
<div class="header page-header" style="background-image: url(<?php echo $alpha_feat_image;?>);">
<div class="container">
<div class="row">
<div class="col-md-12">
<h3 class="tagline">
<?php bloginfo( "description" ); ?>
</h3>
<h1 class="align-self-center display-1 text-center heading">
<a href="<?php echo site_url(); ?>"><?php bloginfo( "name" ); ?></a>
</h1>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="navigation">
<?php
wp_nav_menu(
array(
'theme_location' => 'topmenu',
'menu_id' => 'topmenucontainer',
'menu_class' => 'list-inline text-center',
)
);
?>
</div>
</div>
</div>
</div>
5 changes: 2 additions & 3 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@
<p>
<?php
if ( has_post_thumbnail() ) {
//$thumbnail_url = get_the_post_thumbnail_url(null,"large");
//echo '<a href="'.$thumbnail_url.'" data-featherlight="image">';
echo '<a class="popup" href="#" data-featherlight="image">';
$thumbnail_url = get_the_post_thumbnail_url(null,"large");
printf( '<a href="%s" data-featherlight="image">', $thumbnail_url);
the_post_thumbnail( "large", array( "class" => "img-fluid" ) );
echo '</a>';
}
Expand Down
67 changes: 67 additions & 0 deletions page.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php get_header(); ?>
<body <?php body_class(); ?>>
<?php get_template_part( "hero" ); ?>

<div class="posts">
<?php
while ( have_posts() ) :
the_post();
?>
<div class="post" <?php post_class(); ?>>
<div class="container">
<div class="row">
<div class="col-md-10 offset-md-1">
<h2 class="post-title text-center">
<?php the_title(); ?>
</h2>
<p class="text-center">
<em><?php the_author(); ?></em><br/>
<?php echo get_the_date(); ?>
</p>
</div>
</div>
<div class="row">
<div class="col-md-10 offset-md-1">
<p>
<?php
if ( has_post_thumbnail() ) {
$thumbnail_url = get_the_post_thumbnail_url( null, "large" );
printf( '<a class="popup" href="%s" data-featherlight="image">', $thumbnail_url );
the_post_thumbnail( "large", array( "class" => "img-fluid" ) );
echo '</a>';
}

the_content();

/*next_post_link();
echo "<br/>";
previous_post_link();*/

?>
</p>
</div>
</div>
</div>
</div>
<?php
endwhile;
?>

<div class="container post-pagination">
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-8">
<?php
the_posts_pagination( array(
"screen_reader_text" => ' ',
"prev_text" => "New Posts",
"next_text" => "Old Posts"
) );
?>
</div>
</div>
</div>
</div>


<?php get_footer(); ?>
23 changes: 11 additions & 12 deletions single.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@
<p>
<?php
if ( has_post_thumbnail() ) {
//$thumbnail_url = get_the_post_thumbnail_url(null,"large");
//echo '<a href="'.$thumbnail_url.'" data-featherlight="image">';
echo '<a class="popup" href="#" data-featherlight="image">';
$thumbnail_url = get_the_post_thumbnail_url(null,"large");
printf( '<a class="popup" href="%s" data-featherlight="image">',$thumbnail_url);
the_post_thumbnail( "large", array( "class" => "img-fluid" ) );
echo '</a>';
}
Expand All @@ -43,13 +42,13 @@
?>
</p>
</div>
<?php /*if ( comments_open() ): */?><!--
<div class="col-md-10 offset-md-1">
<?php
/* comments_template();
*/?>
</div>
--><?php /*endif; */?>
<?php if ( comments_open() ): ?>
<div class="col-md-10 offset-md-1">
<?php
comments_template();
?>
</div>
<?php endif; ?>
</div>
</div>
</div>
Expand All @@ -75,8 +74,8 @@
</div>
<div class="col-md-4">
<?php
if(is_active_sidebar("sidebar-1")){
dynamic_sidebar("sidebar-1");
if ( is_active_sidebar( "sidebar-1" ) ) {
dynamic_sidebar( "sidebar-1" );
}
?>
</div>
Expand Down
11 changes: 11 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,15 @@ h2.post-title {

.tags li{
color: #3D9970;
}

.page-header{
background-position: center;
background-size: cover;
margin-bottom:30px;
padding:170px 0px;
}
.page-header h1.heading a{
color: #222;
text-decoration: none;
}

0 comments on commit ad3d5de

Please sign in to comment.