{"id":23652,"date":"2024-05-07T09:14:22","date_gmt":"2024-05-07T07:14:22","guid":{"rendered":"https:\/\/www.wjst.de\/blog\/?p=23652"},"modified":"2024-05-17T03:32:59","modified_gmt":"2024-05-17T01:32:59","slug":"how-to-integrate-wordpress-in-another-website","status":"publish","type":"post","link":"https:\/\/www.wjst.de\/blog\/sciencesurf\/2024\/05\/how-to-integrate-wordpress-in-another-website\/","title":{"rendered":"How to integrate wordpress in another website"},"content":{"rendered":"<p>In another <a href=\"https:\/\/www.wjst.de\/images\/\">website<\/a> constructed more than a decade ago, I integrated WordPress pages just as iframe .This was quite common at that time but not very elegant as all the formatting had to be adjusted to the parent site for a coherent view. When revising the website last week I have chosen a radical different approach by completely silencing the WP output using a plugin<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\n\/** Plugin Name: shutup **\/\r\nadd_action( &#039;template_redirect&#039;, function() {\r\n  wp_die( __( &#039;disabled&#039; ) ); \r\n});\r\n?&gt;\r\n<\/pre>\n<p>WP pages and posts are retrieved in the main website using the WP API only<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$api_url = &#039;https:\/\/www.DOMAIN.de\/BLOGNAME\/wp-json\/wp\/v2\/pages\/xxxx&#039;;\r\n$response = file_get_contents($api_url);\r\n$posts = json_decode($response);\r\necho $posts-&gt;content-&gt;rendered;\r\n<\/pre>\n\n<p>&nbsp;<\/p>\n<div class=\"bottom-note\">\n  <span class=\"mod1\">CC-BY-NC Science Surf , accessed 07.04.2026<\/span>\n <\/div>","protected":false},"excerpt":{"rendered":"<p>In another website constructed more than a decade ago, I integrated WordPress pages just as iframe .This was quite common at that time but not very elegant as all the formatting had to be adjusted to the parent site for a coherent view. When revising the website last week I have chosen a radical different &hellip; <a href=\"https:\/\/www.wjst.de\/blog\/sciencesurf\/2024\/05\/how-to-integrate-wordpress-in-another-website\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">How to integrate wordpress in another website<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20,9],"tags":[735],"class_list":["post-23652","post","type-post","status-publish","format-standard","hentry","category-note-worthy","category-computer-software","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/posts\/23652","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/comments?post=23652"}],"version-history":[{"count":6,"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/posts\/23652\/revisions"}],"predecessor-version":[{"id":23683,"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/posts\/23652\/revisions\/23683"}],"wp:attachment":[{"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/media?parent=23652"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/categories?post=23652"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/tags?post=23652"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}