WordPress.org

Ready to get started?Download WordPress

Forums

Insert Image into the_content on Home Page (12 posts)

  1. cpatience
    Member
    Posted 3 years ago #

    Hello,

    I am trying to insert a floating div (that contains a slide show) into the bottom right hand corner of the last post on the home page (only.) I am able to insert the div after the content (by doing a count and then inserting <div> code if count==5), but when I position the image, the text doesn't respond to the float and there is no text wrapping. Any ideas/suggestions would be much appreciated.

    Here is the code I've got so far:
    '
    <?php if ($count==5) : ?>
    <?php the_content();?>
    <div id="slideshow">
    <?php if(function_exists('wp_content_slider')) { wp_content_slider(); } ?>
    </div>--><!-- END SLIDESHOW -->
    <?php else:?>
    <?php the_content();?>
    <?php endif;?>
    '

    Here is the CSS:
    #slideshow {
    width: 300px;
    margin-top: -200px;
    display: block;
    float:right;
    }

    The code above will position the image in the right place, but will cover up the text of the post instead of having text wrapping.

    Thanks much,

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    Unless you provide a link to a page demonstrating the problem, no one will be able to offer much in the way of specific help.

  3. cpatience
    Member
    Posted 3 years ago #

    Sorry about that - the site is still in dev so I didn't think to include it. Here is the link: http://208.101.30.165/~silversp/

  4. esmi
    Forum Moderator
    Posted 3 years ago #

    Start by sorting out the markup errors. Then move onto the CSS errors.
    http://codex.wordpress.org/Validating_a_Website

  5. cpatience
    Member
    Posted 3 years ago #

    Hi esmi,
    Thanks for reminding me to keep code clean. The mark-up is now clean and the only CSS errors are ones for text-shadow.

    Thanks.

  6. esmi
    Forum Moderator
    Posted 3 years ago #

    Has the problem resolved itself yet?

  7. cpatience
    Member
    Posted 3 years ago #

    Nope - the slide show is still in the bottom right and is covering up the text behind it instead of having the text wrap around.

  8. esmi
    Forum Moderator
    Posted 3 years ago #

    It's the approach you're using to position the slide show. It is floating right but then you've applied a negative top margin of 200px - which means it shift up over the text. So you'll need to add a class to the last 3 paragraphs to that you can give them a margin-right of about 220px - thus allowing room for the slide show.

  9. cpatience
    Member
    Posted 3 years ago #

    Is it possible to add a class to content that is being pulled by the_content()?

    Since the home page will constantly be changing I need to make sure that the changes aren't post-specific.

  10. esmi
    Forum Moderator
    Posted 3 years ago #

    Not easily. And not to just the last few paragraphs without adding it manually to the post or page.

  11. cpatience
    Member
    Posted 3 years ago #

    That's too bad. So does that mean what I'm trying to do can't be done?

  12. esmi
    Forum Moderator
    Posted 3 years ago #

    Try floating the content left instead of floating the slide show right.

Topic Closed

This topic has been closed to new replies.

About this Topic