{"id":42,"date":"2020-11-29T14:46:06","date_gmt":"2020-11-29T14:46:06","guid":{"rendered":"https:\/\/websolindia.com\/blog\/?p=42"},"modified":"2021-06-16T17:19:09","modified_gmt":"2021-06-16T17:19:09","slug":"integrate-wordpress-latest-blog-into-php-website","status":"publish","type":"post","link":"https:\/\/websolindia.com\/blog\/integrate-wordpress-latest-blog-into-php-website\/","title":{"rendered":"How To Integrate WordPress Latest Blog Post Into PHP Website"},"content":{"rendered":"\n<p>If you want to display latest wordpress blog on your homepage follow the instructions below:<\/p>\n\n\n\n<p>Before you use code, confirm your page is saved with the .php extension and your <a href=\"https:\/\/wordpress.com\/\" target=\"_blank\" rel=\"noopener\"><span class=\"has-inline-color has-vivid-cyan-blue-color\">WordPress<\/span><\/a> installation is in a sub-directory on you domain like www.websolindia.com\/blog\/<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How To Integrate WordPress Latest Blog Into Php Website<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"715\" height=\"493\" src=\"https:\/\/websolindia.com\/blog\/wp-content\/uploads\/2020\/11\/how-to-integrate-wordpress-latest-blog-into-php-website.jpg\" alt=\"How To Integrate WordPress Latest Blog Into Php Website\" class=\"wp-image-227\" title=\"\" srcset=\"https:\/\/websolindia.com\/blog\/wp-content\/uploads\/2020\/11\/how-to-integrate-wordpress-latest-blog-into-php-website.jpg 715w, https:\/\/websolindia.com\/blog\/wp-content\/uploads\/2020\/11\/how-to-integrate-wordpress-latest-blog-into-php-website-300x207.jpg 300w\" sizes=\"auto, (max-width: 715px) 100vw, 715px\" \/><figcaption>How To Integrate WordPress Latest Blog Into Php Website<\/figcaption><\/figure>\n\n\n\n<p>Most important to understand you need access to wp-load.php<\/p>\n\n\n\n<p>Copy and paste code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;ul&gt;\n&lt;?php\nrequire($_SERVER&#91;'DOCUMENT_ROOT'] . '\/wordpress\/wp-load.php');\n$args = array(\n\/\/ 'cat' =&gt; 3, \/\/ \n'posts_per_page' =&gt; 2 \/\/ \n);\n$latest_posts = new WP_Query( $args );\nif ( $latest_posts-&gt;have_posts() ) {\nwhile ( $latest_posts-&gt;have_posts() ) {\n$latest_posts-&gt;the_post(); ?&gt;\n&lt;li&gt;\n&lt;a href=\"&lt;?php the_permalink(); ?&gt;\" title=\"&lt;?php the_title(); ?&gt;\"&gt;\n&lt;?php if ( has_post_thumbnail() ) { ?&gt;\n&lt;span class=\"post_thumbnail\"&gt;&lt;?php the_post_thumbnail(); ?&gt;&lt;\/span&gt;\n&lt;?php } ?&gt;\n&lt;span class=\"post_title\"&gt;&lt;?php the_title(); ?&gt;&lt;\/span&gt;\n&lt;\/a&gt;\n&lt;span class=\"post_time\"&gt;Posted on &lt;?php the_time('l jS F, Y') ?&gt;&lt;\/span&gt;\n&lt;?php the_excerpt(); ?&gt;\n&lt;\/li&gt;\n&lt;? }\n} else {\necho '&lt;p&gt;There are no posts available&lt;\/p&gt;';\n}\nwp_reset_postdata();\n?&gt;\n&lt;\/ul&gt;<\/code><\/pre>\n\n\n\n<p>For more information on integrate wordpress latest blog into php website home page contact Websolindia on of the leading <a href=\"https:\/\/websolindia.com\/\">Website Development Agency in India<\/a>. <\/p>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<figure class=\"wp-block-embed is-type-rich is-provider-twitter wp-block-embed-twitter\"><div class=\"wp-block-embed__wrapper\">\n<a class=\"twitter-timeline\" data-width=\"525\" data-height=\"788\" data-dnt=\"true\" href=\"https:\/\/twitter.com\/india_websol?ref_src=twsrc%5Etfw\" target=\"_blank\" rel=\"noopener\">Tweets by india_websol<\/a><script async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script>\n<\/div><\/figure>\n<\/div><\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you want to display latest wordpress blog on your homepage follow the instructions below: Before you use code, confirm your page is saved with the .php extension and your WordPress installation is in a sub-directory on you domain like www.websolindia.com\/blog\/ How To Integrate WordPress Latest Blog Into Php Website Most important to understand you&#8230;<\/p>\n","protected":false},"author":1,"featured_media":44,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,15,16],"tags":[18,17],"class_list":["post-42","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-website-development","category-php","category-wordpress","tag-display-recent-blog-posts-on-your-homepage","tag-integrate-wordpress-blog-into-website"],"_links":{"self":[{"href":"https:\/\/websolindia.com\/blog\/wp-json\/wp\/v2\/posts\/42","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/websolindia.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/websolindia.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/websolindia.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/websolindia.com\/blog\/wp-json\/wp\/v2\/comments?post=42"}],"version-history":[{"count":3,"href":"https:\/\/websolindia.com\/blog\/wp-json\/wp\/v2\/posts\/42\/revisions"}],"predecessor-version":[{"id":228,"href":"https:\/\/websolindia.com\/blog\/wp-json\/wp\/v2\/posts\/42\/revisions\/228"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/websolindia.com\/blog\/wp-json\/wp\/v2\/media\/44"}],"wp:attachment":[{"href":"https:\/\/websolindia.com\/blog\/wp-json\/wp\/v2\/media?parent=42"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/websolindia.com\/blog\/wp-json\/wp\/v2\/categories?post=42"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/websolindia.com\/blog\/wp-json\/wp\/v2\/tags?post=42"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}