first commit

This commit is contained in:
2024-11-04 20:48:19 +01:00
commit 2fa33a3be9
7968 changed files with 2313063 additions and 0 deletions

36
test.php Normal file
View File

@@ -0,0 +1,36 @@
<?php
include_once('wp-load.php');
$args = array(
'posts_per_page' => -1,
'post_type' => 'post',
'lang' => 'pl',
);
$query = new WP_Query( $args );
$i = 0;
if ( $query->have_posts() ) {
$posts_data = array();
while ( $query->have_posts() ) {
$i++;
$query->the_post();
$post_data = array(
'id' => $i,
'title' => get_the_title(),
'url' => get_permalink(),
);
$posts_data[] = $post_data;
}
header('Content-Type: application/json');
echo json_encode($posts_data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
wp_reset_postdata();
} else {
echo json_encode(array('error' => 'not found.'));
}