• HI folks,

    Can someone please tell me how I can have the content of my post up until the more tag, displayed on the homepage of my site?

    I’ve read up on the loop and the excerpt, but I’m really struggling to understand how it works. Can someone please give me some sample code?

    If I know the post id of my post, what do i need to add to home.php?

    Many thanks in advance

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter matthisco

    (@matthisco)

    Something like this perhaps?

    <?php
    $my_id = 7;
    $post_id_7 = get_post($my_id);
    $content = $post_id_7->post_excerpt;
    echo $content;
    ?>
    Thread Starter matthisco

    (@matthisco)

    THis doesnt work either:

    <?php
    $page_id = 14;//This is page id or post id
    $content_post = get_page($my_postid);
    $content = $content_post->post_content;
    $content = apply_filters('the_excerpt', $content);
    $content = str_replace(']]>', ']]>', $content);
    echo $content;
    ?>

    All I get is:

    <div class=”post-teaser-block”>Permanent link to this post (1 word, estimated 0 secs reading time)</div>

    Anyone?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘excerpt of posts on homepage’ is closed to new replies.