how to place content from another blog (the posts) on my wordpress site (ex : last posts)?

Asked

Viewed 1,575 times

0

I have a website and in it I want to put a feature in which there is an element where the last appears posts from a blog, but this blog is on another server. I want to put the last published posts from this blog to my site.

Is there any PHP or Javascript code where I can do this or some plugin?

  • It seems to be the same question as that: https://answall.com/q/217697/5878. What’s the difference? And is the other blog yours? You are allowed to include these posts?

  • I started using the tool a little while ago I could not fix the other question so I created another

  • the blog is not mine, but I have permission to include the posts

  • Then maybe you can use the RSS provided by the other blog.

2 answers

0

There are some alternatives to solve your question, but some that will be listed may not be as effective, but may be useful, depending on the case.

Alternatives:

API’s: It is the most suitable alternative, where the data will already come formatted to work on a front-end system (like your website). It may be interesting to check if the other blog has this feature, because this way your site can consume exactly the same information. If the site that will be consumed is not your domain, I recommend you contact the responsible and ask if there is the possibility of integration.

Perks: Quick response, little data handling effort, and easy management.

Downside: I believe most blogs do not have Front/ Api separation.

Web Crawler: It is like a robot that scans the HTML of another site, and can be done either by backend (picking up the response from a request, and treating the HTML with a lib), or by JS (by a lib that makes asynchronous connections, and collects the necessary data with the node identifier.)

Perks: "Branch breaks" and very useful, depending on the case.

Downside: Laborious process in data extraction, slow page loading, does not guarantee integrity and if the site that is consumed by Crawler makes changes in the page structure, it will be necessary complex maintenance.

0

Normally use php file_get_content() to fetch the data I manipulate the data with something like this:

$arquivo = file_get_contents("http://url.com");
    
$dom = new domDocument();
@$dom->loadHTML($arquivo);
    
$xpath = new DOMXPath($dom);
$links = $xpath->query("//a");

and then just display the result on your site.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.