45 lines
1000 B
PHP
45 lines
1000 B
PHP
<?php
|
|
function wpm_enqueue_styles() {
|
|
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
|
|
}
|
|
|
|
add_action( 'wp_enqueue_scripts', 'wpm_enqueue_styles' );
|
|
|
|
|
|
add_action( 'wp_loaded', 'flux_rss', 99 );
|
|
function flux_rss() {
|
|
|
|
|
|
if ( isset( $_GET['fluxrss'] ) ) {
|
|
|
|
header( "Content-Type: text/xml" );
|
|
$args = array(
|
|
'post_type' => 'post',
|
|
'posts_per_page' => 5,
|
|
'order' => 'DESC',
|
|
'post_status' => 'publish',
|
|
);
|
|
$my_query = new WP_Query( $args );
|
|
|
|
// 3. on lance la boucle !
|
|
echo "<bios>\n";
|
|
if ( $my_query->have_posts() ) : while ( $my_query->have_posts() ) : $my_query->the_post();
|
|
echo "<bio>\n";
|
|
echo " <image>";
|
|
echo wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) );
|
|
echo "</image>\n";
|
|
echo " <titre>";
|
|
echo htmlspecialchars(get_the_title());
|
|
echo "</titre>\n";
|
|
echo "<url>";
|
|
echo get_permalink();
|
|
echo "</url>";
|
|
echo "</bio>\n";
|
|
endwhile;
|
|
endif;
|
|
echo "</bios>";
|
|
die();
|
|
}
|
|
|
|
}
|