1

I'm having a issue I don't seem to be able to figure out how to get around.

I'm using the_content(); to get post content for a single post, but it returns a navigation item with it.

I would like to be able to control the markup of the post content, where to put the headline and the content the post. How would a go about doing so?

I'm sure this issue has been answered before but I just don't seem to be able to get google to be my friend for the past 2 days.

2
  • The only thing I can think of is that you have read more links in your posts or some kind of custom filter is acting on the_content() Commented May 6, 2015 at 11:42
  • You could check for uninvited the_content filters with for example: <?php printf( '<pre>%s</pre>', print_r( $GLOBALS['wp_filter']['the_content'], 1 ) ); ?>
    – birgire
    Commented May 6, 2015 at 12:32

1 Answer 1

1

the_content() will output the formatted post to the web browser, if the tag is used in the post it will only display the post up to this point and will out put a "Read More" link.

There are some additional flags in the method to control this behaviour.

See more here.

Alternatively, you may load the output of the content into a variable, if this is what you want to do you can use get_the_content(). This function does not display the content to the screen so you could do further manipulation to it if you wish.

You can read more about the function here.

Typically however the content output would be manipulated using filters / hooks. It is also worth noting that output of get_the_content() is not subject to the same processes as the_content(). It does not auto embed videos etc.

1
  • I just figured out that I got it all wrong, its a theme issue, not a WordPress core function issue. I copied and used TwentyFifteen and the navigation element was being created in the single.php and I have now removed it and fixed it. Thank you for taking the time to help, getting fresh eyes on this helped me rethink the issue :) Commented May 6, 2015 at 13:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.