Support » Themes and Templates » How do I get the content of an entire post besides the last line?

  • I have the following code to get the content of a post

    <?php
    $my_postid = $post->ID;
    $content_post = get_post($my_postid);
    $content = $content_post->post_content;
    $content = apply_filters('the_content', $content);
    $content = str_replace(']]>', ']]>', $content);
    echo $content;
    ?>

    How do I leave out the last line in that post?

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • How do you expect to be able to output something to the page without using echo or print?

    if you look at the code is says ‘echo $content’ at the bottom..

    Oh, all right. Last line of the post you’re echoing.

    Does it have anything in common? You could find the last occurance of a <p> tag or specific css class or something and then hide it with jQuery, or we could work out a strictly php solution if you want.

    The last line in all the pages contain a [gallery] tag. Usually it’s just [gallery], it can have parameters such as [gallery orderby="rand"]. All those galleries have the css ID gallery-1 in common.

    I have no experience with jQuery and only little php knowledge, so I’d appreciate if could help me out.

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How do I get the content of an entire post besides the last line?’ is closed to new replies.