0

I have a site at the main domain and then a blog at blog.domain.com. Any way to retrieve the latest post from the blog.domain.com and echo it out on the top of my home.php file?

Not really sure where to look, many outdated examples :X

2

Appearance >> Widgets >> Select RSS and enter any blog feed you want.

You can do it using the default rss widget in wordpress. Create a widget box to appear where you want through functions.php file in your theme.

or you can get jNewsticker from Codecanyon and enter the feed from the blog and copy the shortcode where you want it and change the css to match your theme.

  • please let me know if my answer helped – user1757516 Dec 2 '12 at 14:56
0

Easiest way to do it now is with the WP REST API. By making a request to the site's API, you can request the most recent post data, then parse the JSON response for display on your site.

If your blog site is up-to-date, make a GET request to https://<your-blog-domain>/wp-json/wp/v2/posts?per_page=1&_embed to get the most recently published post. For example, try https://make.wordpress.org/core/wp-json/wp/v2/posts?per_page=1&_embed to see the latest post from the WP Core dev team.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.