2021.1016 Aggiunti due nuovi parametri

This commit is contained in:
ulaulaman 2021-10-16 00:56:32 +02:00
parent 2638d2550d
commit 8f73e42fc9
1 changed files with 66 additions and 56 deletions

View File

@ -2,12 +2,14 @@
/* /*
Plugin Name: Book Template Plugin Name: Book Template
Description: Plugin che aggiunge uno shortcode per la creazione di un box con i dati editoriali di un libro o di un fumetto. Description: Plugin che aggiunge uno shortcode per la creazione di un box con i dati editoriali di un libro o di un fumetto.
Version: 2020.0813 Version: 2021.1016
Author: Gianluigi Filippelli Author: Gianluigi Filippelli
Author URI: http://dropseaofulaula.blogspot.it/ Author URI: http://dropseaofulaula.blogspot.it/
Plugin URI: https://ulaulaman.github.io/book-template/ Plugin URI: https://ulaulaman.github.io/#BookTemplate
GitHub Plugin URI: https://github.com/ulaulaman/book-template
License: GPLv2 or later License: GPLv2 or later
*/ */
# Caricamento traduzioni # Caricamento traduzioni
add_action('plugins_loaded', 'bt_load_translations'); add_action('plugins_loaded', 'bt_load_translations');
function bt_load_translations() { function bt_load_translations() {
@ -51,68 +53,76 @@ function bookdata_class_meta_box( $post ) { ?>
# Creazione shortcode dati editoriali # Creazione shortcode dati editoriali
add_shortcode( 'bookdata', 'bookdata' ); add_shortcode( 'bookdata', 'bookdata' );
function bookdata ($atts, $content = null) { function bookdata ( $atts, $content = null ) {
extract( extract(
shortcode_atts( shortcode_atts(
array( array(
'title' => null, 'intro' => null,
'author' => null, 'title' => null,
'translator' => null, 'url' => null,
'publisher' => null, 'author' => null,
'date' => null, 'translator' => null,
'pages' => null, 'publisher' => null,
'type' => null, 'date' => null,
'col' => null, 'pages' => null,
'price' => null, 'type' => null,
'age' => null, 'col' => null,
'isbn' => null, 'price' => null,
'issn' => null, 'age' => null,
'notes' => null, 'isbn' => null,
), 'issn' => null,
$atts 'notes' => null,
) ),
); $atts
)
);
$intro = __( 'Abbiamo parlato di:', 'book-template' ); $book='<p>';
$book = '<p><strong>'.$intro.'</strong><br/><em>'.$title.'</em><br/>'.$author; if ( $intro <> null ) {
$book = $book.'<strong>'.$intro.'</strong>';
} else {
$book = $book.'<strong>'.__( 'Abbiamo parlato di:', 'book-template' ).'</strong>';
}
if ( $translator <> null ) if ( $url <> null ) {
{$translator = __( 'Traduzione di ', 'book-template' ).$translator; $book = $book.'<br/><a href="'.$url.' target="book"><wm>'.$title.'</em></a><br/>'.$author;
$book = $book.'<br/>'.$translator;} } else {
else $book = $book.'<br/><em>'.$title.'</em><br/>'.$author;
{$book = $book;} }
$pages = $pages.' '.__( 'pagine', 'book-template' ); if ( $translator <> null ) {
$book = $book.'<br/>'.__( 'Traduzione di ', 'book-template' ).$translator;
}
if ( $col <> null ) $pages = $pages.' '.__( 'pagine', 'book-template' );
{$book = $book.'<br/>'.$publisher.', '.$date.'<br/>'.$pages.', '.$type.', '.$col.' '.$price;}
else
{$book = $book.'<br/>'.$publisher.', '.$date.'<br/>'.$pages.', '.$type.' '.$price;}
if ( $age <> null ) if ( $col <> null ) {
{$book = $book.'<br/>'.__( 'Lettura consigliata per ', 'book-template' ).$age;} $book = $book.'<br/>'.$publisher.', '.$date.'<br/>'.$pages.', '.$type.', '.$col.' '.$price;
else } else {
{$book = $book;} $book = $book.'<br/>'.$publisher.', '.$date.'<br/>'.$pages.', '.$type.' '.$price;
}
if ( $isbn <> null ) if ( $age <> null ) {
{$book = $book.'<br/>ISBN: '.$isbn;} $book = $book.'<br/>'.__( 'Lettura consigliata ', 'book-template' ).$age;
else }
{
if ( $issn <> null )
{$book = $book.'<br/>ISSN: '.$issn;}
else
{$book = $book;}
}
if ( $notes <> null ) if ( $isbn <> null ) {
{$book = $book.'<br/>'.$notes;} $book = $book.'<br/>ISBN: '.$isbn;
else } else {
{$book = $book;} if ( $issn <> null ) {
$book = $book.'<br/>ISSN: '.$issn;
}
}
$text = $book; if ( $notes <> null ) {
return $text; $book = $book.'<br/>'.$notes;
}
$book = $book.'</p>';
return $book;
} }
?> ?>