Skip to content

Commit

Permalink
try to fix cycle, get first imagem when do not have thumbnail, look at
Browse files Browse the repository at this point in the history
…#89 item 5
  • Loading branch information
jacsonp committed Jan 4, 2019
1 parent 8b82c72 commit 03c601f
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 12 deletions.
25 changes: 16 additions & 9 deletions assets/styles/geral.css
Original file line number Diff line number Diff line change
Expand Up @@ -292,19 +292,25 @@ aside .titulo {
margin: 0;
z-index: 2;
}

.cycles-slide.cycle-slide {
margin-top: 0 !important;
}

.cycle-slideshow {
height: 650px;
width: 100%;
overflow: hidden;
}
.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 {
Expand All @@ -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%;
Expand All @@ -336,25 +340,28 @@ aside .titulo {
text-align: center;
background-color: #003e2d;
width: 10%;
position: absolute;
top: 0;
}
.cycle-slideshow .entry-meta a {
font-weight: bold;
color: #a7b739;
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;
Expand Down
23 changes: 23 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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, '');
}
}
}
4 changes: 1 addition & 3 deletions templates/content-home.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@
<div class="home-news">
<a id="featured-thumbnail" href="<?php the_permalink(); ?>" rel="nofollow">
<div class="entry-image">
<?php if ( has_post_thumbnail() ) {
the_post_thumbnail('destaque');
} ?>
<?php aspta_get_post_thumbnail(); ?>
</div>
</a>
<div class="entry-title post-title">
Expand Down

0 comments on commit 03c601f

Please sign in to comment.