Aggiunto lo shortcode della sidebar del corso base di astronomia

This commit is contained in:
ulaulaman 2020-11-19 22:08:21 +01:00
parent 0759de7e87
commit 71c76895d3
1 changed files with 36 additions and 0 deletions

36
sidebars/brera.php Normal file
View File

@ -0,0 +1,36 @@
<?php
#
# corso base di astronomia - Brera
#
add_shortcode( 'sbcorsobase', function () {
$logo = '<p align="center"><img src="https://edu.inaf.it/wp-content/plugins/eduinaf/images/loghi/corso_base_astro.png" /></p>';
$autore = do_shortcode('[blog-post-coauthors]');
$breraNav = wp_get_nav_menu_items(1682);
foreach ( $breraNav as $navItem ) {
$nav = $nav. '<button><a href="'.$navItem->url.'" title="'.$navItem->title.'">'.$navItem->title.'</a></button>';
}
$menu = '<div align="center" class="btn-group">'.$nav.'</div>';
$custom = get_post_custom();
foreach( $custom as $key => $value ) {
$key_name = get_post_custom_values( $key = 'pdfcap' );
if ( $key_name[0] <> null ) {
$capitolo = '<p><a href="'.$key_name[0].'" target="pdf">Scarica la lezione in pdf</a></p>';
} else {
$capitolo = null;
}
}
$cap = '<p><strong>Lezione a cura di</strong>: '.$autore.'</p>';
$sidebar = $logo.$cap.$capitolo.$menu;
$out = $sidebar;
return $out;
} );