Retrieve and show data from a blog post URL using custom module
SOLVE
Hi,
Please check the attached image. I've created a custom module using the below code to show 2 recent posts from a blog inside a website page. But our new requirement is to show same data from some posts which we input manually. So is it possible to fetch Feature image, Title and Content from a specific blog post URL? It is ok if we need to repeat the custom module twice inside the template.
I don't believe you can fetch a blog by it's URL, but you could use the content_by_id function to grab a post by it's ID number. The ID number can be found in the page editor URL of a post.
But so the user doesn't have to go find the ID you could use the Page field in a custom module to grab that:
I don't believe you can fetch a blog by it's URL, but you could use the content_by_id function to grab a post by it's ID number. The ID number can be found in the page editor URL of a post.
But so the user doesn't have to go find the ID you could use the Page field in a custom module to grab that: