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

View file

@ -3135,3 +3135,27 @@
.widget_search form input[type="submit"] { .widget_search form input[type="submit"] {
display: inline-block; width: 30%; float: right; 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(); ?> <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' ); ?> <?php if ( !is_search() ) get_template_part( 'entry', 'meta' ); ?>
</header> </header>
<?php get_template_part( 'entry', ( is_archive() || is_search() ? 'summary' : 'content' ) ); ?> <?php
<?php if ( !is_search() ) get_template_part( 'entry-footer' ); ?> 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> </article>
<hr style="clear:both;"> <hr style="clear:both;">