Sticky post in blog home: change style and display

For sticky post in blog home show only header with title,
change background and add show ribbon
This commit is contained in:
fabrixxm 2018-02-19 15:42:23 +01:00
parent 22b015a4b3
commit daf65232f1
3 changed files with 40 additions and 5 deletions

View file

@ -9,9 +9,14 @@
else { printf( "<h2>%s</h2>",__( 'Archives', 'friendica' ) ); }
?>
</header>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'entry' ); ?>
<?php endwhile; endif; ?>
<?php
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
get_template_part( 'entry' );
}
}
?>
<?php get_template_part( 'nav', 'below' ); ?>
</div>
<?php get_sidebar(); ?>

View file

@ -3135,3 +3135,27 @@
.widget_search form input[type="submit"] {
display: inline-block; width: 30%; float: right;
}
/** sticky post in blog list */
.blog article.post.sticky::after {
display: block;
position: absolute;
content: "!";
font-size: 40pt;
font-weight: bold;
text-align: center;
background-color: #d16103;
color: #fff;
width: 60px;
height: 60px;
line-height: 60px;
border-radius: 100%;
right: 0.1em;
top: 0.1em;
transform: rotate(25deg);
}
.blog article.post.sticky {
background-color: #fff3e9;
padding: 0.5em;
position: relative;
}

View file

@ -6,7 +6,13 @@
<h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" rel="bookmark"><?php the_title(); ?></a></h2> <?php edit_post_link(); ?>
<?php if ( !is_search() ) get_template_part( 'entry', 'meta' ); ?>
</header>
<?php get_template_part( 'entry', ( is_archive() || is_search() ? 'summary' : 'content' ) ); ?>
<?php if ( !is_search() ) get_template_part( 'entry-footer' ); ?>
<?php
if (is_home() && is_sticky() ) {
// only title for sticky in blog home
} else {
get_template_part( 'entry', ( is_archive() || is_search() ? 'summary' : 'content' ) );
if ( !is_search() ) get_template_part( 'entry-footer' );
}
?>
</article>
<hr style="clear:both;">