diff --git a/inc/template-tags.php b/inc/template-tags.php index a1e3756..141e508 100644 --- a/inc/template-tags.php +++ b/inc/template-tags.php @@ -265,16 +265,22 @@ function thegatherings_get_post_card() { $name = $type['name']; $slug = $type['slug']; + $credits = thegatherings_get_credits(); return - '' . - '' . - '
' . - '
' . thegatherings_get_post_date( $name ) . '
' . - $title . - '
' . thegatherings_get_teaser(true) . '
' . + '
' . + '
' . $credits . '
' . + '
' . - ''; + '
'; } endif; @@ -360,5 +366,34 @@ function thegatherings_get_teaser( $strip_tags = false, $post = null ) { } endif; -if ( ! function_exists ( 'thegatherings_the_excerpt' ) ) : +if ( ! function_exists ( 'thegatherings_get_credits' ) ) : +function thegatherings_get_credits() { + $image_id = get_post_thumbnail_id(); + $image_post = get_post($image_id); + $credits = $image_post->post_content; + if ( ! empty( $credits ) ) { + $credits = explode( '|', $credits ); + $credits = trim( $credits[0] ) == 'unsplash' + ? thegatherings_unsplash_credit( trim( $credits[1] ), trim( $credits[2] ) ) + : ''; + } + return $credits; +} +endif; + +if ( ! function_exists ( 'thegatherings_unsplash_credit' ) ) : +function thegatherings_unsplash_credit( $name, $id ) { + return + '' . + '' . + '' . + 'unsplash-logo' . + '' . + '' . + '' . + '' . $name . '' . + ''; +} endif; diff --git a/sass/bootstrap/_cards.scss b/sass/bootstrap/_cards.scss index 8ecacf9..7e1aa75 100644 --- a/sass/bootstrap/_cards.scss +++ b/sass/bootstrap/_cards.scss @@ -1,21 +1,22 @@ -a.card { - color: $light-gray; - display: block; - text-decoration: none; -} - - .card { border: none; margin: 0 0.9rem 2rem 0.9rem; } -.card:hover img { - -webkit-filter: contrast(110%) saturate(130%); - filter: contrast(110%) saturate(130%); -} .card-body { padding: 0.15rem; } +.card-content { + & a { + color: $light-gray; + display: block; + text-decoration: none; + + &:hover img { + -webkit-filter: contrast(110%) saturate(130%); + filter: contrast(110%) saturate(130%); + } + } +} .card-subtitle { margin-top: 0; } diff --git a/sass/modules/_utility.scss b/sass/modules/_utility.scss index c4f85a2..befe6f9 100644 --- a/sass/modules/_utility.scss +++ b/sass/modules/_utility.scss @@ -5,3 +5,36 @@ .hover-show, a:hover .hover-hide { display: none; } + +.credits-container { + position: relative; +} +.credits { + opacity:0.45; + position:absolute; + right:5px; + top:5px; + z-index:42; +} + +.unsplash-credit { + background-color:black; + color:white !important; + text-decoration:none; + padding:2px 4px; + font-family:-apple-system, BlinkMacSystemFont, "San Francisco", "Helvetica Neue", Helvetica, Ubuntu, Roboto, Noto, "Segoe UI", Arial, sans-serif; + font-size:0.7em; + font-weight:bold; + line-height:1.2; + display:inline-block; + border-radius:3px; + + &:hover .unsplash-credit-name { + display:inline-block; + padding:2px 3px; + } +} + +.unsplash-credit-name { + display:none; +} diff --git a/sass/style.scss b/sass/style.scss index 890ba87..892a95b 100644 --- a/sass/style.scss +++ b/sass/style.scss @@ -4,7 +4,7 @@ Theme URI: http://underscores.me/ Author: Brendan Dixon Author URI: http://thegatherings.place/ Description: Description -Version: 1.1.3 +Version: 1.1.4 License: GNU General Public License v2 or later License URI: LICENSE Text Domain: thegatherings diff --git a/style.css b/style.css index d7415e7..3286602 100644 --- a/style.css +++ b/style.css @@ -4,7 +4,7 @@ Theme URI: http://underscores.me/ Author: Brendan Dixon Author URI: http://thegatherings.place/ Description: Description -Version: 1.1.3 +Version: 1.1.4 License: GNU General Public License v2 or later License URI: LICENSE Text Domain: thegatherings @@ -131,22 +131,49 @@ h2 { .hover-show, a:hover .hover-hide { display: none; } -a.card { - color: rgba(74, 74, 74, 0.95); - display: block; - text-decoration: none; } +.credits-container { + position: relative; } + +.credits { + opacity: 0.45; + position: absolute; + right: 5px; + top: 5px; + z-index: 42; } + +.unsplash-credit { + background-color: black; + color: white !important; + text-decoration: none; + padding: 2px 4px; + font-family: -apple-system, BlinkMacSystemFont, "San Francisco", "Helvetica Neue", Helvetica, Ubuntu, Roboto, Noto, "Segoe UI", Arial, sans-serif; + font-size: 0.7em; + font-weight: bold; + line-height: 1.2; + display: inline-block; + border-radius: 3px; } + .unsplash-credit:hover .unsplash-credit-name { + display: inline-block; + padding: 2px 3px; } + +.unsplash-credit-name { + display: none; } .card { border: none; margin: 0 0.9rem 2rem 0.9rem; } -.card:hover img { - -webkit-filter: contrast(110%) saturate(130%); - filter: contrast(110%) saturate(130%); } - .card-body { padding: 0.15rem; } +.card-content a { + color: rgba(74, 74, 74, 0.95); + display: block; + text-decoration: none; } + .card-content a:hover img { + -webkit-filter: contrast(110%) saturate(130%); + filter: contrast(110%) saturate(130%); } + .card-subtitle { margin-top: 0; } diff --git a/template-parts/content-header.php b/template-parts/content-header.php index e103600..49e8079 100644 --- a/template-parts/content-header.php +++ b/template-parts/content-header.php @@ -12,7 +12,8 @@
-
+
+