file separato per astroedu et al.

Creazione di un file separato dove conservare il codice per gli shortcode che creano i collegamento alle schede di astroedu e alle news di spacescoop
This commit is contained in:
ulaulaman 2018-02-11 17:42:15 +01:00 committed by GitHub
parent b81fda8a09
commit 425facf837
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 42 additions and 0 deletions

42
link/link.php Normal file
View File

@ -0,0 +1,42 @@
<?php
# creazione link esterni con shortcode
# astroedu
add_shortcode('astroedu', 'astroedu');
function astroedu ($atts, $content = null) {
extract(
shortcode_atts(
array(
'lang' => null,
'code' => null,
),
$atts
)
);
$link = '<a href="http://astroedu.iau.org/'.$lang.'/activities/'.$code.'/" target="astroedu">'.$content.'</a>';
return $link;
}
# spacescoop
add_shortcode('spacescoop', 'spacescoop');
function spacescoop ($atts, $content = null) {
extract(
shortcode_atts(
array(
'lang' => null,
'code' => null,
),
$atts
)
);
$link = '<a href="http://www.spacescoop.org/'.$lang.'/scoops/'.$code.'/" target="spacescoop">'.$content.'</a>';
return $link;
}