From 03c601ff8bcd4745337c4caaf4167f5b838a6908 Mon Sep 17 00:00:00 2001 From: Jacson Passold Date: Fri, 4 Jan 2019 19:45:33 -0200 Subject: [PATCH] try to fix cycle, get first imagem when do not have thumbnail, look at #89 item 5 --- assets/styles/geral.css | 25 ++++++++++++++++--------- functions.php | 23 +++++++++++++++++++++++ templates/content-home.php | 4 +--- 3 files changed, 40 insertions(+), 12 deletions(-) diff --git a/assets/styles/geral.css b/assets/styles/geral.css index 2dbbd2f..8093e86 100644 --- a/assets/styles/geral.css +++ b/assets/styles/geral.css @@ -292,6 +292,11 @@ aside .titulo { margin: 0; z-index: 2; } + +.cycles-slide.cycle-slide { + margin-top: 0 !important; +} + .cycle-slideshow { height: 650px; width: 100%; @@ -299,12 +304,13 @@ aside .titulo { } .cycle-slideshow .cycle-pager { position: absolute; - top: 550px; + top: 480px; right: 10px; font-size: 80px; color: #fff; z-index: 200; cursor: pointer; + text-shadow: -1px 0 #ccc, 0 1px #ccc, 1px 0 #ccc, 0 -1px #ccc; } .cycle-slideshow .cycle-pager .cycle-pager-active { @@ -316,15 +322,13 @@ aside .titulo { } .cycle-slideshow li img { display: block; - height: auto; - margin-top: -100px; - min-height: 650px; + height: 550px; width: 100%; min-width: 1140px; } .cycle-slideshow .bd { position: absolute; - top: 630px; + top: 550px; padding: 10px 10px 10px 20px; height: 120px; width: 100%; @@ -336,6 +340,8 @@ aside .titulo { text-align: center; background-color: #003e2d; width: 10%; + position: absolute; + top: 0; } .cycle-slideshow .entry-meta a { font-weight: bold; @@ -343,18 +349,19 @@ aside .titulo { text-decoration: none; } .cycle-slideshow .entry-title { - margin-top: 10px; + margin-top: 24px; font-size: 22px; - width: 70%; + width: 80%; } .cycle-slideshow .entry-title a { font-weight: bold; color: #003e2d; } .cycle-slideshow .btn-saibamais { - margin-top: -50px; - float: right; width: 17%; + position: absolute; + right: 1em; + bottom: 2em; } .cycle-slideshow .btn-saibamais a { font-weight: bold; diff --git a/functions.php b/functions.php index 272a948..5c66c19 100644 --- a/functions.php +++ b/functions.php @@ -247,3 +247,26 @@ function save_custom_meta_data($id) { function update_edit_form() { echo ' enctype="multipart/form-data"'; } + +function aspta_get_post_thumbnail() { + if ( has_post_thumbnail() ) { + the_post_thumbnail('destaque'); + } else { + global $post; + $size = 'post-thumbnail'; + // No post thumbnail, try attachments instead. + $images = get_posts( + array( + 'post_type' => 'attachment', + 'post_mime_type' => 'image', + 'post_parent' => $post->ID, + 'posts_per_page' => 1, /* Save memory, only need one */ + ) + ); + + if ( $images ) { + $size = apply_filters( 'post_thumbnail_size', $size, $post->ID ); + echo wp_get_attachment_image($images[0]->ID, $size, false, ''); + } + } +} diff --git a/templates/content-home.php b/templates/content-home.php index 3b68e04..08507de 100644 --- a/templates/content-home.php +++ b/templates/content-home.php @@ -99,9 +99,7 @@
- +