Can i “echo” the recent news from wordpress site to a subdomain site?

Hello i have a wordpress site and a html static site, both are on the same server so the thing i need to do is somehow implement the news from wordpress to the static one, and i find myself lost, how can this be achieved ?

Related posts

Leave a Reply

2 comments

  1. If you mean “static HTML page” as hard-coded *.html pages, than it’s not possible. If it’s php site, just use same database, connect to it with PDO and get needed values

    PDO CONNECT

    $db = new PDO(
        "mysql:host=localhost;dbname=db-name",
        $config['components']['db']['username'],
        $config['components']['db']['password']
    );
    
    $query = $db->prepare('SELECT * FROM `news`');
    $query->execute();
    $tags = $query->fetchAll(PDO::FETCH_OBJ);