added shows radiomanifest feed

deploy
campi 2 years ago
parent a8d6732ccf
commit 9fec89f65c

@ -95,7 +95,8 @@ function orari_dirette_input($post)
</div> </div>
<div style="clear:both;"></div> <div style="clear:both;"></div>
<?php <?php
endfor; endfor;
wp_enqueue_script('add_onchange_listener', plugin_dir_url(__FILE__).'js/add_onchange_listener.js', array(), '1.2', true); wp_enqueue_script('add_onchange_listener', plugin_dir_url(__FILE__).'js/add_onchange_listener.js', array(), '1.2', true);
} }

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<xbel version="1.0" xmlns:show="https://radiomanifest.degenerazione.xyz/shows/">
<?php
function escape_to_xml($text) {
$escaped_text = wp_strip_all_tags($text);
$escaped_text = esc_xml($escaped_text);
return $escaped_text;
}
$post_options = array(
'post_type' => 'broadcast',
'numberposts' => -1,
'orderby' => 'modified'
);
$broadcasts = get_posts($post_options);
foreach ($broadcasts as $post) { ?>
<bookmark href="<?php echo get_permalink($post->ID); ?>">
<title><?php echo $post->post_title; ?></title>
<info>
<metadata owner="https://radiomanifest.degenerazione.xyz/">
<show:name><?php echo $post->post_title; ?></show:name>
<show:id><?php echo $post->ID ?> </show:id>
<show:description><?php echo escape_to_xml(get_the_excerpt($post=$post)); ?></show:description>
<show:website><?php echo get_permalink($post->ID); ?></show:website>
<show:feed><?php echo (get_site_url() . '/feed/podcast/' . $post->post_name); ?></show:feed>
</metadata>
</info>
</bookmark>
<?php
}
?>
</xbel>

@ -0,0 +1,15 @@
<?php
function add_shows_feed() {
add_feed( 'shows', 'render_shows_feed' );
}
add_action( 'init', 'add_shows_feed' );
function render_shows_feed() {
load_template(dirname(__FILE__)."/../feeds/radiomanifest-shows.php" );
}
?>

@ -35,6 +35,7 @@ function add_broadcast_taxonomy($args)
); );
wp_insert_term('Trasmissioni', 'category', $args); wp_insert_term('Trasmissioni', 'category', $args);
} }
flush_rewrite_rules();
} }
foreach (glob(plugin_dir_path(__FILE__) . 'admin/*.php') as $file) { foreach (glob(plugin_dir_path(__FILE__) . 'admin/*.php') as $file) {
@ -48,3 +49,4 @@ foreach (glob(plugin_dir_path(__FILE__) . 'inc/*.php') as $file) {
foreach (glob(plugin_dir_path(__FILE__) . 'shortcodes/*.php') as $file) { foreach (glob(plugin_dir_path(__FILE__) . 'shortcodes/*.php') as $file) {
include_once $file; include_once $file;
} }

Loading…
Cancel
Save