Skip to content

Commit

Permalink
Add support to Pages for Featured Images and Post Covers. See #171.
Browse files Browse the repository at this point in the history
  • Loading branch information
raamdev committed Dec 29, 2014
1 parent a780b3d commit 20a069f
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 95 deletions.
7 changes: 6 additions & 1 deletion content-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@
?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php if ( has_post_thumbnail() && ! independent_publisher_has_full_width_featured_image() ) : ?>
<?php the_post_thumbnail( 'independent_publisher_post_thumbnail', array( 'itemprop' => 'image' ) ); ?>
<?php endif; ?>
<header class="entry-header">
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php if ( ! independent_publisher_post_has_post_cover_title() ): ?>
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php endif; ?>
</header>
<!-- .entry-header -->

Expand Down
2 changes: 1 addition & 1 deletion functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ function independent_publisher_comments_call_to_action_text() {
function independent_publisher_has_full_width_featured_image() {

// If this isn't a Single post type or we don't have a Featured Image set
if ( ! is_single() || ! has_post_thumbnail() ) {
if ( ! ( is_single() || is_page() ) || ! has_post_thumbnail() ) {
return false;
}

Expand Down
44 changes: 23 additions & 21 deletions inc/template-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -554,27 +554,29 @@ function independent_publisher_full_width_featured_image() {
<?php echo $subtitle;?>
</h2>
<?php endif; ?>
<h3 class="entry-title-meta">
<span class="entry-title-meta-author">
<a class="author-avatar" href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>">
<?php echo get_avatar( get_the_author_meta( 'ID' ), 32 ); ?>
</a>
<?php
if ( ! independent_publisher_categorized_blog() ) {
echo independent_publisher_entry_meta_author_prefix() . ' ';
}
independent_publisher_posted_author();
?>
</span>
<?php if ( independent_publisher_categorized_blog() ) {
echo independent_publisher_entry_meta_category_prefix() . ' ' . independent_publisher_post_categories( '', true );
} ?>
<span class="entry-title-meta-post-date">
<span class="sep"> <?php echo apply_filters( 'independent_publisher_entry_meta_separator', '|' ); ?> </span>
<?php independent_publisher_posted_on_date() ?>
</span>
<?php do_action( 'independent_publisher_entry_title_meta', $separator = ' | ' ); ?>
</h3>
<?php if ( ! is_page() ) : ?>
<h3 class="entry-title-meta">
<span class="entry-title-meta-author">
<a class="author-avatar" href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>">
<?php echo get_avatar( get_the_author_meta( 'ID' ), 32 ); ?>
</a>
<?php
if ( ! independent_publisher_categorized_blog() ) {
echo independent_publisher_entry_meta_author_prefix() . ' ';
}
independent_publisher_posted_author();
?>
</span>
<?php if ( independent_publisher_categorized_blog() ) {
echo independent_publisher_entry_meta_category_prefix() . ' ' . independent_publisher_post_categories( '', true );
} ?>
<span class="entry-title-meta-post-date">
<span class="sep"> <?php echo apply_filters( 'independent_publisher_entry_meta_separator', '|' ); ?> </span>
<?php independent_publisher_posted_on_date() ?>
</span>
<?php do_action( 'independent_publisher_entry_title_meta', $separator = ' | ' ); ?>
</h3>
<?php endif; ?>
</header>
</div>
</div>
Expand Down
43 changes: 30 additions & 13 deletions rtl.css
Original file line number Diff line number Diff line change
Expand Up @@ -2219,14 +2219,17 @@ table th {
* Styles to apply when Post Cover Title is enabled.
*/

.single.post-cover-overlay-post-title .entry-title-meta {
.single.post-cover-overlay-post-title .entry-title-meta,
.page.post-cover-overlay-post-title .entry-title-meta {
display: none;
}
.single.post-cover-overlay-post-title .post-cover-title-wrapper {
.single.post-cover-overlay-post-title .post-cover-title-wrapper,
.page.post-cover-overlay-post-title .post-cover-title-wrapper {
position: relative;
background: #000
}
.single.post-cover-overlay-post-title .post-cover-title-image {
.single.post-cover-overlay-post-title .post-cover-title-image,
.page.post-cover-overlay-post-title .post-cover-title-image {
position: relative;
background: no-repeat center center;
-webkit-background-size: cover;
Expand All @@ -2237,7 +2240,8 @@ table th {
height: 75vh;
opacity: 0.75;
}
.single.post-cover-overlay-post-title .post-cover-title-head {
.single.post-cover-overlay-post-title .post-cover-title-head,
.page.post-cover-overlay-post-title .post-cover-title-head {
position: absolute;
bottom: 0;
left: 0;
Expand All @@ -2247,44 +2251,57 @@ table th {
background-image: -webkit-linear-gradient(transparent 0%,#000 200%);
background-image: linear-gradient(transparent 0%,#000 200%);
}
.single.post-cover-overlay-post-title .post-cover-title-head .post-cover-title {
.single.post-cover-overlay-post-title .post-cover-title-head .post-cover-title,
.page.post-cover-overlay-post-title .post-cover-title-head .post-cover-title {
margin: 0 auto;
padding: 20px 40px;
max-width: 700px;
}
.single.post-cover-overlay-post-title .post-cover-title-head .entry-subtitle,
.single.post-cover-overlay-post-title .post-cover-title-head .entry-title {
.single.post-cover-overlay-post-title .post-cover-title-head .entry-title
.page.post-cover-overlay-post-title .post-cover-title-head .entry-subtitle,
.page.post-cover-overlay-post-title .post-cover-title-head .entry-title {
padding: 20px 0 5px;
color:#fff;
margin: 0;
}
.single.post-cover-overlay-post-title .post-cover-title-head .entry-subtitle {
.single.post-cover-overlay-post-title .post-cover-title-head .entry-subtitle,
.page.post-cover-overlay-post-title .post-cover-title-head .entry-subtitle {
font-weight: lighter;
padding: 5px 0 10px;
font-family: Georgia, "Times New Roman", Times, serif;
font-style: italic;
}
.single.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta {
.single.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta,
.page.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta {
height: 32px;
line-height: 32px;
display: block;
margin-top: 20px;
}
.single.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta-author {
.single.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta-author,
.page.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta-author {
display: inline;
}
.single.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta img {
.single.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta img,
.page.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta img {
float: right;
margin-left: 10px;
}
.single.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta,
.single.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta a {
.single.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta a,
.page.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta,
.page.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta a {
color: rgba(255,255,255,0.80);
}
.single.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta a:hover {
.single.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta a:hover,
.page.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta a:hover {
text-decoration: underline;
}

.page.post-cover-overlay-post-title h1.entry-title,
.page.full-width-featured-image h1.entry-title {
font-size: 2.5em;
}

/**
* Social menu styles; uses Genericons in font/genericons/
Expand Down
136 changes: 77 additions & 59 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2226,70 +2226,88 @@ table th {
* Styles to apply when Post Cover Title is enabled.
*/

.single.post-cover-overlay-post-title .entry-title-meta {
display: none;
}
.single.post-cover-overlay-post-title .post-cover-title-wrapper {
position: relative;
background: #000
}
.single.post-cover-overlay-post-title .post-cover-title-image {
position: relative;
background: no-repeat center center;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
width: 100%;
height: 75vh;
opacity: 0.75;
}
.single.post-cover-overlay-post-title .post-cover-title-head {
position: absolute;
bottom: 0;
left: 0;
right: 0;
padding-bottom: 20px;
background-color: transparent;
background-image: -webkit-linear-gradient(transparent 0%,#000 200%);
background-image: linear-gradient(transparent 0%,#000 200%);
}
.single.post-cover-overlay-post-title .post-cover-title-head .post-cover-title {
margin: 0 auto;
padding: 20px 40px;
max-width: 700px;
.single.post-cover-overlay-post-title .entry-title-meta,
.page.post-cover-overlay-post-title .entry-title-meta {
display: none;
}
.single.post-cover-overlay-post-title .post-cover-title-wrapper,
.page.post-cover-overlay-post-title .post-cover-title-wrapper {
position: relative;
background: #000
}
.single.post-cover-overlay-post-title .post-cover-title-image,
.page.post-cover-overlay-post-title .post-cover-title-image {
position: relative;
background: no-repeat center center;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
width: 100%;
height: 75vh;
opacity: 0.75;
}
.single.post-cover-overlay-post-title .post-cover-title-head,
.page.post-cover-overlay-post-title .post-cover-title-head {
position: absolute;
bottom: 0;
left: 0;
right: 0;
padding-bottom: 20px;
background-color: transparent;
background-image: -webkit-linear-gradient(transparent 0%,#000 200%);
background-image: linear-gradient(transparent 0%,#000 200%);
}
.single.post-cover-overlay-post-title .post-cover-title-head .post-cover-title,
.page.post-cover-overlay-post-title .post-cover-title-head .post-cover-title {
margin: 0 auto;
padding: 20px 40px;
max-width: 700px;
}
.single.post-cover-overlay-post-title .post-cover-title-head .entry-subtitle,
.single.post-cover-overlay-post-title .post-cover-title-head .entry-title,
.page.post-cover-overlay-post-title .post-cover-title-head .entry-subtitle,
.page.post-cover-overlay-post-title .post-cover-title-head .entry-title {
padding: 20px 0 5px;
color:#fff;
margin: 0;
}
.single.post-cover-overlay-post-title .post-cover-title-head .entry-subtitle,
.single.post-cover-overlay-post-title .post-cover-title-head .entry-title {
padding: 20px 0 5px;
color:#fff;
margin: 0;
}
.single.post-cover-overlay-post-title .post-cover-title-head .entry-subtitle {
font-weight: lighter;
padding: 5px 0 10px;
font-family: Georgia, "Times New Roman", Times, serif;
font-style: italic;
}
.single.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta {
height: 32px;
line-height: 32px;
display: block;
margin-top: 20px;
}
.single.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta-author {
display: inline;
}
.single.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta img {
float: left;
margin-right: 10px;
.page.post-cover-overlay-post-title .post-cover-title-head .entry-subtitle {
font-weight: lighter;
padding: 5px 0 10px;
font-family: Georgia, "Times New Roman", Times, serif;
font-style: italic;
}
.single.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta,
.page.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta {
height: 32px;
line-height: 32px;
display: block;
margin-top: 20px;
}
.single.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta-author,
.page.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta-author {
display: inline;
}
.single.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta img,
.page.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta img {
float: left;
margin-right: 10px;
}
.single.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta,
.single.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta a {
color: rgba(255,255,255,0.80);
.single.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta a,
.page.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta,
.page.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta a {
color: rgba(255,255,255,0.80);
}
.single.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta a:hover,
.page.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta a:hover {
text-decoration: underline;
}
.single.post-cover-overlay-post-title .post-cover-title-head .entry-title-meta a:hover {
text-decoration: underline;
.page.post-cover-overlay-post-title h1.entry-title,
.page.full-width-featured-image h1.entry-title {
font-size: 2.5em;
}


Expand Down

0 comments on commit 20a069f

Please sign in to comment.