Browse Source

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
master
fabrixxm 4 years ago
parent
commit
daf65232f1
  1. 11
      archive.php
  2. 24
      assets/css/main.css
  3. 10
      entry.php

11
archive.php

@ -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(); ?>

24
assets/css/main.css

@ -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;
}

10
entry.php

@ -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;">
Loading…
Cancel
Save