{"id":1993,"date":"2020-05-16T15:46:26","date_gmt":"2020-05-16T13:46:26","guid":{"rendered":"https:\/\/digitalia.culturanuova.net\/blog\/?p=1993"},"modified":"2020-05-16T15:47:39","modified_gmt":"2020-05-16T13:47:39","slug":"include-wordpress-category-or-tag-posts-in-a-website","status":"publish","type":"post","link":"https:\/\/digitalia.culturanuova.net\/blog\/?p=1993","title":{"rendered":"include wordpress category (or tag) posts in a website"},"content":{"rendered":"\n<ul class=\"wp-block-list\"><li>You can install wordpress in a subdirectory of your website, in localhost as well.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li>Afterward you can embed the content (or the link) of your wordpress posts in your php pages using a code like the following:<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php \n\/* the path of your wordpress subfolder with the file, required, \"wp-blog-header.php\" *\/\nrequire(\"$root\/wordpress\/wp-blog-header.php\");\n\/\/get_header(); &#91;you can omit this row, if you want embed the wp posts in your page having already header and styles]\n?>\n\n\n&lt;?php\n\/\/ Get the last 200 posts of a given category: \n\/\/in this case the 565 one (=office).\nglobal $post;\n$args = array('posts_per_page' => 200,  'category' => 565 );\n$myposts = get_posts( $args );\n\nforeach( $myposts as $post ) :\tsetup_postdata($post); ?>\n&lt;h2>&lt;?php the_title(); ?>&lt;\/h2>\n&lt;p>&lt;?php the_content(); ?>&lt;\/p>\n\/\/ the following code is to put a link: you could choose to don't add it, or, on the contrary, to put only it\n&lt;a href=\"&lt;?php the_permalink() ?>\" rel=\"bookmark\" \ntitle=\"Permanent Link to &lt;?php the_title_attribute(); ?>\">\n&lt;?php the_title(); ?>&lt;\/a>&lt;br \/>\n&lt;?php endforeach; ?><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>if you want embed in your pages tag posts instead of category posts you can use this code<\/li><\/ul>\n\n\n\n<p><code>$args = array('posts_per_page' =&gt; 100, 'tag' =&gt; 'css' );<\/code><\/p>\n\n\n\n<p>Further info <a href=\"https:\/\/codex.wordpress.org\/Integrating_Wordpress_with_Your_Website\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You can install wordpress in a subdirectory of your website, in localhost as well. Afterward you can embed the content (or the link) of your wordpress posts in your php pages using a code like the following: if you want embed in your pages tag posts instead of category posts you can use this code &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/digitalia.culturanuova.net\/blog\/?p=1993\" class=\"more-link\">Leggi tutto<span class=\"screen-reader-text\"> &#8220;include wordpress category (or tag) posts in a website&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[566],"tags":[64,585,587,180,488],"class_list":["post-1993","post","type-post","status-publish","format-standard","hentry","category-webmaster","tag-categories","tag-category","tag-embed-wordpress","tag-tags","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1993","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1993"}],"version-history":[{"count":4,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1993\/revisions"}],"predecessor-version":[{"id":1997,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1993\/revisions\/1997"}],"wp:attachment":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1993"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1993"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1993"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}