Skip to content

Instantly share code, notes, and snippets.

@lynt-smitka
Created November 8, 2017 09:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lynt-smitka/1e3ebed04366bc86445229e9b18b646b to your computer and use it in GitHub Desktop.
Save lynt-smitka/1e3ebed04366bc86445229e9b18b646b to your computer and use it in GitHub Desktop.
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<?php
include "wp-config.php";
$conn = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
if ($conn->connect_error) {
die("Nepripojilo se to: " . $conn->connect_error);
}
$sql = "SELECT ID, post_title, post_content FROM wp_posts WHERE post_type IN ('post','page')";
$result = $conn->query($sql);
while($row = $result->fetch_assoc()) {
echo "\n<!-----POST----->\n";
echo "<h1>#{$row['ID']}#{$row['post_title']}</h1>\n";
echo $row['post_content'];
}
$conn->close();
?>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment