Articles with tag 'apply_filters ()'

WordPress: retrieve the contents of a page

Sometimes it can be useful to include in a page the contents of another. For example, if you created a registration page and volote show the information in a frame of privacy, it would be nice to upload this content to an existing page. This has the advantage:

  • The client can change the content of the page without "tocccare" the original page that contains it
  • The page works well on its own, so you can insert a link in the footer of the site to "privacy" for example

The best way to include the contents of one or more pages is as follows:

1
2
3
get_page_by_title ( "Privacy" ) -> ID ; $ PostID = get_page_by_title ("Policy") -> ID;
get_post ( & $postID ) ; $ Post = get_post (& $ postID);
"the_content" , $post -> post_content ) ; echo apply_filters ('the_content', $ post -> post_content);

The ID of the post (the page in the above example) is obtained by its title both for clarity and for compatibility with export reindicizzazioni or involuntary.

Continued ...