WordPress.org

Support

Support » Plugins and Hacks » Hacks » latest news post then sticky post – sticky post image stripped out

latest news post then sticky post – sticky post image stripped out

  • I’m trying to show 1 post from a specific category for latest news releases and 1 sticky post below it on my site front page.

    When I have the code reverved to show a sticky post on top and 1 news post below, there are no errors and it works perfectly.

    When I reverse the code, the news excerpt displays but the sticky post strips all the images and full text out. I put “the_content” instead of “the_excerpt”, but it still doesn’t show the entire post ( but does if positioned above news post )

    Here’s my code:

    [Code moderated as per the Forum Rules. Please use the pastebin]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Here’s how the code looks when sticky post first and news post second.

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Front page
    Code when sticky post first and news post second.
    http://pastebin.com/xgx1y1Na

    Code when news first, sticky second – not working
    http://pastebin.com/6WRSeHvU

    Could anyone help me??

    Note: This is the recent news code

    <?php
        query_posts('showposts=1&cat=3'); while(have_posts()) : the_post();?>
    <h2 class="entry-title"><?php the_category(3); ?></h2>
        <h2 class="entry-title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    <div class="entry"><?php the_excerpt(); ?></div>
    <?php endwhile; ?>

    Sticky post code here:
    http://pastebin.com/6WRSeHvU

    IF I use just sticky post then it shows image, but if I use a most recent news post above the sticky post then it strips the image and most of the content??
    Maybe I’m missing a reset query code, so that’s why it’s stripping sticky post or ?

    If I use the following code to pull a specific post after the recent news code, I get the image but the paragraphs aren’t formated ( no paragraph separation between paragraphs )

    <?php $post_id = 134;
    $queried_post = get_post($post_id); ?>
    <h2 class="entry-title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    <?php echo $queried_post->post_content; ?>

    Note: I’m using ‘get a post” code is at top of page as well. Should I have an closing php tag with this code?

    <?php /*code to display slideshow*/ get_a_post(211); ?>
    <?php the_content(); ?>
    esmi

    @esmi

    Forum Moderator

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘latest news post then sticky post – sticky post image stripped out’ is closed to new replies.
Skip to toolbar