Adding editable content above posts

I have a few thought on this. You can very easily build yourself a dynamic area above your posts for the purpose of information or announcements

I prefer to make use of a non-hierarchical custom post type for this purpose. Just something very simple. No taxonomies attached. The custom post type should also not have single post view or an archive. The simple reasons for this is

  • Custom post types are not included in the main query and they don’t appear in navigation menus by default. This makes CPT’s excellent for usage as informational post sections outside your normal site setup

  • If you have a new announcement or something new you want to share, you can simply create a new post under your custom post type. No need to edit the same post time after time. The advantage of using a custom post type and having a post for every announement, event, info etc. is that you can keep a record and even later have a dedicated page with some of these posts

You can run a custom query with WP_Query in the area you would like the post to appear, or even incorporate tnis into a custom widget, which brings me to your problem and the actual purpose of the question

I prefer WP-Query over the get_ functions as WP_Query sets up the postdata automatically which enables the use of the template tags like the_content(). In your question, you make use of get_post(), which does not set up postdata, so the template tags won’t work. The WP_Post objects returned is unfiltered as well, so you will not see any formatting applied to them

$page->post_content returns unfiltered content. You need to aplly these filteres manually like

$content = apply_filters( 'the_content', $page->post_content );
echo $content;

This will give you filtered content which is exactly the same as the template tag the_content().