Sampression Lite
[resolved] Add more sticky posts! (6 posts)

  1. moneyvan
    Posted 3 years ago #

    Hi there, is there a easy way to display more than one sticky post?

  2. Sampression
    Theme Author

    Posted 3 years ago #

    Hi moneyvan,

    Currently sampression lite supports only one sticky post.

    Thank you,

    Sampression Team

  3. mdjasper
    Posted 3 years ago #

    I too needed to show more than one stick post, and ended up child-theming sampression. For posterity, it is remarkably easy to show more than one sticky post, and there is truly no reason to "only support one stick post."

    The code to edit (in your child theme) is index.php

    // Show only one Sticky Post
    $sticky = get_option( 'sticky_posts' );
    $args = array(
    	'posts_per_page' => 6,   // <------- HERE
    	'post__in'  => $sticky,
    	'ignore_sticky_posts' => 1
  4. oshvalds
    Posted 3 years ago #

    Thank you mdjasper.
    It works, but sticky posts get overlapped by other posts. How this works out for others?

  5. Trishah
    Posted 3 years ago #

    I figured this out how to fix the overlap :D The problem is the jQuery that applies the positioning to the regular posts and not to the sticky posts. To fix this...

    Open loop.php and in the in the article section:

    <article id="post-<?php the_ID(); ?>" class="post columns four <?php echo sampression_cat_slug(); ?> <?php if ( is_sticky() && is_home() ) { echo 'sticky corner-stamp'; } else { echo 'item'; } ?> ">

    echo 'sticky corner-stamp';
    echo 'sticky item isotope-item';

    How the jQuery applies the same positioning to the stickies. And the number of posts you set in the index.php 'posts_per_page' => X now show at the top.

  6. oshvalds
    Posted 3 years ago #

    Million thanks trishahdee, worked like a charm.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic