Commit d78773c6 authored by agnez's avatar agnez

page977 flux rss WIP, problem float long+lat

parent 5d8b5cd8
......@@ -288,4 +288,20 @@ function custom_shortcode_atts_wpcf7_filter( $out, $pairs, $atts ) {
return $out;
}
// -----------
\ No newline at end of file
// -----------
// Remove all feeds http://www.wpbeginner.com/wp-tutorials/how-to-disable-rss-feeds-in-wordpress/
function gasap_disable_feed() {
wp_die( __('No feed available,please visit our <a href="'. get_bloginfo('url') .'">homepage</a>!') );
}
add_action('do_feed', 'gasap_disable_feed', 1);
add_action('do_feed_rdf', 'gasap_disable_feed', 1);
add_action('do_feed_rss', 'gasap_disable_feed', 1);
add_action('do_feed_rss2', 'gasap_disable_feed', 1);
add_action('do_feed_atom', 'gasap_disable_feed', 1);
add_action('do_feed_rss2_comments', 'gasap_disable_feed', 1);
add_action('do_feed_atom_comments', 'gasap_disable_feed', 1);
remove_action( 'wp_head', 'feed_links_extra', 3 );
remove_action( 'wp_head', 'feed_links', 2 );
<?php
/**
* RSS2 Feed Template for displaying RSS2 Posts feed.
*
* @package WordPress
*/
header('Content-Type: ' . feed_content_type('rss2') . '; charset=' . get_option('blog_charset'), true);
$more = 1;
echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
/**
* Fires between the xml and rss tags in a feed.
*
* @since 4.0.0
*
* @param string $context Type of feed. Possible values include 'rss2', 'rss2-comments',
* 'rdf', 'atom', and 'atom-comments'.
*/
do_action( 'rss_tag_pre', 'rss2' );
?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
<?php
/**
* Fires at the end of the RSS root to add namespaces.
*
* @since 2.0.0
*/
do_action( 'rss2_ns' );
?>
>
<channel>
<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
<link><?php bloginfo_rss('url') ?></link>
<?php while ( have_posts() ) : the_post();
$content = get_the_content();
$content = apply_filters('the_content', $content);?>
<title><?php the_title(); ?></title>
<description><?php echo $content; ?></description>
<?php endwhile; ?>
<lastBuildDate><?php
$date = get_lastpostmodified( 'GMT' );
echo $date ? mysql2date( 'D, d M Y H:i:s +0000', $date, false ) : date( 'D, d M Y H:i:s +0000' );
?></lastBuildDate>
<language><?php bloginfo_rss( 'language' ); ?></language>
<sy:updatePeriod><?php
$duration = 'hourly';
/**
* Filters how often to update the RSS feed.
*
* @since 2.1.0
*
* @param string $duration The update period. Accepts 'hourly', 'daily', 'weekly', 'monthly',
* 'yearly'. Default 'hourly'.
*/
echo apply_filters( 'rss_update_period', $duration );
?></sy:updatePeriod>
<sy:updateFrequency><?php
$frequency = '1';
/**
* Filters the RSS update frequency.
*
* @since 2.1.0
*
* @param string $frequency An integer passed as a string representing the frequency
* of RSS updates within the update period. Default '1'.
*/
echo apply_filters( 'rss_update_frequency', $frequency );
?></sy:updateFrequency>
<?php
/**
* Fires at the end of the RSS2 Feed Header.
*
* @since 2.0.0
*/
do_action( 'rss2_head');
$args = array ( 'post_type' => 'gasap', 'posts_per_page'=>-1 );
query_posts( $args );
function get_gasap_details($id){
global $wpdb;
$table_name = $wpdb->prefix . 'places_locator';
$sql = "
SELECT long,street_number,city,street
FROM {$table_name}
WHERE post_ID = $id
";
$items = $wpdb->get_results($sql);
foreach ($items as $item) {
$test = absint( $item->street_number );
$long = absint( $item->long );?>
<gasapcity><?php echo $item->city; ?></gasapcity>
<gasaplat><?php echo $item->street; ?></gasaplat>
<gasaptest><?php echo $test; ?></gasaptest>
<gasaplong><?php // echo $long; ?></gasaplong>
<?php
}
}
while( have_posts()) : the_post();
$terms = wp_get_post_terms( $post->ID, 'gasapstatus' ); ?>
<item>
<gasap id="<?php echo $post->ID; ?>">
<gasapname><?php the_title_rss() ?></gasapname>
<gasapurl><?php the_permalink_rss() ?></gasapurl>
<gasapstatus><?php echo $terms[0]->name; ?></gasapstatus>
<?php get_gasap_details($post->ID); ?>
</gasap>
</item>
<?php endwhile; ?>
</channel>
</rss>
<?php
add_action( 'beans_post_append_markup', 'add_atend_gasapsingle' );
function add_atend_gasapsingle($content) {
// Contact form
global $post;
$gasap = get_post_field('post_title', $post->ID) ;
// TODO check si champ e-mail du plugin gmwp est utilisé : echo do_shortcode('[gmw_single_location additional_info="email" item_id="'.$post->ID.'"]');
$email = get_the_author_meta( 'user_email', $post->post_author );
$terms = wp_get_post_terms( $post->ID, 'gasapstatus' );
if ($email != '' && ($terms[0]->slug != 'complet')) {
echo do_shortcode('[contact-form-7 id="147" title="Contact GASAP fr" email-referent="'.$email.'" nom-gasap="'.$gasap.'"]');
}
elseif ($terms[0]->slug == 'complet') {
echo '<div><b>'.esc_html__( 'Ce GASAP est complet et ne peux pas être contacté via notre site.', 'beans_gasap' ).'</b></div>';
}
echo '<hr /><h4><a href="/les-mangeurs#snippet_la_carte">'.esc_html__( 'Tous les GASAP', 'beans_gasap' ).'</a></h4>';
}
add_action( 'beans_post_after_markup', 'add_after_gasapsingle' );
function add_after_gasapsingle() {
// include (get_stylesheet_directory() . '/assets/template_parts/form_contact_gasap.php');
//global $post;
//$author_mail = get_the_author_meta('user_email',$post->post_author);
//echo do_shortcode('[contact-form subject="message from.'$post->post_title.'" to="'.$author_mail.'"]');?>
<!-- Contact form popup -->
<button class="uk-button" data-uk-modal="{target:'#contac-gasap-form'}"><?php esc_html_e( 'Contacter ce GASAP', 'beans_gasap' ) ?></button>
<div id="contac-gasap-form" class="uk-modal">
<div class="uk-modal-dialog">
<a class="uk-modal-close uk-close"></a>
<?php echo do_shortcode( '[contact-form-7 id="147" title="Contact form 1"]' ); ?>
</div>
</div> <?php
include (get_stylesheet_directory() . '/assets/template_parts/footer.php');
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment