WordPress.org

Forums

[closed] latest news post then sticky post - sticky post image stripped out (7 posts)

  1. developdesign
    Member
    Posted 4 years ago #

    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]

  2. developdesign
    Member
    Posted 4 years ago #

    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]

  3. developdesign
    Member
    Posted 4 years ago #

    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

  4. developdesign
    Member
    Posted 4 years ago #

    Could anyone help me??

  5. developdesign
    Member
    Posted 4 years ago #

    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 ?

  6. developdesign
    Member
    Posted 4 years ago #

    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(); ?>
  7. esmi
    Forum Moderator
    Posted 4 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic