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 ?

Solutions

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);

You can install json-api plugin, then get content from json link and echo it in your subdomain site. It's easilest way to get content without connect to another database.

Tags: PHP / Mysql / Wordpress

Similar questions

When a user is on a subdomain in a multi-site WordPress site, create a dynamic link stays within subdomain
So I have a multi-site WordPress environment that uses the following code to direct to another product; however, when on an environment that is not the canonical (e.g. if CNAME is aa.site.com, then ab.site.com, ac.stie.com, and ad.site.com all use the same codebase), the link directs you to the correct product and page or post, but with the CNAME -...
In a subdomain network, what .htaccess settings can I use to have WP ignore requests to one subdomain?
I have a subdomain network installed at, say http://example.com. I need to have my webmail running at http://webmail.example.com. When I go to this domain it redirects to a page for creating a new site: http://example.com/wp-signup.php?new=webmail. I know there are some entries WP uses in the .htaccess file, but how can I get WP to ignore requests ...
Can a bootstrap theme I created and connected to WordPress have plugins added, so I can add a news feed, events feed and calendar to my website pages?
The site is a charity site, which is expected to have a news feed of goings on within the charity and events. Most of the home page is complete. But I don't know exactly how to write the code for an article in bootstrap, so that when I upload it to WordPress, it will interact properly. Allowing me to create new articles, remove old ones, etc. I eit...
How can I get post text from all posts on a Wordpress news site?
I'm a Digital Operations manager for a college news site, and as part of a new project, I'm trying to generate a corpus of all article content we've released. What's the best methodology to do this? Any specific libraries you've found helpful? I have admin privileges if that helps.
Wordpress Recent Posts excerpt in sidebar is pulling the page/post excerpt instead of the recent post excerpt
I have a list of Recent Posts in the sidebar of a Wordpress blog. The title and author show up properly, but the excerpt that gets shown is the excerpt of the current page/post not the relevant recent post. The code: Any idea why it would be pulling the correct Title/Author, but incorrect excerpt?
Instagram API to Wordpress - Recent Photos Aren't Most Recent
I've got this working to pull recent Instagram posts into Wordpress, however the "recent" photos that are displayed aren't actually my most recent Instagram posts. When I refresh, the Instagram posts that are pulled in also change. I can only find a max/min time within the API docs. Is there any way to just get the last 3 Instagram posts made?

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.