WordPress.org

Ready to get started?Download WordPress

Forums

Show all content when Post is sticky - Twenty Ten (5 posts)

  1. Uffe
    Member
    Posted 2 years ago #

    Hi,

    My frontpage is showing only excerpts of the posts, and the two first posts showing is sticky-posts..

    My problem is, I can't get the loop to show the WHOLE content from the two sticky-posts, and the excerpt from all the other posts...

    I have tried to add this code to the loop:

    <?php if(is_sticky()):?>
    	<?php the_content(); ?>
    	<?php endif;?>

    But when adding the above code, now the two sticky posts is showing with the whole content, AND also as an excerpt - two times.

    Anyone know how to make this happen..??

    This is my site: http://uffekirkegaard.dk

    The loop i use is:

    [code moderated - please follow the guidelines http://codex.wordpress.org/Forum_Welcome#Posting_Code ]

    Kind regards
    Uffe

  2. alchymyth
    Forum Moderator
    Posted 2 years ago #

    <?php if ( !is_sticky()&&is_home() || is_front_page() || is_archive() || is_search() ) : // Only display excerpts for home, archives and search; but not for stickies on home. ?>

    (untested)

  3. Uffe
    Member
    Posted 2 years ago #

    Alchymyth..

    Thanks for your quick response..

    unfortunately this code didn't do the trick. But I can't figure out why. Because if I do this:

    !is_home() || !is_front_page() ||

    .. then I see the change - then all the posts show all content. (So when used on those two, it has an effect).. but for some strange reason not on the sticky..

    So I guess that the sticky-posts gets "its instructions" from somewhere else..??

    Kind regards
    Uffe

  4. ganghiss
    Member
    Posted 1 year ago #

    A bit stale on the thread, but I worked a solution for this in index.php (under a child theme):

    <?php if ( is_sticky() ) : ?>
    <?php the_content(); ?>
    <?php else : ?>
    <?php the_excerpt(); ?>
    <?php endif;?>

  5. Uffe
    Member
    Posted 1 year ago #

    Thanks ganghiss... Will try it :-)

Topic Closed

This topic has been closed to new replies.

About this Topic