WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Making sticky posts full text instead of excerpts (12 posts)

  1. catwingz
    Member
    Posted 1 year ago #

    Using archive.php I have created a set of custom category pages. Lacking a loop.php I am trying to further customize these files so that sticky posts will show the entire text instead of the excerpts the other posts are set for. I have tried several versions of snippet, as well as several different locations. Nothing has worked. The url of the page for this particular category is
    http://dev.blueplanetlaw.com/ferc-bpa-regulatory-advice-and-litigation/

    I have bumped out lines 7-11 of code showing one of the most recent failed experiments.
    http://pastebin.com/XFkDn4Ly

    Can anyone set me straight?

  2. vtxyzzy
    Member
    Posted 1 year ago #

    These lines:

    <?php if ( ! is_sticky() ) {
        the_content();
    } else {
        the_excerpt();
    } ?>

    translated to English might read like this:

    if the post is not sticky
       show the full content
    otherwise
       show an excerpt

    You should change them to this:

    <?php the_content(); ?>
  3. catwingz
    Member
    Posted 1 year ago #

    Hmm, I have translated that to this

    <?php if ( is_sticky() ) {
        the_content();
    } else {
        the_excerpt();
    } ?>

    to keep the sticky condition in the mix but it doesn't work. I don't quite understand.

    To be more clear about my objective, the first post in each of the categories is sticky and intended to show the full text. All of the following posts are intended to display only the excerpts. Thank you

  4. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    please paste the full code of the template - you seem to be attacking the wrong location.

  5. catwingz
    Member
    Posted 1 year ago #

    "attacking" ;-)

    Here is the pastebin link for the complete file. My php need all the help it can get! Thanks

    </script>"><script src="http://pastebin.com/embed_js.php?i=RBZmzf3x"></script>

  6. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    the 'normal' pastebin url works best: http://pastebin.com/RBZmzf3x

    as far as I can see, the 'sticky' conditional seems to be at the right location.

    is the one and only post in the linked category archive the sticky one?

    be aware that a sticky post will only automatically stick to the beginning of the main posts page, not in archives.

  7. catwingz
    Member
    Posted 1 year ago #

    The "sticky" post has been the only one in that category for the last few weeks. I just put a few dummy posts back in the category, all of which are showing as excerpts.

    I am not sure if this makes a difference or not, but to create my custom category pages I had to use the theme's archive.php as a basis. I don't think it's being read as an archive because the stickies do stick—they just don't respond to this code.

  8. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    with all thos conditional tag in the category template, it might be that your excerpt is shown by some other part;

    try to add some control outputs to some distinct locations of the template;

    for example:

    <?php echo 'THE STICKY TEST'; if ( is_sticky() ) {
                                                        the_content();
                                                    } else {
                                                      the_excerpt();
                                                    } ?>

    also, try temporarily to deactivate all plugins to see if that makes any difference.
    if it does, activate one plugin at a time to locate the trouble-maker.

  9. catwingz
    Member
    Posted 1 year ago #

    alchymyth I tried using the example code and find that 'THE STICKY TEST' returns at the beginning of all posts, not just the sticky one. I'm not quite sure what to make of this. I am now wondering in hindsight if I should have posted this thread in the support for Category Sticky Posts plugin. I know it is making the posts I designate as sticky stay put, but is it possible that they aren't registering as "normal" sticky posts and that something else needs to be done to make my quest for full text possible?

  10. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    that 'THE STICKY TEST' returns at the beginning of all posts, not just the sticky one

    it shows that your conditional code is at the right location in the loop; it also shows that the condition 'is_sticky()' is not met by any of the posts.

    in the support for Category Sticky Posts plugin

    first time you mention that plugin - definitively start a topic in the plugin's direct support section.

    it is making the posts I designate as sticky stay put

    possibly it does that, but it might not set the 'sticky' marker as a 'normal' sticky post would do.

    from looking into the plugin's code, this might be a possibly conditional to use (untested):

    <?php if (property_exists($post, 'sticky_in_cat')) {
       the_content();
    } else {
       the_excerpt();
    } ?>
  11. catwingz
    Member
    Posted 1 year ago #

    alchymyth, your suggestion worked! Thank you so much! :-)

  12. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    you are welcome - thanks for mentioning the used plugin ;-)

Topic Closed

This topic has been closed to new replies.

About this Topic