WordPress.org

Ready to get started?Download WordPress

Forums

Adding Image to Home Page From Post (3 posts)

  1. iamsgf
    Member
    Posted 5 years ago #

    Hi there,

    I am trying to get an image from posts added to the home page.

    Basically, Each of my posts have an image at the begining, however they do not show up on the home page.

    I am using shortened descriptions on the home page which calls content using <?php echo $content; ?>

    can anyone tell me how to do this please.

    Thanks

  2. iamsgf
    Member
    Posted 5 years ago #

    Further to my last, this is the complete snipet used to get the content.

    <?php
    $content = get_the_content('Continued »');
    if (strlen($content) > 200 && !eregi("Continued &raquo", $content)) {
    $content = substr(strip_tags($content), 0, 200) . "...";
    }
    $i++;
    ?>

  3. iamsgf
    Member
    Posted 5 years ago #

    ok, I am moving forward with my playing.......

    I have removed the following:

    {
    $content = substr(strip_tags($content), 0, 200) . "...";

    }

    Now, homepage shows the image from the post. However How do I now restrict the amount of text, as it is displaying the whole post on the hompage and not just a snippet.

    So lets say I want to show 100 words on the homepage for the post. What do I need to add to the code for this to happen?

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.