From 0a7cb0235eb0719b47eb6fe65dca6af620baa23d Mon Sep 17 00:00:00 2001 From: ulaulaman Date: Fri, 22 Oct 2021 01:28:31 +0200 Subject: [PATCH] File rinominato. Aggiunto shrtcode astroedu. Aggiunto codice striscetta ultimo aggiornamento. --- incl/update.php | 138 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 incl/update.php diff --git a/incl/update.php b/incl/update.php new file mode 100644 index 0000000..fbe256e --- /dev/null +++ b/incl/update.php @@ -0,0 +1,138 @@ +ID) ) { + $content = '

'.get_the_post_thumbnail($post->ID).'

'.get_the_excerpt(); + } + + return $content; +} +add_filter('the_excerpt_rss', 'rss_post_thumbnail'); +add_filter('the_content_feed', 'rss_post_thumbnail'); + +# aggiunta autori in apertura e messaggio di chiusura per post nel feed +function eduinaf_postrss($content) { + if ( function_exists( 'get_coauthors' ) ) { + $coauthors = coauthors_posts_links(", ", " e ", null, null, false); + } else { + $coauthors = get_author_posts_url( $coauthor->ID, $coauthor->user_nicename ); + } + + if( is_feed() ){ + $content = '

Questo articolo รจ stato scritto da '.$coauthors.'

'.$content.'

Leggi Edu INAF

'; + } + + return $content; +} +add_filter('the_excerpt_rss', 'eduinaf_postrss'); +add_filter('the_content', 'eduinaf_postrss'); + +# striscia ultimo aggiornamento +function wpb_last_updated_date( $content ) { + $u_time = get_the_time('U'); + $u_modified_time = get_the_modified_time('U'); + if ($u_modified_time >= $u_time + 86400) { + $updated_date = get_the_modified_time('j F Y'); + $custom_content .= '

Aggiornato il '. $updated_date .'

'; + } + + $custom_content .= $content; + + if ( get_post_type() <> 'page' && get_post_type() <> 'oae_italia' ) { + return $custom_content; + } else { + if ( get_the_ID() === 17897 ) { + return $custom_content; + } else { + return $content; + } + } +} +add_filter( 'the_content', 'wpb_last_updated_date' ); + +# creazione shortcode per alcuni link esterni +# astroEdu +add_shortcode('astroedu', 'astroedu'); +function astroedu ($atts, $content = null) { + extract( + shortcode_atts( + array( + 'lang' => null, + 'code' => null, + ), + $atts + ) + ); + + if ( $lang <> null ) { + $link = ''.$content.''; + } else { + $link = ''.$content.''; + } + + return $link; +} + +# Spacescoop +add_shortcode('spacescoop', 'spacescoop'); +function spacescoop ($atts, $content = null) { + extract( + shortcode_atts( + array( + 'lang' => null, + 'code' => null, + ), + $atts + ) + ); + + if ( $lang <> null ) { + $link = ''.$content.''; + } else { + $link = ''.$content.''; + } + + return $link; +} + +# Sapere +add_shortcode('sapere', 'sapere'); +function sapere ($atts, $content = null) { + extract( + shortcode_atts( + array( + 'url' => null, + 'num' => null, + 'data' => null, + 'doi' => null, + ), + $atts + ) + ); + + if ( $doi <> null ) { + if ( $url <> null ) { + $link = 'Estratto dall\'articolo "'.$content.'" uscito su Sapere n.'.$num.' di '.$data.'. doi:'.$doi.''; + } else { + $link = 'Estratto dall\'articolo "'.$content.'" uscito su Sapere n.'.$num.' di '.$data.'. doi:'.$doi.''; + } + } else { + if ( $url <> null ) { + $link = 'Estratto dall\'articolo "'.$content.'" uscito su Sapere n.'.$num.' di '.$data.'.'; + } else { + $link = 'Estratto dall\'articolo "'.$content.'" uscito su Sapere n.'.$num.' di '.$data.'.'; + } + } + + return $link; +} \ No newline at end of file