matthisco
Member
Posted 7 months ago #
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
matthisco
Member
Posted 7 months ago #
Something like this perhaps?
<?php
$my_id = 7;
$post_id_7 = get_post($my_id);
$content = $post_id_7->post_excerpt;
echo $content;
?>
matthisco
Member
Posted 7 months ago #
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?