WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. moneyvan
    Member
    Posted 1 year ago #

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

  2. Sampression
    Member
    Theme Author

    Posted 1 year ago #

    Hi moneyvan,

    Currently sampression lite supports only one sticky post.

    Thank you,

    Sampression Team

  3. mdjasper
    Member
    Posted 1 year 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
    Member
    Posted 1 year ago #

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

  5. trishahdee
    Member
    Posted 1 year 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'; } ?> ">

    Change:
    echo 'sticky corner-stamp';
    To:
    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
    Member
    Posted 1 year ago #

    Million thanks trishahdee, worked like a charm.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic